From 8f01848075d4017aecdd793f47b979310b934088 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Thu, 19 Sep 2019 12:35:55 -0400 Subject: [PATCH 1/2] libressl: support musl in libressl 2.9.2 --- pkgs/development/libraries/libressl/default.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/libressl/default.nix b/pkgs/development/libraries/libressl/default.nix index 4bfa6cd0b8e4..41f24a36eacc 100644 --- a/pkgs/development/libraries/libressl/default.nix +++ b/pkgs/development/libraries/libressl/default.nix @@ -1,8 +1,8 @@ -{ stdenv, fetchurl, lib, cmake, cacert }: +{ stdenv, fetchurl, lib, cmake, cacert, fetchpatch }: let - generic = { version, sha256 }: stdenv.mkDerivation rec { + generic = { version, sha256, patches ? [] }: stdenv.mkDerivation rec { pname = "libressl"; inherit version; @@ -31,6 +31,8 @@ let rm configure ''; + inherit patches; + # Since 2.9.x the default location can't be configured from the build using # DEFAULT_CA_FILE anymore, instead we have to patch the default value. postPatch = lib.optionalString (lib.versionAtLeast version "2.9.2") '' @@ -69,6 +71,12 @@ in { libressl_2_9 = generic { version = "2.9.2"; sha256 = "1m6mz515dcbrbnyz8hrpdfjzdmj1c15vbgnqxdxb89g3z9kq3iy4"; + patches = stdenv.lib.optional stdenv.hostPlatform.isMusl [ + (fetchpatch { + url = "https://github.com/libressl-portable/portable/pull/529/commits/a747aacc23607c993cc481378782b2c7dd5bc53b.patch"; + sha256 = "0wbrcscdkjpk4mhh7f3saghi4smia4lhf7fl6la3ahhgx1krn5zm"; + }) + ]; }; libressl_3_0 = generic { From 37744d2c3638f785813726c0c433f9a6260520d4 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Thu, 19 Sep 2019 12:37:34 -0400 Subject: [PATCH 2/2] libressl: add static override --- pkgs/development/libraries/libressl/default.nix | 5 ++--- pkgs/top-level/static.nix | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/libressl/default.nix b/pkgs/development/libraries/libressl/default.nix index 41f24a36eacc..22696f230e82 100644 --- a/pkgs/development/libraries/libressl/default.nix +++ b/pkgs/development/libraries/libressl/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, lib, cmake, cacert, fetchpatch }: +{ stdenv, fetchurl, lib, cmake, cacert, fetchpatch, buildShared ? true }: let @@ -15,13 +15,12 @@ let cmakeFlags = [ "-DENABLE_NC=ON" - "-DBUILD_SHARED_LIBS=ON" # Ensure that the output libraries do not require an executable stack. # Without this define, assembly files in libcrypto do not include a # .note.GNU-stack section, and if that section is missing from any object, # the linker will make the stack executable. "-DCMAKE_C_FLAGS=-DHAVE_GNU_STACK" - ]; + ] ++ lib.optional buildShared "-DBUILD_SHARED_LIBS=ON"; # The autoconf build is broken as of 2.9.1, resulting in the following error: # libressl-2.9.1/tls/.libs/libtls.a', needed by 'handshake_table'. diff --git a/pkgs/top-level/static.nix b/pkgs/top-level/static.nix index bc6c3525f77e..706c64c2e359 100644 --- a/pkgs/top-level/static.nix +++ b/pkgs/top-level/static.nix @@ -148,6 +148,9 @@ in { enableShared = false; enableStatic = true; }; + libressl = super.libressl.override { + buildShared = false; + }; darwin = super.darwin // { libiconv = super.darwin.libiconv.override {