treewide: Use pkgs/build-support/roles.bash to remove copy pasta

Also fix some setup hooks that unnecessarily used environment hooks,
which revolted in the same variable being modified too many times.
This commit is contained in:
John Ericson
2018-05-07 15:10:37 -04:00
parent 34a3233a2e
commit 2110c0bd30
29 changed files with 203 additions and 261 deletions
@@ -1,18 +1,6 @@
setupCompatFlags() {
# 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
# See pkgs/build-support/setup-hooks/role.bash
getHostRole
export NIX_${role}LDFLAGS+=" -lnbcompat"
export NIX_${role}CFLAGS_COMPILE+=" -DHAVE_NBTOOL_CONFIG_H"
export NIX_${role}CFLAGS_COMPILE+=" -include nbtool_config.h"
}
addEnvHooks "$hostOffset" setupCompatFlags
export NIX_${role_pre}LDFLAGS+=" -lnbcompat"
export NIX_${role_pre}CFLAGS_COMPILE+=" -DHAVE_NBTOOL_CONFIG_H"
export NIX_${role_pre}CFLAGS_COMPILE+=" -include nbtool_config.h"
+8 -2
View File
@@ -167,7 +167,10 @@ let
sha256 = "17phkfafybxwhzng44k5bhmag6i55br53ky1nwcmw583kg2fa86z";
version = "7.1.2";
setupHook = ./compat-setup-hook.sh;
setupHooks = [
../../../build-support/setup-hooks/role.bash
./compat-setup-hook.sh
];
# override defaults to prevent infinite recursion
nativeBuildInputs = [ makeMinimal ];
@@ -270,7 +273,10 @@ let
runHook postInstall
'';
setupHook = ./fts-setup-hook.sh;
setupHooks = [
../../../build-support/setup-hooks/role.bash
./fts-setup-hook.sh
];
};
stat = netBSDDerivation {
+3 -15
View File
@@ -1,16 +1,4 @@
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
# See pkgs/build-support/setup-hooks/role.bash
getHostRole
export NIX_${role}LDFLAGS+=" -lfts"
}
addEnvHooks "$hostOffset" ftsLdflags
export NIX_${role_pre}LDFLAGS+=" -lfts"