diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2019-09-29 11:05:22 +0200 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2019-09-29 11:05:22 +0200 |
commit | 503081fa5be25e5054f490182a13f1c517e0664d (patch) | |
tree | f1a5d09c71ff8fba0066b7d5481ed4b8da132ffa /pkgs/build-support | |
parent | 9b09b832fc390b306611b6ec3bfffcc4452629fe (diff) | |
parent | 52af1d0930732142937b8db6c28b7fcd16770a7c (diff) |
Merge staging into staging-next
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/bintools-wrapper/setup-hook.sh | 8 | ||||
-rwxr-xr-x | pkgs/build-support/buildenv/builder.pl | 16 | ||||
-rw-r--r-- | pkgs/build-support/cc-wrapper/cc-wrapper.sh | 11 |
3 files changed, 30 insertions, 5 deletions
diff --git a/pkgs/build-support/bintools-wrapper/setup-hook.sh b/pkgs/build-support/bintools-wrapper/setup-hook.sh index f65b792485a09..2e15fa95c7941 100644 --- a/pkgs/build-support/bintools-wrapper/setup-hook.sh +++ b/pkgs/build-support/bintools-wrapper/setup-hook.sh @@ -24,7 +24,8 @@ bintoolsWrapper_addLDVars () { # Python and Haskell packages often only have directories like $out/lib/ghc-8.4.3/ or # $out/lib/python3.6/, so having them in LDFLAGS just makes the linker search unnecessary # directories and bloats the size of the environment variable space. - if [[ -n "$(echo $1/lib/lib*)" ]]; then + local -a glob=( $1/lib/lib* ) + if [ "${#glob[*]}" -gt 0 ]; then export NIX_${role_pre}LDFLAGS+=" -L$1/lib" fi fi @@ -61,9 +62,8 @@ do if PATH=$_PATH type -p "@targetPrefix@${cmd}" > /dev/null then - upper_case="$(echo "$cmd" | tr "[:lower:]" "[:upper:]")" - export "${role_pre}${upper_case}=@targetPrefix@${cmd}"; - export "${upper_case}${role_post}=@targetPrefix@${cmd}"; + export "${role_pre}${cmd^^}=@targetPrefix@${cmd}"; + export "${cmd^^}${role_post}=@targetPrefix@${cmd}"; fi done diff --git a/pkgs/build-support/buildenv/builder.pl b/pkgs/build-support/buildenv/builder.pl index b699d762d29c5..fc6ffce735cc3 100755 --- a/pkgs/build-support/buildenv/builder.pl +++ b/pkgs/build-support/buildenv/builder.pl @@ -26,6 +26,19 @@ sub isInPathsToLink { return 0; } +# Returns whether a path in one of the linked packages may contain +# files in one of the elements of pathsToLink. +sub hasPathsToLink { + my $path = shift; + foreach my $elem (@pathsToLink) { + return 1 if + $path eq "" || + (substr($elem, 0, length($path)) eq $path + && (($path eq $elem) || (substr($elem, length($path), 1) eq "/"))); + } + return 0; +} + # Similar to `lib.isStorePath` sub isStorePath { my $path = shift; @@ -103,7 +116,8 @@ sub findFiles { $relName =~ /info\/dir/ || ( $relName =~ /^\/share\/mime\// && !( $relName =~ /^\/share\/mime\/packages/ ) ) || $baseName eq "perllocal.pod" || - $baseName eq "log"; + $baseName eq "log" || + ! (hasPathsToLink($relName) || isInPathsToLink($relName)); my ($oldTarget, $oldPriority) = @{$symlinks{$relName} // [undef, undef]}; diff --git a/pkgs/build-support/cc-wrapper/cc-wrapper.sh b/pkgs/build-support/cc-wrapper/cc-wrapper.sh index bb7890100087f..ba3dfc96f5c4a 100644 --- a/pkgs/build-support/cc-wrapper/cc-wrapper.sh +++ b/pkgs/build-support/cc-wrapper/cc-wrapper.sh @@ -33,6 +33,7 @@ fi # GCC prints annoying warnings when they are not needed. dontLink=0 nonFlagArgs=0 +cc1=0 # shellcheck disable=SC2193 [[ "@prog@" = *++ ]] && isCpp=1 || isCpp=0 cppInclude=1 @@ -68,6 +69,8 @@ while (( "$n" < "$nParams" )); do elif [[ "$p" != -?* ]]; then # A dash alone signifies standard input; it is not a flag nonFlagArgs=1 + elif [ "$p" = -cc1 ]; then + cc1=1 fi n+=1 done @@ -167,6 +170,14 @@ if [ "$*" = -v ]; then extraBefore=() fi +# clang's -cc1 mode is not compatible with most options +# that we would pass. Rather than trying to pass only +# options that would work, let's just remove all of them. +if [ "$cc1" = 1 ]; then + extraAfter=() + extraBefore=() +fi + # Optionally print debug info. if (( "${NIX_DEBUG:-0}" >= 1 )); then # Old bash workaround, see ld-wrapper for explanation. |