From ebf04d83c028906570d6cd09fc29780732888a50 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Mon, 26 Mar 2018 13:50:01 -0500 Subject: [PATCH] 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 00000000000..3962dcb19a2 --- /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 083541e5e93..0f16e8cc79b 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; }