From ebf04d83c028906570d6cd09fc29780732888a50 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Mon, 26 Mar 2018 13:50:01 -0500 Subject: [PATCH 1/2] musl-fts: add setup-hook to add -lfts --- pkgs/os-specific/linux/musl/fts-setup-hook.sh | 17 +++++++++++++++++ pkgs/os-specific/linux/musl/fts.nix | 2 ++ 2 files changed, 19 insertions(+) create mode 100644 pkgs/os-specific/linux/musl/fts-setup-hook.sh diff --git a/pkgs/os-specific/linux/musl/fts-setup-hook.sh b/pkgs/os-specific/linux/musl/fts-setup-hook.sh new file mode 100644 index 000000000000..3962dcb19a20 --- /dev/null +++ b/pkgs/os-specific/linux/musl/fts-setup-hook.sh @@ -0,0 +1,17 @@ +ftsLdflags() { + # The `depHostOffset` describes how the host platform of the dependencies + # are slid relative to the depending package. It is brought into scope of + # the environment hook defined as the role of the dependency being applied. + case $depHostOffset in + -1) local role='BUILD_' ;; + 0) local role='' ;; + 1) local role='TARGET_' ;; + *) echo "cc-wrapper: Error: Cannot be used with $depHostOffset-offset deps" >2; + return 1 ;; + esac + + export NIX_${role}LDFLAGS+=" -lfts" +} + +addEnvHooks "$hostOffset" ftsLdflags + diff --git a/pkgs/os-specific/linux/musl/fts.nix b/pkgs/os-specific/linux/musl/fts.nix index 083541e5e935..0f16e8cc79bf 100644 --- a/pkgs/os-specific/linux/musl/fts.nix +++ b/pkgs/os-specific/linux/musl/fts.nix @@ -11,4 +11,6 @@ stdenv.mkDerivation rec { }; nativeBuildInputs = [ autoreconfHook pkgconfig ]; + + setupHook = ./fts-setup-hook.sh; } From 69ca33057e489012b87b93771193862c744fc097 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Mon, 26 Mar 2018 13:50:20 -0500 Subject: [PATCH 2/2] xar, libselinux: use musl-fts on musl, fix --- pkgs/os-specific/linux/libselinux/default.nix | 4 +++- pkgs/tools/compression/xar/default.nix | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/os-specific/linux/libselinux/default.nix b/pkgs/os-specific/linux/libselinux/default.nix index 541ead7258f6..c276f56dd8b2 100644 --- a/pkgs/os-specific/linux/libselinux/default.nix +++ b/pkgs/os-specific/linux/libselinux/default.nix @@ -1,5 +1,6 @@ { stdenv, fetchurl, fetchpatch, pkgconfig, libsepol, pcre , enablePython ? true, swig ? null, python ? null +, musl-fts }: assert enablePython -> swig != null && python != null; @@ -18,7 +19,8 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ pkgconfig ]; buildInputs = [ libsepol pcre ] - ++ optionals enablePython [ swig python ]; + ++ optionals enablePython [ swig python ] + ++ optional stdenv.hostPlatform.isMusl musl-fts; # Avoid this false warning: # avc_internal.c: In function 'avc_netlink_receive': diff --git a/pkgs/tools/compression/xar/default.nix b/pkgs/tools/compression/xar/default.nix index c62eead3cb73..01d18fe6ad7d 100644 --- a/pkgs/tools/compression/xar/default.nix +++ b/pkgs/tools/compression/xar/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, libxml2, openssl, zlib, bzip2 }: +{ stdenv, fetchurl, libxml2, openssl, zlib, bzip2, musl-fts }: stdenv.mkDerivation rec { version = "1.6.1"; @@ -9,7 +9,8 @@ stdenv.mkDerivation rec { sha256 = "0ghmsbs6xwg1092v7pjcibmk5wkyifwxw6ygp08gfz25d2chhipf"; }; - buildInputs = [ libxml2 openssl zlib bzip2 ]; + buildInputs = [ libxml2 openssl zlib bzip2 ] + ++ stdenv.lib.optional stdenv.hostPlatform.isMusl musl-fts; meta = { homepage = https://mackyle.github.io/xar/;