lol

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.

+203 -261
+6 -1
pkgs/build-support/bintools-wrapper/default.nix
··· 190 190 191 191 depsTargetTargetPropagated = extraPackages; 192 192 193 - setupHook = ./setup-hook.sh; 193 + wrapperName = "BINTOOLS_WRAPPER"; 194 + 195 + setupHooks = [ 196 + ../setup-hooks/role.bash 197 + ./setup-hook.sh 198 + ]; 194 199 195 200 postFixup = 196 201 ''
+8 -30
pkgs/build-support/bintools-wrapper/setup-hook.sh
··· 11 11 [[ -z ${crossConfig-} ]] || (( "$hostOffset" < 0 )) || return 0 12 12 13 13 bintoolsWrapper_addLDVars () { 14 - case $depHostOffset in 15 - -1) local role='BUILD_' ;; 16 - 0) local role='' ;; 17 - 1) local role='TARGET_' ;; 18 - *) echo "bintools-wrapper: Error: Cannot be used with $depHostOffset-offset deps" >2; 19 - return 1 ;; 20 - esac 14 + # See ../setup-hooks/role.bash 15 + local role_post role_pre 16 + getTargetRoleEnvHook 21 17 22 18 if [[ -d "$1/lib64" && ! -L "$1/lib64" ]]; then 23 - export NIX_${role}LDFLAGS+=" -L$1/lib64" 19 + export NIX_${role_pre}LDFLAGS+=" -L$1/lib64" 24 20 fi 25 21 26 22 if [[ -d "$1/lib" ]]; then 27 - export NIX_${role}LDFLAGS+=" -L$1/lib" 23 + export NIX_${role_pre}LDFLAGS+=" -L$1/lib" 28 24 fi 29 25 } 30 26 31 - case $targetOffset in 32 - -1) 33 - export NIX_BINTOOLS_WRAPPER_@infixSalt@_TARGET_BUILD=1 34 - role_pre='BUILD_' 35 - role_post='_FOR_BUILD' 36 - ;; 37 - 0) 38 - export NIX_BINTOOLS_WRAPPER_@infixSalt@_TARGET_HOST=1 39 - role_pre='' 40 - role_post='' 41 - ;; 42 - 1) 43 - export NIX_BINTOOLS_WRAPPER_@infixSalt@_TARGET_TARGET=1 44 - role_pre='TARGET_' 45 - role_post='_FOR_TARGET' 46 - ;; 47 - *) 48 - echo "cc-wrapper: used as improper sort of dependency" >2; 49 - return 1 50 - ;; 51 - esac 27 + # See ../setup-hooks/role.bash 28 + getTargetRole 29 + getTargetRoleWrapper 52 30 53 31 addEnvHooks "$targetOffset" bintoolsWrapper_addLDVars 54 32
+6 -1
pkgs/build-support/cc-wrapper/default.nix
··· 191 191 propagatedBuildInputs = [ bintools ]; 192 192 depsTargetTargetPropagated = extraPackages; 193 193 194 - setupHook = ./setup-hook.sh; 194 + wrapperName = "CC_WRAPPER"; 195 + 196 + setupHooks = [ 197 + ../setup-hooks/role.bash 198 + ./setup-hook.sh 199 + ]; 195 200 196 201 postFixup = 197 202 ''
+8 -41
pkgs/build-support/cc-wrapper/setup-hook.sh
··· 66 66 # over no state, and there's no @-substitutions within, so any redefined 67 67 # function is guaranteed to be exactly the same. 68 68 ccWrapper_addCVars () { 69 - # The `depHostOffset` describes how the host platform of the dependencies 70 - # are slid relative to the depending package. It is brought into scope of 71 - # the environment hook defined as the role of the dependency being applied. 72 - case $depHostOffset in 73 - -1) local role='BUILD_' ;; 74 - 0) local role='' ;; 75 - 1) local role='TARGET_' ;; 76 - *) echo "cc-wrapper: Error: Cannot be used with $depHostOffset-offset deps" >2; 77 - return 1 ;; 78 - esac 69 + # See ../setup-hooks/role.bash 70 + local role_post role_pre 71 + getTargetRoleEnvHook 79 72 80 73 if [[ -d "$1/include" ]]; then 81 - export NIX_${role}CFLAGS_COMPILE+=" ${ccIncludeFlag:--isystem} $1/include" 74 + export NIX_${role_pre}CFLAGS_COMPILE+=" ${ccIncludeFlag:--isystem} $1/include" 82 75 fi 83 76 84 77 if [[ -d "$1/Library/Frameworks" ]]; then 85 - export NIX_${role}CFLAGS_COMPILE+=" -F$1/Library/Frameworks" 78 + export NIX_${role_pre}CFLAGS_COMPILE+=" -F$1/Library/Frameworks" 86 79 fi 87 80 } 88 81 89 - # Since the same cc-wrapper derivation can be depend on in multiple ways, we 90 - # need to accumulate *each* role (i.e. target platform relative the depending 91 - # derivation) in which the cc-wrapper derivation is used. 92 - # `NIX_CC_WRAPPER_@infixSalt@_TARGET_*` tracks this (needs to be an exported env 93 - # var so can't use fancier data structures). 94 - # 95 - # We also need to worry about what role is being added on *this* invocation of 96 - # setup-hook, which `role` tracks. 97 - case $targetOffset in 98 - -1) 99 - export NIX_CC_WRAPPER_@infixSalt@_TARGET_BUILD=1 100 - role_pre='BUILD_' 101 - role_post='_FOR_BUILD' 102 - ;; 103 - 0) 104 - export NIX_CC_WRAPPER_@infixSalt@_TARGET_HOST=1 105 - role_pre='' 106 - role_post='' 107 - ;; 108 - 1) 109 - export NIX_CC_WRAPPER_@infixSalt@_TARGET_TARGET=1 110 - role_pre='TARGET_' 111 - role_post='_FOR_TARGET' 112 - ;; 113 - *) 114 - echo "cc-wrapper: used as improper sort of dependency" >2; 115 - return 1 116 - ;; 117 - esac 82 + # See ../setup-hooks/role.bash 83 + getTargetRole 84 + getTargetRoleWrapper 118 85 119 86 # We use the `targetOffset` to choose the right env hook to accumulate the right 120 87 # sort of deps (those with that offset).
+75
pkgs/build-support/setup-hooks/role.bash
··· 1 + # Since the same derivation can be depend on in multiple ways, we need to 2 + # accumulate *each* role (i.e. host and target platforms relative the depending 3 + # derivation) in which the derivation is used. 4 + # 5 + # The role is intened to be use as part of other variables names like 6 + # - $NIX_${role_pre}_SOMETHING 7 + # - $NIX_SOMETHING_${role_post} 8 + 9 + function getRole() { 10 + case $1 in 11 + -1) 12 + role_pre='BUILD_' 13 + role_post='_FOR_BUILD' 14 + ;; 15 + 0) 16 + role_pre='' 17 + role_post='' 18 + ;; 19 + 1) 20 + role_pre='TARGET_' 21 + role_post='_FOR_TARGET' 22 + ;; 23 + *) 24 + echo "@name@: used as improper sort of dependency" >2 25 + return 1 26 + ;; 27 + esac 28 + } 29 + 30 + # `hostOffset` describes how the host platform of the package is slid relative 31 + # to the depending package. `targetOffset` likewise describes the target 32 + # platform of the package. Both are brought into scope of the setup hook defined 33 + # for dependency whose setup hook is being processed relative to the package 34 + # being built. 35 + 36 + function getHostRole() { 37 + getRole "$hostOffset" 38 + } 39 + function getTargetRole() { 40 + getRole "$targetOffset" 41 + } 42 + 43 + # `depHostOffset` describes how the host platform of the dependencies are slid 44 + # relative to the depending package. `depTargetOffset` likewise describes the 45 + # target platform of dependenices. Both are brought into scope of the 46 + # environment hook defined for the dependency being applied relative to the 47 + # package being built. 48 + 49 + function getHostRoleEnvHook() { 50 + getRole "$depHostOffset" 51 + } 52 + function getTargetRoleEnvHook() { 53 + getRole "$depTargetOffset" 54 + } 55 + 56 + # This variant is inteneded specifically for code-prodocing tool wrapper scripts 57 + # `NIX_@wrapperName@_@infixSalt@_TARGET_*` tracks this (needs to be an exported 58 + # env var so can't use fancier data structures). 59 + function getTargetRoleWrapper() { 60 + case $targetOffset in 61 + -1) 62 + export NIX_@wrapperName@_@infixSalt@_TARGET_BUILD=1 63 + ;; 64 + 0) 65 + export NIX_@wrapperName@_@infixSalt@_TARGET_HOST=1 66 + ;; 67 + 1) 68 + export NIX_@wrapperName@_@infixSalt@_TARGET_TARGET=1 69 + ;; 70 + *) 71 + echo "@name@: used as improper sort of dependency" >2 72 + return 1 73 + ;; 74 + esac 75 + }
+4 -12
pkgs/development/compilers/gcc/libstdc++-hook.sh
··· 1 - # The `hostOffset` describes how the host platform of the dependencies are slid 2 - # relative to the depending package. It is brought into scope of the setup hook 3 - # defined as the role of the dependency whose hooks is being run. 4 - case $hostOffset in 5 - -1) local role='BUILD_' ;; 6 - 0) local role='' ;; 7 - 1) local role='TARGET_' ;; 8 - *) echo "cc-wrapper: Error: Cannot be used with $hostOffset-offset deps" >2; 9 - return 1 ;; 10 - esac 1 + # See pkgs/build-support/setup-hooks/role.bash 2 + getHostRole 11 3 12 - export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem $(echo -n @gcc@/include/c++/*) -isystem $(echo -n @gcc@/include/c++/*)/$(@gcc@/bin/gcc -dumpmachine)" 13 - export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libstdc++" 4 + export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem $(echo -n @gcc@/include/c++/*) -isystem $(echo -n @gcc@/include/c++/*)/$(@gcc@/bin/gcc -dumpmachine)" 5 + export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libstdc++"
+4 -1
pkgs/development/compilers/llvm/3.5/libc++/default.nix
··· 39 39 40 40 linkCxxAbi = stdenv.isLinux; 41 41 42 - setupHook = ./setup-hook.sh; 42 + setupHooks = [ 43 + ../../../../../build-support/setup-hooks/role.bash 44 + ./setup-hook.sh 45 + ]; 43 46 44 47 meta = { 45 48 homepage = http://libcxx.llvm.org/;
+4 -12
pkgs/development/compilers/llvm/3.5/libc++/setup-hook.sh
··· 1 - # The `hostOffset` describes how the host platform of the dependencies are slid 2 - # relative to the depending package. It is brought into scope of the setup hook 3 - # defined as the role of the dependency whose hooks is being run. 4 - case $hostOffset in 5 - -1) local role='BUILD_' ;; 6 - 0) local role='' ;; 7 - 1) local role='TARGET_' ;; 8 - *) echo "cc-wrapper: Error: Cannot be used with $hostOffset-offset deps" >2; 9 - return 1 ;; 10 - esac 1 + # See pkgs/build-support/setup-hooks/role.bash 2 + getHostRole 11 3 12 4 linkCxxAbi="@linkCxxAbi@" 13 - export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" 14 - export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" 5 + export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" 6 + export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
+4 -1
pkgs/development/compilers/llvm/3.7/libc++/default.nix
··· 33 33 34 34 linkCxxAbi = stdenv.isLinux; 35 35 36 - setupHook = ./setup-hook.sh; 36 + setupHooks = [ 37 + ../../../../../build-support/setup-hooks/role.bash 38 + ./setup-hook.sh 39 + ]; 37 40 38 41 meta = { 39 42 homepage = http://libcxx.llvm.org/;
+4 -12
pkgs/development/compilers/llvm/3.7/libc++/setup-hook.sh
··· 1 - # The `hostOffset` describes how the host platform of the dependencies are slid 2 - # relative to the depending package. It is brought into scope of the setup hook 3 - # defined as the role of the dependency whose hooks is being run. 4 - case $hostOffset in 5 - -1) local role='BUILD_' ;; 6 - 0) local role='' ;; 7 - 1) local role='TARGET_' ;; 8 - *) echo "cc-wrapper: Error: Cannot be used with $hostOffset-offset deps" >2; 9 - return 1 ;; 10 - esac 1 + # See pkgs/build-support/setup-hooks/role.bash 2 + getHostRole 11 3 12 4 linkCxxAbi="@linkCxxAbi@" 13 - export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" 14 - export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" 5 + export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" 6 + export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
+4 -1
pkgs/development/compilers/llvm/3.8/libc++/default.nix
··· 31 31 32 32 linkCxxAbi = stdenv.isLinux; 33 33 34 - setupHook = ./setup-hook.sh; 34 + setupHooks = [ 35 + ../../../../../build-support/setup-hooks/role.bash 36 + ./setup-hook.sh 37 + ]; 35 38 36 39 meta = { 37 40 homepage = http://libcxx.llvm.org/;
+4 -12
pkgs/development/compilers/llvm/3.8/libc++/setup-hook.sh
··· 1 - # The `hostOffset` describes how the host platform of the dependencies 2 - # relative to the depending package. It is brought into scope of the setup hook 3 - # defined as the role of the dependency whose hooks is being run. 4 - case $hostOffset in 5 - -1) local role='BUILD_' ;; 6 - 0) local role='' ;; 7 - 1) local role='TARGET_' ;; 8 - *) echo "cc-wrapper: Error: Cannot be used with $hostOffset-offset deps" >2; 9 - return 1 ;; 10 - esac 1 + # See pkgs/build-support/setup-hooks/role.bash 2 + getHostRole 11 3 12 4 linkCxxAbi="@linkCxxAbi@" 13 - export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" 14 - export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" 5 + export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" 6 + export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
+4 -1
pkgs/development/compilers/llvm/3.9/libc++/default.nix
··· 31 31 32 32 linkCxxAbi = stdenv.isLinux; 33 33 34 - setupHook = ./setup-hook.sh; 34 + setupHooks = [ 35 + ../../../../../build-support/setup-hooks/role.bash 36 + ./setup-hook.sh 37 + ]; 35 38 36 39 meta = { 37 40 homepage = http://libcxx.llvm.org/;
+4 -12
pkgs/development/compilers/llvm/3.9/libc++/setup-hook.sh
··· 1 - # The `hostOffset` describes how the host platform of the dependencies 2 - # relative to the depending package. It is brought into scope of the setup hook 3 - # defined as the role of the dependency whose hooks is being run. 4 - case $hostOffset in 5 - -1) local role='BUILD_' ;; 6 - 0) local role='' ;; 7 - 1) local role='TARGET_' ;; 8 - *) echo "cc-wrapper: Error: Cannot be used with $hostOffset-offset deps" >2; 9 - return 1 ;; 10 - esac 1 + # See pkgs/build-support/setup-hooks/role.bash 2 + getHostRole 11 3 12 4 linkCxxAbi="@linkCxxAbi@" 13 - export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" 14 - export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" 5 + export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" 6 + export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
+4 -1
pkgs/development/compilers/llvm/4/libc++/default.nix
··· 44 44 45 45 linkCxxAbi = stdenv.isLinux; 46 46 47 - setupHook = ./setup-hook.sh; 47 + setupHooks = [ 48 + ../../../../../build-support/setup-hooks/role.bash 49 + ./setup-hook.sh 50 + ]; 48 51 49 52 meta = { 50 53 homepage = http://libcxx.llvm.org/;
+4 -12
pkgs/development/compilers/llvm/4/libc++/setup-hook.sh
··· 1 - # The `hostOffset` describes how the host platform of the dependencies 2 - # relative to the depending package. It is brought into scope of the setup hook 3 - # defined as the role of the dependency whose hooks is being run. 4 - case $hostOffset in 5 - -1) local role='BUILD_' ;; 6 - 0) local role='' ;; 7 - 1) local role='TARGET_' ;; 8 - *) echo "cc-wrapper: Error: Cannot be used with $hostOffset-offset deps" >2; 9 - return 1 ;; 10 - esac 1 + # See pkgs/build-support/setup-hooks/role.bash 2 + getHostRole 11 3 12 4 linkCxxAbi="@linkCxxAbi@" 13 - export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" 14 - export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" 5 + export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" 6 + export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
+4 -1
pkgs/development/compilers/llvm/5/libc++/default.nix
··· 40 40 41 41 linkCxxAbi = stdenv.isLinux; 42 42 43 - setupHook = ./setup-hook.sh; 43 + setupHooks = [ 44 + ../../../../../build-support/setup-hooks/role.bash 45 + ./setup-hook.sh 46 + ]; 44 47 45 48 meta = { 46 49 homepage = http://libcxx.llvm.org/;
+4 -12
pkgs/development/compilers/llvm/5/libc++/setup-hook.sh
··· 1 - # The `hostOffset` describes how the host platform of the dependencies 2 - # relative to the depending package. It is brought into scope of the setup hook 3 - # defined as the role of the dependency whose hooks is being run. 4 - case $hostOffset in 5 - -1) local role='BUILD_' ;; 6 - 0) local role='' ;; 7 - 1) local role='TARGET_' ;; 8 - *) echo "cc-wrapper: Error: Cannot be used with $hostOffset-offset deps" >2; 9 - return 1 ;; 10 - esac 1 + # See pkgs/build-support/setup-hooks/role.bash 2 + getHostRole 11 3 12 4 linkCxxAbi="@linkCxxAbi@" 13 - export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" 14 - export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" 5 + export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" 6 + export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
+4 -1
pkgs/development/compilers/llvm/6/libc++/default.nix
··· 40 40 41 41 linkCxxAbi = stdenv.isLinux; 42 42 43 - setupHook = ./setup-hook.sh; 43 + setupHooks = [ 44 + ../../../../../build-support/setup-hooks/role.bash 45 + ./setup-hook.sh 46 + ]; 44 47 45 48 meta = { 46 49 homepage = http://libcxx.llvm.org/;
+4 -12
pkgs/development/compilers/llvm/6/libc++/setup-hook.sh
··· 1 - # The `hostOffset` describes how the host platform of the dependencies 2 - # relative to the depending package. It is brought into scope of the setup hook 3 - # defined as the role of the dependency whose hooks is being run. 4 - case $hostOffset in 5 - -1) local role='BUILD_' ;; 6 - 0) local role='' ;; 7 - 1) local role='TARGET_' ;; 8 - *) echo "cc-wrapper: Error: Cannot be used with $hostOffset-offset deps" >2; 9 - return 1 ;; 10 - esac 1 + # See pkgs/build-support/setup-hooks/role.bash 2 + getHostRole 11 3 12 4 linkCxxAbi="@linkCxxAbi@" 13 - export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" 14 - export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" 5 + export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" 6 + export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
+4 -1
pkgs/development/libraries/gettext/default.nix
··· 48 48 # HACK, see #10874 (and 14664) 49 49 buildInputs = stdenv.lib.optional (!stdenv.isLinux && !hostPlatform.isCygwin) libiconv; 50 50 51 - setupHook = ./gettext-setup-hook.sh; 51 + setupHooks = [ 52 + ../../../build-support/setup-hooks/role.bash 53 + ./gettext-setup-hook.sh 54 + ]; 52 55 gettextNeedsLdflags = hostPlatform.libc != "glibc" && !hostPlatform.isMusl; 53 56 54 57 enableParallelBuilding = true;
+6 -17
pkgs/development/libraries/gettext/gettext-setup-hook.sh
··· 1 1 gettextDataDirsHook() { 2 + # See pkgs/build-support/setup-hooks/role.bash 3 + getHostRoleEnvHook 2 4 if [ -d "$1/share/gettext" ]; then 3 - addToSearchPath GETTEXTDATADIRS "$1/share/gettext" 5 + addToSearchPath "GETTEXTDATADIRS${role_post}" "$1/share/gettext" 4 6 fi 5 7 } 6 8 ··· 8 10 9 11 # libintl must be listed in load flags on non-Glibc 10 12 # it doesn't hurt to have it in Glibc either though 11 - gettextLdflags() { 12 - # The `depHostOffset` describes how the host platform of the dependencies 13 - # are slid relative to the depending package. It is brought into scope of 14 - # the environment hook defined as the role of the dependency being applied. 15 - case $depHostOffset in 16 - -1) local role='BUILD_' ;; 17 - 0) local role='' ;; 18 - 1) local role='TARGET_' ;; 19 - *) echo "cc-wrapper: Error: Cannot be used with $depHostOffset-offset deps" >2; 20 - return 1 ;; 21 - esac 22 - 23 - export NIX_${role}LDFLAGS+=" -lintl" 24 - } 25 - 26 13 if [ ! -z "@gettextNeedsLdflags@" ]; then 27 - addEnvHooks "$hostOffset" gettextLdflags 14 + # See pkgs/build-support/setup-hooks/role.bash 15 + getHostRole 16 + export NIX_${role_pre}LDFLAGS+=" -lintl" 28 17 fi
+4 -1
pkgs/development/libraries/libiconv/default.nix
··· 14 14 sha256 = "0y1ij745r4p48mxq84rax40p10ln7fc7m243p8k8sia519i3dxfc"; 15 15 }; 16 16 17 - setupHook = ./setup-hook.sh; 17 + setupHooks = [ 18 + ../../../build-support/setup-hooks/role.bash 19 + ./setup-hook.sh 20 + ]; 18 21 19 22 postPatch = 20 23 lib.optionalString ((hostPlatform != buildPlatform && hostPlatform.libc == "msvcrt") || stdenv.cc.nativeLibc)
+3 -15
pkgs/development/libraries/libiconv/setup-hook.sh
··· 1 1 # libiconv must be listed in load flags on non-Glibc 2 2 # it doesn't hurt to have it in Glibc either though 3 - iconvLdflags() { 4 - # The `depHostOffset` describes how the host platform of the dependencies 5 - # are slid relative to the depending package. It is brought into scope of 6 - # the environment hook defined as the role of the dependency being applied. 7 - case $depHostOffset in 8 - -1) local role='BUILD_' ;; 9 - 0) local role='' ;; 10 - 1) local role='TARGET_' ;; 11 - *) echo "cc-wrapper: Error: Cannot be used with $depHostOffset-offset deps" >2; 12 - return 1 ;; 13 - esac 14 3 15 - export NIX_${role}LDFLAGS+=" -liconv" 16 - } 17 - 18 - addEnvHooks "$hostOffset" iconvLdflags 4 + # See pkgs/build-support/setup-hooks/role.bash 5 + getHostRole 6 + export NIX_${role_pre}LDFLAGS+=" -liconv"
+5 -17
pkgs/os-specific/bsd/netbsd/compat-setup-hook.sh
··· 1 - setupCompatFlags() { 2 - # The `depHostOffset` describes how the host platform of the dependencies 3 - # are slid relative to the depending package. It is brought into scope of 4 - # the environment hook defined as the role of the dependency being applied. 5 - case $depHostOffset in 6 - -1) local role='BUILD_' ;; 7 - 0) local role='' ;; 8 - 1) local role='TARGET_' ;; 9 - *) echo "cc-wrapper: Error: Cannot be used with $depHostOffset-offset deps" >2; 10 - return 1 ;; 11 - esac 1 + # See pkgs/build-support/setup-hooks/role.bash 2 + getHostRole 12 3 13 - export NIX_${role}LDFLAGS+=" -lnbcompat" 14 - export NIX_${role}CFLAGS_COMPILE+=" -DHAVE_NBTOOL_CONFIG_H" 15 - export NIX_${role}CFLAGS_COMPILE+=" -include nbtool_config.h" 16 - } 17 - 18 - addEnvHooks "$hostOffset" setupCompatFlags 4 + export NIX_${role_pre}LDFLAGS+=" -lnbcompat" 5 + export NIX_${role_pre}CFLAGS_COMPILE+=" -DHAVE_NBTOOL_CONFIG_H" 6 + export NIX_${role_pre}CFLAGS_COMPILE+=" -include nbtool_config.h"
+8 -2
pkgs/os-specific/bsd/netbsd/default.nix
··· 167 167 sha256 = "17phkfafybxwhzng44k5bhmag6i55br53ky1nwcmw583kg2fa86z"; 168 168 version = "7.1.2"; 169 169 170 - setupHook = ./compat-setup-hook.sh; 170 + setupHooks = [ 171 + ../../../build-support/setup-hooks/role.bash 172 + ./compat-setup-hook.sh 173 + ]; 171 174 172 175 # override defaults to prevent infinite recursion 173 176 nativeBuildInputs = [ makeMinimal ]; ··· 270 273 271 274 runHook postInstall 272 275 ''; 273 - setupHook = ./fts-setup-hook.sh; 276 + setupHooks = [ 277 + ../../../build-support/setup-hooks/role.bash 278 + ./fts-setup-hook.sh 279 + ]; 274 280 }; 275 281 276 282 stat = netBSDDerivation {
+3 -15
pkgs/os-specific/bsd/netbsd/fts-setup-hook.sh
··· 1 - ftsLdflags() { 2 - # The `depHostOffset` describes how the host platform of the dependencies 3 - # are slid relative to the depending package. It is brought into scope of 4 - # the environment hook defined as the role of the dependency being applied. 5 - case $depHostOffset in 6 - -1) local role='BUILD_' ;; 7 - 0) local role='' ;; 8 - 1) local role='TARGET_' ;; 9 - *) echo "cc-wrapper: Error: Cannot be used with $depHostOffset-offset deps" >2; 10 - return 1 ;; 11 - esac 1 + # See pkgs/build-support/setup-hooks/role.bash 2 + getHostRole 12 3 13 - export NIX_${role}LDFLAGS+=" -lfts" 14 - } 15 - 16 - addEnvHooks "$hostOffset" ftsLdflags 4 + export NIX_${role_pre}LDFLAGS+=" -lfts"
+3 -16
pkgs/os-specific/linux/musl/fts-setup-hook.sh
··· 1 - ftsLdflags() { 2 - # The `depHostOffset` describes how the host platform of the dependencies 3 - # are slid relative to the depending package. It is brought into scope of 4 - # the environment hook defined as the role of the dependency being applied. 5 - case $depHostOffset in 6 - -1) local role='BUILD_' ;; 7 - 0) local role='' ;; 8 - 1) local role='TARGET_' ;; 9 - *) echo "cc-wrapper: Error: Cannot be used with $depHostOffset-offset deps" >2; 10 - return 1 ;; 11 - esac 1 + # See pkgs/build-support/setup-hooks/role.bash 2 + getHostRole 12 3 13 - export NIX_${role}LDFLAGS+=" -lfts" 14 - } 15 - 16 - addEnvHooks "$hostOffset" ftsLdflags 17 - 4 + export NIX_${role_pre}LDFLAGS+=" -lfts"
+4 -1
pkgs/os-specific/linux/musl/fts.nix
··· 12 12 13 13 nativeBuildInputs = [ autoreconfHook pkgconfig ]; 14 14 15 - setupHook = ./fts-setup-hook.sh; 15 + setupHooks = [ 16 + ../../../build-support/setup-hooks/role.bash 17 + ./fts-setup-hook.sh 18 + ]; 16 19 }