diff options
author | Tuomas Tynkkynen <tuomas@tuxera.com> | 2018-03-15 22:30:56 +0200 |
---|---|---|
committer | Tuomas Tynkkynen <tuomas@tuxera.com> | 2018-03-15 22:30:56 +0200 |
commit | ef64208eba1a2b9052ce6d96b4539163d1aeda9f (patch) | |
tree | c4fc3d5a6b5512b0e11021e18237977440207ae1 /pkgs/build-support | |
parent | 208abe9ae3f4a3ced8942ebd3419496089e06453 (diff) | |
parent | 3ab2949e1fdfb6ef18c2935ab3e72ea1f9348ef5 (diff) |
Merge commit '3ab2949' from staging into master
Conflicts: pkgs/development/compilers/llvm/6/llvm.nix pkgs/servers/home-assistant/component-packages.nix
Diffstat (limited to 'pkgs/build-support')
18 files changed, 31 insertions, 1253 deletions
diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 8e94ccfa49bc2..ae910b76c7080 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -5,7 +5,8 @@ # script that sets up the right environment variables so that the # compiler and the linker just "work". -{ name ? "", stdenvNoCC, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" +{ name ? "" +, stdenvNoCC, nativeTools, propagateDoc ? !nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" , bintools ? null, libc ? null , coreutils ? null, shell ? stdenvNoCC.shell, gnugrep ? null , extraPackages ? [], extraBuildCommands ? "" @@ -15,7 +16,7 @@ with stdenvNoCC.lib; -assert nativeTools -> nativePrefix != ""; +assert nativeTools -> !propagateDoc && nativePrefix != ""; assert !nativeTools -> bintools != null && coreutils != null && gnugrep != null; assert !(nativeLibc && noLibc); @@ -83,7 +84,7 @@ stdenv.mkDerivation { inherit targetPrefix infixSalt; - outputs = [ "out" "info" "man" ]; + outputs = [ "out" ] ++ optionals propagateDoc [ "man" "info" ]; passthru = { inherit bintools libc nativeTools nativeLibc nativePrefix; @@ -111,7 +112,7 @@ stdenv.mkDerivation { '' set -u - mkdir -p $out/bin {$out,$info,$man}/nix-support + mkdir -p $out/bin $out/nix-support wrap() { local dst="$1" @@ -244,28 +245,27 @@ stdenv.mkDerivation { '') + optionalString (!nativeTools) '' - ## ## User env support ## # Propagate the underling unwrapped bintools so that if you - # install the wrapper, you get tools like objdump, the manpages, - # etc. as well (same for any binaries of libc). + # install the wrapper, you get tools like objdump (same for any + # binaries of libc). printWords ${bintools_bin} ${if libc == null then "" else libc_bin} > $out/nix-support/propagated-user-env-packages + '' + + optionalString propagateDoc '' ## ## Man page and info support ## - printWords ${bintools.info or ""} \ - >> $info/nix-support/propagated-build-inputs - printWords ${bintools.man or ""} \ - >> $man/nix-support/propagated-build-inputs + mkdir -p $man/nix-support $info/nix-support + printWords ${bintools.man or ""} >> $man/nix-support/propagated-build-inputs + printWords ${bintools.info or ""} >> $info/nix-support/propagated-build-inputs '' + '' - ## ## Hardening support ## @@ -293,8 +293,8 @@ stdenv.mkDerivation { ## ## Extra custom steps ## - '' + + extraBuildCommands; inherit dynamicLinker expand-response-params; diff --git a/pkgs/build-support/cc-wrapper/add-flags.sh b/pkgs/build-support/cc-wrapper/add-flags.sh index d8b42244607ad..604aaf6b6cf0b 100644 --- a/pkgs/build-support/cc-wrapper/add-flags.sh +++ b/pkgs/build-support/cc-wrapper/add-flags.sh @@ -9,7 +9,6 @@ var_templates_list=( NIX+CFLAGS_LINK NIX+CXXSTDLIB_COMPILE NIX+CXXSTDLIB_LINK - NIX+GNATFLAGS_COMPILE ) var_templates_bool=( NIX+ENFORCE_NO_NATIVE @@ -51,10 +50,6 @@ if [ -e @out@/nix-support/cc-cflags ]; then NIX_@infixSalt@_CFLAGS_COMPILE="$(< @out@/nix-support/cc-cflags) $NIX_@infixSalt@_CFLAGS_COMPILE" fi -if [ -e @out@/nix-support/gnat-cflags ]; then - NIX_@infixSalt@_GNATFLAGS_COMPILE="$(< @out@/nix-support/gnat-cflags) $NIX_@infixSalt@_GNATFLAGS_COMPILE" -fi - if [ -e @out@/nix-support/cc-ldflags ]; then NIX_@infixSalt@_LDFLAGS+=" $(< @out@/nix-support/cc-ldflags)" fi diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 8de2366ff5f57..43cd87fb45976 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -5,24 +5,22 @@ # script that sets up the right environment variables so that the # compiler and the linker just "work". -{ name ? "", stdenvNoCC, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" +{ name ? "" +, stdenvNoCC, nativeTools, propagateDoc ? !nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" , cc ? null, libc ? null, bintools, coreutils ? null, shell ? stdenvNoCC.shell -, zlib ? null, extraPackages ? [], extraBuildCommands ? "" +, extraPackages ? [], extraBuildCommands ? "" , isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null , buildPackages ? {} }: with stdenvNoCC.lib; -assert nativeTools -> nativePrefix != ""; +assert nativeTools -> !propagateDoc && nativePrefix != ""; assert !nativeTools -> cc != null && coreutils != null && gnugrep != null; assert !(nativeLibc && noLibc); assert (noLibc || nativeLibc) == (libc == null); -# For ghdl (the vhdl language provider to gcc) we need zlib in the wrapper. -assert cc.langVhdl or false -> zlib != null; - let stdenv = stdenvNoCC; inherit (stdenv) hostPlatform targetPlatform; @@ -84,7 +82,7 @@ stdenv.mkDerivation { inherit targetPrefix infixSalt; - outputs = [ "out" "man" ]; + outputs = [ "out" ] ++ optionals propagateDoc [ "man" "info" ]; passthru = { # "cc" is the generic name for a C compiler, but there is no one for package @@ -115,7 +113,7 @@ stdenv.mkDerivation { '' set -u - mkdir -p $out/bin $out/nix-support $man/nix-support + mkdir -p $out/bin $out/nix-support wrap() { local dst="$1" @@ -188,17 +186,6 @@ stdenv.mkDerivation { + optionalString cc.langGo or false '' wrap ${targetPrefix}gccgo ${./cc-wrapper.sh} $ccPath/${targetPrefix}gccgo - '' - - + optionalString cc.langAda or false '' - wrap ${targetPrefix}gnatgcc ${./cc-wrapper.sh} $ccPath/${targetPrefix}gnatgcc - wrap ${targetPrefix}gnatmake ${./gnat-wrapper.sh} $ccPath/${targetPrefix}gnatmake - wrap ${targetPrefix}gnatbind ${./gnat-wrapper.sh} $ccPath/${targetPrefix}gnatbind - wrap ${targetPrefix}gnatlink ${./gnatlink-wrapper.sh} $ccPath/${targetPrefix}gnatlink - '' - - + optionalString cc.langVhdl or false '' - ln -s $ccPath/${targetPrefix}ghdl $out/bin/${targetPrefix}ghdl ''; propagatedBuildInputs = [ bintools ]; @@ -246,7 +233,6 @@ stdenv.mkDerivation { '' + optionalString (!nativeTools) '' - ## ## Initial CFLAGS ## @@ -262,33 +248,21 @@ stdenv.mkDerivation { ccLDFlags+=" -L${cc_solib}/lib" ccCFlags+=" -B${cc_solib}/lib" - ${optionalString cc.langVhdl or false '' - ccLDFlags+=" -L${zlib.out}/lib" - ''} - - # Find the gcc libraries path (may work only without multilib). - ${optionalString cc.langAda or false '' - basePath=`echo ${cc_solib}/lib/*/*/*` - ccCFlags+=" -B$basePath -I$basePath/adainclude" - gnatCFlags="-aI$basePath/adainclude -aO$basePath/adalib" - echo "$gnatCFlags" > $out/nix-support/gnat-cflags - ''} - echo "$ccLDFlags" > $out/nix-support/cc-ldflags echo "$ccCFlags" > $out/nix-support/cc-cflags + '' + + optionalString propagateDoc '' ## - ## User env support + ## Man page and info support ## - # Propagate the wrapped cc so that if you install the wrapper, - # you get tools like gcov, the manpages, etc. as well (including - # for binutils and Glibc). + mkdir -p $man/nix-support $info/nix-support printWords ${cc.man or ""} > $man/nix-support/propagated-user-env-packages + printWords ${cc.info or ""} > $info/nix-support/propagated-user-env-packages '' + '' - ## ## Hardening support ## @@ -308,8 +282,8 @@ stdenv.mkDerivation { ## ## Extra custom steps ## - '' + + extraBuildCommands; inherit expand-response-params; diff --git a/pkgs/build-support/cc-wrapper/gnat-wrapper.sh b/pkgs/build-support/cc-wrapper/gnat-wrapper.sh deleted file mode 100644 index a86c9fe4ada4c..0000000000000 --- a/pkgs/build-support/cc-wrapper/gnat-wrapper.sh +++ /dev/null @@ -1,122 +0,0 @@ -#! @shell@ -set -eu -o pipefail +o posix -shopt -s nullglob - -if (( "${NIX_DEBUG:-0}" >= 7 )); then - set -x -fi - -# N.B. Gnat is not used during bootstrapping, so we don't need to -# worry about the old bash empty array `set -u` workarounds. - -path_backup="$PATH" - -# phase separation makes this look useless -# shellcheck disable=SC2157 -if [ -n "@coreutils_bin@" ]; then - PATH="@coreutils_bin@/bin" -fi - -source @out@/nix-support/utils.sh - -if [ -z "${NIX_@infixSalt@_GNAT_WRAPPER_FLAGS_SET:-}" ]; then - source @out@/nix-support/add-flags.sh -fi - - -# Figure out if linker flags should be passed. GCC prints annoying -# warnings when they are not needed. -dontLink=0 -nonFlagArgs=0 - -for i in "$@"; do - if [ "$i" = -c ]; then - dontLink=1 - elif [ "$i" = -M ]; then - dontLink=1 - elif [ "${i:0:1}" != - ]; then - nonFlagArgs=1 - fi -done - -# If we pass a flag like -Wl, then gcc will call the linker unless it -# can figure out that it has to do something else (e.g., because of a -# "-c" flag). So if no non-flag arguments are given, don't pass any -# linker flags. This catches cases like "gcc" (should just print -# "gcc: no input files") and "gcc -v" (should print the version). -if [ "$nonFlagArgs" = 0 ]; then - dontLink=1 -fi - - -# Optionally filter out paths not refering to the store. -params=("$@") -if [[ "${NIX_ENFORCE_PURITY:-}" = 1 && -n "$NIX_STORE" ]]; then - rest=() - for p in "${params[@]}"; do - if [ "${p:0:3}" = -L/ ] && badPath "${p:2}"; then - skip "${p:2}" - elif [ "${p:0:3}" = -I/ ] && badPath "${p:2}"; then - skip "${p:2}" - elif [ "${p:0:4}" = -aI/ ] && badPath "${p:3}"; then - skip "${p:2}" - elif [ "${p:0:4}" = -aO/ ] && badPath "${p:3}"; then - skip "${p:2}" - else - rest+=("$p") - fi - done - params=("${rest[@]}") -fi - - -# Clear march/mtune=native -- they bring impurity. -if [ "$NIX_@infixSalt@_ENFORCE_NO_NATIVE" = 1 ]; then - rest=() - for p in "${params[@]}"; do - if [[ "$p" = -m*=native ]]; then - skip "$p" - else - rest+=("$p") - fi - done - params=("${rest[@]}") -fi - - -# Add the flags for the GNAT compiler proper. -extraAfter=($NIX_@infixSalt@_GNATFLAGS_COMPILE) -extraBefore=() - -if [ "$(basename "$0")x" = "gnatmakex" ]; then - extraBefore=("--GNATBIND=@out@/bin/gnatbind" "--GNATLINK=@out@/bin/gnatlink ") -fi - -#if [ "$dontLink" != 1 ]; then -# # Add the flags that should be passed to the linker (and prevent -# # `ld-wrapper' from adding NIX_@infixSalt@_LDFLAGS again). -# for i in $NIX_@infixSalt@_LDFLAGS_BEFORE; do -# extraBefore+=("-largs" "$i") -# done -# for i in $NIX_@infixSalt@_LDFLAGS; do -# if [ "${i:0:3}" = -L/ ]; then -# extraAfter+=("$i") -# else -# extraAfter+=("-largs" "$i") -# fi -# done -# export NIX_@infixSalt@_LDFLAGS_SET=1 -#fi - -# Optionally print debug info. -if (( "${NIX_DEBUG:-0}" >= 1 )); then - echo "extra flags before to @prog@:" >&2 - printf " %q\n" "${extraBefore[@]}" >&2 - echo "original flags to @prog@:" >&2 - printf " %q\n" "${params[@]}" >&2 - echo "extra flags after to @prog@:" >&2 - printf " %q\n" "${extraAfter[@]}" >&2 -fi - -PATH="$path_backup" -exec @prog@ "${extraBefore[@]}" "${params[@]}" "${extraAfter[@]}" diff --git a/pkgs/build-support/cc-wrapper/gnatlink-wrapper.sh b/pkgs/build-support/cc-wrapper/gnatlink-wrapper.sh deleted file mode 100644 index 0944d74e431b1..0000000000000 --- a/pkgs/build-support/cc-wrapper/gnatlink-wrapper.sh +++ /dev/null @@ -1,40 +0,0 @@ -#! @shell@ -set -eu -o pipefail +o posix -shopt -s nullglob - -if (( "${NIX_DEBUG:-0}" >= 7 )); then - set -x -fi - -# N.B. Gnat is not used during bootstrapping, so we don't need to -# worry about the old bash empty array `set -u` workarounds. - -# Add the flags for the GNAT compiler proper. -extraAfter=("--GCC=@out@/bin/gcc") -extraBefore=() - -## Add the flags that should be passed to the linker (and prevent -## `ld-wrapper' from adding NIX_@infixSalt@_LDFLAGS again). -#for i in $NIX_@infixSalt@_LDFLAGS_BEFORE; do -# extraBefore+=("-largs" "$i") -#done -#for i in $NIX_@infixSalt@_LDFLAGS; do -# if [ "${i:0:3}" = -L/ ]; then -# extraAfter+=("$i") -# else -# extraAfter+=("-largs" "$i") -# fi -#done -#export NIX_@infixSalt@_LDFLAGS_SET=1 - -# Optionally print debug info. -if (( "${NIX_DEBUG:-0}" >= 1 )); then - echo "extra flags before to @prog@:" >&2 - printf " %q\n" "${extraBefore[@]}" >&2 - echo "original flags to @prog@:" >&2 - printf " %q\n" "$@" >&2 - echo "extra flags after to @prog@:" >&2 - printf " %q\n" "${extraAfter[@]}" >&2 -fi - -exec @prog@ "${extraBefore[@]}" "$@" "${extraAfter[@]}" diff --git a/pkgs/build-support/cc-wrapper/utils.sh b/pkgs/build-support/cc-wrapper/utils.sh index 4b2b13809181e..9215fe2dc397c 100644 --- a/pkgs/build-support/cc-wrapper/utils.sh +++ b/pkgs/build-support/cc-wrapper/utils.sh @@ -25,7 +25,11 @@ mangleVarBool() { for infix in "${role_infixes[@]}"; do local inputVar="${var/+/${infix}}" if [ -v "$inputVar" ]; then - let "${outputVar} |= ${!inputVar}" + # "1" in the end makes `let` return success error code when + # expression itself evaluates to zero. + # We don't use `|| true` because that would silence actual + # syntax errors from bad variable values. + let "${outputVar} |= ${!inputVar:-0}" "1" fi done } diff --git a/pkgs/build-support/gcc-wrapper-old/add-flags b/pkgs/build-support/gcc-wrapper-old/add-flags deleted file mode 100644 index 93da917a54158..0000000000000 --- a/pkgs/build-support/gcc-wrapper-old/add-flags +++ /dev/null @@ -1,28 +0,0 @@ -# `-B@out@/bin' forces cc to use ld-wrapper.sh when calling ld. -export NIX_CFLAGS_COMPILE="-B@out@/bin/ $NIX_CFLAGS_COMPILE" - -if test -e @out@/nix-support/libc-cflags; then - export NIX_CFLAGS_COMPILE="$(cat @out@/nix-support/libc-cflags) $NIX_CFLAGS_COMPILE" -fi - -if test -e @out@/nix-support/cc-cflags; then - export NIX_CFLAGS_COMPILE="$(cat @out@/nix-support/cc-cflags) $NIX_CFLAGS_COMPILE" -fi - -if test -e @out@/nix-support/gnat-cflags; then - export NIX_GNATFLAGS_COMPILE="$(cat @out@/nix-support/gnat-cflags) $NIX_GNATFLAGS_COMPILE" -fi - -if test -e @out@/nix-support/libc-ldflags; then - export NIX_LDFLAGS="$NIX_LDFLAGS $(cat @out@/nix-support/libc-ldflags)" -fi - -if test -e @out@/nix-support/cc-ldflags; then - export NIX_LDFLAGS="$NIX_LDFLAGS $(cat @out@/nix-support/cc-ldflags)" -fi - -if test -e @out@/nix-support/libc-ldflags-before; then - export NIX_LDFLAGS_BEFORE="$(cat @out@/nix-support/libc-ldflags-before) $NIX_LDFLAGS_BEFORE" -fi - -export NIX_CC_WRAPPER_FLAGS_SET=1 diff --git a/pkgs/build-support/gcc-wrapper-old/builder.sh b/pkgs/build-support/gcc-wrapper-old/builder.sh deleted file mode 100644 index 22e32814927e0..0000000000000 --- a/pkgs/build-support/gcc-wrapper-old/builder.sh +++ /dev/null @@ -1,215 +0,0 @@ -source $stdenv/setup - - -mkdir -p $out/bin -mkdir -p $out/nix-support - - -if test -z "$nativeLibc"; then - dynamicLinker="$libc/lib/$dynamicLinker" - echo $dynamicLinker > $out/nix-support/dynamic-linker - - if test -e $libc/lib/32/ld-linux.so.2; then - echo $libc/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32 - fi - - # The "-B$libc/lib/" flag is a quick hack to force gcc to link - # against the crt1.o from our own glibc, rather than the one in - # /usr/lib. (This is only an issue when using an `impure' - # compiler/linker, i.e., one that searches /usr/lib and so on.) - # - # Unfortunately, setting -B appears to override the default search - # path. Thus, the gcc-specific "../includes-fixed" directory is - # now longer searched and glibc's <limits.h> header fails to - # compile, because it uses "#include_next <limits.h>" to find the - # limits.h file in ../includes-fixed. To remedy the problem, - # another -idirafter is necessary to add that directory again. - echo "-B$libc/lib/ -idirafter $libc_dev/include -idirafter $gcc/lib/gcc/*/*/include-fixed" > $out/nix-support/libc-cflags - - echo "-L$libc/lib" > $out/nix-support/libc-ldflags - - # The dynamic linker is passed in `ldflagsBefore' to allow - # explicit overrides of the dynamic linker by callers to gcc/ld - # (the *last* value counts, so ours should come first). - echo "-dynamic-linker" $dynamicLinker > $out/nix-support/libc-ldflags-before -fi - -if test -n "$nativeTools"; then - gccPath="$nativePrefix/bin" - ldPath="$nativePrefix/bin" -else - if test -e "$gcc/lib64"; then - gccLDFlags="$gccLDFlags -L$gcc_lib/lib64" - fi - gccLDFlags="$gccLDFlags -L$gcc_lib/lib" - if [ -n "$langVhdl" ]; then - gccLDFlags="$gccLDFlags -L$zlib/lib" - fi - echo "$gccLDFlags" > $out/nix-support/cc-ldflags - - # GCC shows $gcc/lib in `gcc -print-search-dirs', but not - # $gcc/lib64 (even though it does actually search there...).. - # This confuses libtool. So add it to the compiler tool search - # path explicitly. - if test -e "$gcc/lib64"; then - gccCFlags="$gccCFlags -B$gcc/lib64" - fi - - # Find the gcc libraries path (may work only without multilib) - if [ -n "$langAda" ]; then - basePath=`echo $gcc/lib/*/*/*` - gccCFlags="$gccCFlags -B$basePath -I$basePath/adainclude" - - gnatCFlags="-aI$basePath/adainclude -aO$basePath/adalib" - echo "$gnatCFlags" > $out/nix-support/gnat-cflags - fi - echo "$gccCFlags" > $out/nix-support/cc-cflags - - gccPath="$gcc/bin" - # On Illumos/Solaris we might prefer native ld - if test -n "$nativePrefix"; then - ldPath="$nativePrefix/bin" - else - ldPath="$binutils/bin" - fi; -fi - - -doSubstitute() { - local src=$1 - local dst=$2 - local ld="$ldPath/ld" - if $ld -V 2>&1 |grep Solaris; then - # Use Solaris specific linker wrapper - ld="$out/bin/ld-solaris" - fi - # Can't use substitute() here, because replace may not have been - # built yet (in the bootstrap). - sed \ - -e "s^@out@^$out^g" \ - -e "s^@shell@^$shell^g" \ - -e "s^@gcc@^$gcc^g" \ - -e "s^@gccProg@^$gccProg^g" \ - -e "s^@gnatProg@^$gnatProg^g" \ - -e "s^@gnatlinkProg@^$gnatlinkProg^g" \ - -e "s^@binutils@^$binutils^g" \ - -e "s^@coreutils@^$coreutils^g" \ - -e "s^@libc@^$libc^g" \ - -e "s^@libc_bin@^$libc_bin^g" \ - -e "s^@ld@^$ld^g" \ - < "$src" > "$dst" -} - - -# Make wrapper scripts around gcc, g++, and gfortran. Also make symlinks -# cc, c++, and f77. -mkGccWrapper() { - local dst=$1 - local src=$2 - - if ! test -f "$src"; then - echo "$src does not exist (skipping)" - return 1 - fi - - gccProg="$src" - doSubstitute "$gccWrapper" "$dst" - chmod +x "$dst" -} - -mkGnatWrapper() { - local dst=$1 - local src=$2 - - if ! test -f "$src"; then - echo "$src does not exist (skipping)" - return 1 - fi - - gnatProg="$src" - doSubstitute "$gnatWrapper" "$dst" - chmod +x "$dst" -} - -mkGnatLinkWrapper() { - local dst=$1 - local src=$2 - - if ! test -f "$src"; then - echo "$src does not exist (skipping)" - return 1 - fi - - gnatlinkProg="$src" - doSubstitute "$gnatlinkWrapper" "$dst" - chmod +x "$dst" -} - -if mkGccWrapper $out/bin/gcc $gccPath/gcc -then - ln -sv gcc $out/bin/cc -fi - -if mkGccWrapper $out/bin/g++ $gccPath/g++ -then - ln -sv g++ $out/bin/c++ -fi - -mkGccWrapper $out/bin/cpp $gccPath/cpp || true - -if mkGccWrapper $out/bin/gfortran $gccPath/gfortran -then - ln -sv gfortran $out/bin/g77 - ln -sv gfortran $out/bin/f77 -fi - -mkGccWrapper $out/bin/gcj $gccPath/gcj || true - -mkGccWrapper $out/bin/gccgo $gccPath/gccgo || true - -mkGccWrapper $out/bin/gnatgcc $gccPath/gnatgcc || true -mkGnatWrapper $out/bin/gnatmake $gccPath/gnatmake || true -mkGnatWrapper $out/bin/gnatbind $gccPath/gnatbind || true -mkGnatLinkWrapper $out/bin/gnatlink $gccPath/gnatlink || true - -if [ -f $gccPath/ghdl ]; then - ln -sf $gccPath/ghdl $out/bin/ghdl -fi - - -# Create a symlink to as (the assembler). This is useful when a -# gcc-wrapper is installed in a user environment, as it ensures that -# the right assembler is called. -ln -s $ldPath/as $out/bin/as - - -# Make a wrapper around the linker. -doSubstitute "$ldWrapper" "$out/bin/ld" -chmod +x "$out/bin/ld" - -# Copy solaris ld wrapper if needed -if $ldPath/ld -V 2>&1 |grep Solaris; then - # Use Solaris specific linker wrapper - sed -e "s^@ld@^$ldPath/ld^g" < "$ldSolarisWrapper" > "$out/bin/ld-solaris" - chmod +x "$out/bin/ld-solaris" -fi - - -# Emit a setup hook. Also store the path to the original GCC and -# Glibc. -test -n "$gcc" && echo $gcc > $out/nix-support/orig-cc -test -n "$libc" && echo $libc > $out/nix-support/orig-libc - -doSubstitute "$addFlags" "$out/nix-support/add-flags.sh" - -doSubstitute "$setupHook" "$out/nix-support/setup-hook" - -cp -p $utils $out/nix-support/utils.sh - - -# Propagate the wrapped gcc so that if you install the wrapper, you get -# tools like gcov, the manpages, etc. as well (including for binutils -# and Glibc). -if test -z "$nativeTools"; then - printWords $gcc $binutils $libc $libc_bin > $out/nix-support/propagated-user-env-packages -fi diff --git a/pkgs/build-support/gcc-wrapper-old/default.nix b/pkgs/build-support/gcc-wrapper-old/default.nix deleted file mode 100644 index 2c2b2c0e1d5c5..0000000000000 --- a/pkgs/build-support/gcc-wrapper-old/default.nix +++ /dev/null @@ -1,76 +0,0 @@ -# The Nix `gcc' stdenv.mkDerivation is not directly usable, since it doesn't -# know where the C library and standard header files are. Therefore -# the compiler produced by that package cannot be installed directly -# in a user environment and used from the command line. This -# stdenv.mkDerivation provides a wrapper that sets up the right environment -# variables so that the compiler and the linker just "work". - -{ name ? "", stdenv, lib, nativeTools, nativeLibc, nativePrefix ? "" -, gcc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? stdenv.shell -, zlib ? null -, hostPlatform, targetPlatform, targetPackages -}: - -assert nativeTools -> nativePrefix != ""; -assert !nativeTools -> gcc != null && binutils != null && coreutils != null; -assert !nativeLibc -> libc != null; - -# For ghdl (the vhdl language provider to gcc) we need zlib in the wrapper -assert (gcc != null && gcc ? langVhdl && gcc.langVhdl) -> zlib != null; - -let - - gccVersion = (builtins.parseDrvName gcc.name).version; - gccName = (builtins.parseDrvName gcc.name).name; - - langGo = if nativeTools then false else gcc ? langGo && gcc.langGo; -in - -stdenv.mkDerivation { - name = - (if name != "" then name else gccName + "-wrapper") + - (if gcc != null && gccVersion != "" then "-" + gccVersion else ""); - - builder = ./builder.sh; - setupHook = ./setup-hook.sh; - gccWrapper = ./gcc-wrapper.sh; - gnatWrapper = ./gnat-wrapper.sh; - gnatlinkWrapper = ./gnatlink-wrapper.sh; - ldWrapper = ./ld-wrapper.sh; - ldSolarisWrapper = ./ld-solaris-wrapper.sh; - utils = ./utils.sh; - addFlags = ./add-flags; - - inherit nativeTools nativeLibc nativePrefix gcc; - gcc_lib = lib.getLib gcc; - libc = if nativeLibc then null else libc; - libc_dev = if nativeLibc then null else lib.getDev libc; - libc_bin = if nativeLibc then null else lib.getBin libc; - binutils = if nativeTools then null else lib.getBin binutils; - # The wrapper scripts use 'cat', so we may need coreutils - coreutils = if nativeTools then null else lib.getBin coreutils; - - langC = if nativeTools then true else gcc.langC; - langCC = if nativeTools then true else gcc.langCC; - langFortran = if nativeTools then false else gcc ? langFortran; - langAda = if nativeTools then false else gcc ? langAda && gcc.langAda; - langVhdl = if nativeTools then false else gcc ? langVhdl && gcc.langVhdl; - zlib = if gcc != null && gcc ? langVhdl then zlib else null; - shell = shell + shell.shellPath or ""; - - preferLocalBuild = true; - - meta = - let gcc_ = if gcc != null then gcc else {}; in - (if gcc_ ? meta then removeAttrs gcc.meta ["priority"] else {}) // - { description = - stdenv.lib.attrByPath ["meta" "description"] "System C compiler" gcc_ - + " (wrapper script)"; - }; - - # The dynamic linker has different names on different platforms. - dynamicLinker = - if !nativeLibc then - targetPackages.stdenv.cc.bintools.dynamicLinker - else ""; -} diff --git a/pkgs/build-support/gcc-wrapper-old/gcc-wrapper-old.sh b/pkgs/build-support/gcc-wrapper-old/gcc-wrapper-old.sh deleted file mode 100644 index a9d18036952eb..0000000000000 --- a/pkgs/build-support/gcc-wrapper-old/gcc-wrapper-old.sh +++ /dev/null @@ -1,146 +0,0 @@ -#! @shell@ -e - -if [ -n "$NIX_CC_WRAPPER_START_HOOK" ]; then - source "$NIX_CC_WRAPPER_START_HOOK" -fi - -if [ -z "$NIX_CC_WRAPPER_FLAGS_SET" ]; then - source @out@/nix-support/add-flags.sh -fi - -source @out@/nix-support/utils.sh - - -# Figure out if linker flags should be passed. GCC prints annoying -# warnings when they are not needed. -dontLink=0 -getVersion=0 -nonFlagArgs=0 - -for i in "$@"; do - if [ "$i" = -c ]; then - dontLink=1 - elif [ "$i" = -S ]; then - dontLink=1 - elif [ "$i" = -E ]; then - dontLink=1 - elif [ "$i" = -E ]; then - dontLink=1 - elif [ "$i" = -M ]; then - dontLink=1 - elif [ "$i" = -MM ]; then - dontLink=1 - elif [ "$i" = -x ]; then - # At least for the cases c-header or c++-header we should set dontLink. - # I expect no one use -x other than making precompiled headers. - dontLink=1 - elif [ "${i:0:1}" != - ]; then - nonFlagArgs=1 - elif [ "$i" = -m32 ]; then - if [ -e @out@/nix-support/dynamic-linker-m32 ]; then - NIX_LDFLAGS="$NIX_LDFLAGS -dynamic-linker $(cat @out@/nix-support/dynamic-linker-m32)" - fi - fi -done - -# If we pass a flag like -Wl, then gcc will call the linker unless it -# can figure out that it has to do something else (e.g., because of a -# "-c" flag). So if no non-flag arguments are given, don't pass any -# linker flags. This catches cases like "gcc" (should just print -# "gcc: no input files") and "gcc -v" (should print the version). -if [ "$nonFlagArgs" = 0 ]; then - dontLink=1 -fi - - -# Optionally filter out paths not refering to the store. -params=("$@") -if [ "$NIX_ENFORCE_PURITY" = 1 -a -n "$NIX_STORE" ]; then - rest=() - n=0 - while [ $n -lt ${#params[*]} ]; do - p=${params[n]} - p2=${params[$((n+1))]} - if [ "${p:0:3}" = -L/ ] && badPath "${p:2}"; then - skip $p - elif [ "$p" = -L ] && badPath "$p2"; then - n=$((n + 1)); skip $p2 - elif [ "${p:0:3}" = -I/ ] && badPath "${p:2}"; then - skip $p - elif [ "$p" = -I ] && badPath "$p2"; then - n=$((n + 1)); skip $p2 - elif [ "$p" = -isystem ] && badPath "$p2"; then - n=$((n + 1)); skip $p2 - else - rest=("${rest[@]}" "$p") - fi - n=$((n + 1)) - done - params=("${rest[@]}") -fi - - -# Add the flags for the C compiler proper. -extraAfter=($NIX_CFLAGS_COMPILE) -extraBefore=() - -# When enforcing purity, pretend gcc can't find the current date and -# time -if [ "$NIX_ENFORCE_PURITY" = 1 ]; then - extraAfter+=('-D__DATE__="Jan 01 1970"' - '-D__TIME__="00:00:01"' - ) -fi - - -if [ "$dontLink" != 1 ]; then - - # Add the flags that should only be passed to the compiler when - # linking. - extraAfter+=($NIX_CFLAGS_LINK) - - # Add the flags that should be passed to the linker (and prevent - # `ld-wrapper' from adding NIX_LDFLAGS again). - for i in $NIX_LDFLAGS_BEFORE; do - extraBefore=(${extraBefore[@]} "-Wl,$i") - done - for i in $NIX_LDFLAGS; do - if [ "${i:0:3}" = -L/ ]; then - extraAfter+=("$i") - else - extraAfter+=("-Wl,$i") - fi - done - export NIX_LDFLAGS_SET=1 -fi - -# As a very special hack, if the arguments are just `-v', then don't -# add anything. This is to prevent `gcc -v' (which normally prints -# out the version number and returns exit code 0) from printing out -# `No input files specified' and returning exit code 1. -if [ "$*" = -v ]; then - extraAfter=() - extraBefore=() -fi - -# Optionally print debug info. -if [ -n "$NIX_DEBUG" ]; then - echo "original flags to @prog@:" >&2 - for i in "${params[@]}"; do - echo " $i" >&2 - done - echo "extraBefore flags to @prog@:" >&2 - for i in ${extraBefore[@]}; do - echo " $i" >&2 - done - echo "extraAfter flags to @prog@:" >&2 - for i in ${extraAfter[@]}; do - echo " $i" >&2 - done -fi - -if [ -n "$NIX_CC_WRAPPER_EXEC_HOOK" ]; then - source "$NIX_CC_WRAPPER_EXEC_HOOK" -fi - -exec @prog@ ${extraBefore[@]} "${params[@]}" "${extraAfter[@]}" diff --git a/pkgs/build-support/gcc-wrapper-old/gcc-wrapper.sh b/pkgs/build-support/gcc-wrapper-old/gcc-wrapper.sh deleted file mode 100644 index 8f12f08ddc7c5..0000000000000 --- a/pkgs/build-support/gcc-wrapper-old/gcc-wrapper.sh +++ /dev/null @@ -1,147 +0,0 @@ -#! @shell@ -e - -if test -n "$NIX_CC_WRAPPER_START_HOOK"; then - source "$NIX_CC_WRAPPER_START_HOOK" -fi - -if test -z "$NIX_CC_WRAPPER_FLAGS_SET"; then - source @out@/nix-support/add-flags.sh -fi - -source @out@/nix-support/utils.sh - - -# Figure out if linker flags should be passed. GCC prints annoying -# warnings when they are not needed. -dontLink=0 -getVersion=0 -nonFlagArgs=0 - -for i in "$@"; do - if test "$i" = "-c"; then - dontLink=1 - elif test "$i" = "-S"; then - dontLink=1 - elif test "$i" = "-E"; then - dontLink=1 - elif test "$i" = "-E"; then - dontLink=1 - elif test "$i" = "-M"; then - dontLink=1 - elif test "$i" = "-MM"; then - dontLink=1 - elif test "$i" = "-x"; then - # At least for the cases c-header or c++-header we should set dontLink. - # I expect no one use -x other than making precompiled headers. - dontLink=1 - elif test "${i:0:1}" != "-"; then - nonFlagArgs=1 - elif test "$i" = "-m32"; then - if test -e @out@/nix-support/dynamic-linker-m32; then - NIX_LDFLAGS="$NIX_LDFLAGS -dynamic-linker $(cat @out@/nix-support/dynamic-linker-m32)" - fi - fi -done - -# If we pass a flag like -Wl, then gcc will call the linker unless it -# can figure out that it has to do something else (e.g., because of a -# "-c" flag). So if no non-flag arguments are given, don't pass any -# linker flags. This catches cases like "gcc" (should just print -# "gcc: no input files") and "gcc -v" (should print the version). -if test "$nonFlagArgs" = "0"; then - dontLink=1 -fi - - -# Optionally filter out paths not refering to the store. -params=("$@") -if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then - rest=() - n=0 - while test $n -lt ${#params[*]}; do - p=${params[n]} - p2=${params[$((n+1))]} - if test "${p:0:3}" = "-L/" && badPath "${p:2}"; then - skip $p - elif test "$p" = "-L" && badPath "$p2"; then - n=$((n + 1)); skip $p2 - elif test "${p:0:3}" = "-I/" && badPath "${p:2}"; then - skip $p - elif test "$p" = "-I" && badPath "$p2"; then - n=$((n + 1)); skip $p2 - elif test "$p" = "-isystem" && badPath "$p2"; then - n=$((n + 1)); skip $p2 - else - rest=("${rest[@]}" "$p") - fi - n=$((n + 1)) - done - params=("${rest[@]}") -fi - - -# Add the flags for the C compiler proper. -extraAfter=($NIX_CFLAGS_COMPILE) -extraBefore=() - -if test "$dontLink" != "1"; then - - # Add the flags that should only be passed to the compiler when - # linking. - extraAfter=(${extraAfter[@]} $NIX_CFLAGS_LINK) - - # Add the flags that should be passed to the linker (and prevent - # `ld-wrapper' from adding NIX_LDFLAGS again). - for i in $NIX_LDFLAGS_BEFORE; do - extraBefore=(${extraBefore[@]} "-Wl,$i") - done - for i in $NIX_LDFLAGS; do - if test "${i:0:3}" = "-L/"; then - extraAfter=(${extraAfter[@]} "$i") - else - extraAfter=(${extraAfter[@]} "-Wl,$i") - fi - done - export NIX_LDFLAGS_SET=1 -fi - -# As a very special hack, if the arguments are just `-v', then don't -# add anything. This is to prevent `gcc -v' (which normally prints -# out the version number and returns exit code 0) from printing out -# `No input files specified' and returning exit code 1. -if test "$*" = "-v"; then - extraAfter=() - extraBefore=() -fi - -# Optionally print debug info. -if test "$NIX_DEBUG" = "1"; then - echo "original flags to @gccProg@:" >&2 - for i in "${params[@]}"; do - echo " $i" >&2 - done - echo "extraBefore flags to @gccProg@:" >&2 - for i in ${extraBefore[@]}; do - echo " $i" >&2 - done - echo "extraAfter flags to @gccProg@:" >&2 - for i in ${extraAfter[@]}; do - echo " $i" >&2 - done -fi - -if test -n "$NIX_CC_WRAPPER_EXEC_HOOK"; then - source "$NIX_CC_WRAPPER_EXEC_HOOK" -fi - - -# Call the real `gcc'. Filter out warnings from stderr about unused -# `-B' flags, since they confuse some programs. Deep bash magic to -# apply grep to stderr (by swapping stdin/stderr twice). -if test -z "$NIX_CC_NEEDS_GREP"; then - @gccProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]} -else - (@gccProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]} 3>&2 2>&1 1>&3- \ - | (grep -v 'file path prefix' || true); exit ${PIPESTATUS[0]}) 3>&2 2>&1 1>&3- - exit $? -fi diff --git a/pkgs/build-support/gcc-wrapper-old/gnat-wrapper.sh b/pkgs/build-support/gcc-wrapper-old/gnat-wrapper.sh deleted file mode 100644 index f6fa4b18400a1..0000000000000 --- a/pkgs/build-support/gcc-wrapper-old/gnat-wrapper.sh +++ /dev/null @@ -1,113 +0,0 @@ -#! @shell@ -e - -if test -n "$NIX_GNAT_WRAPPER_START_HOOK"; then - source "$NIX_GNAT_WRAPPER_START_HOOK" -fi - -if test -z "$NIX_GNAT_WRAPPER_FLAGS_SET"; then - source @out@/nix-support/add-flags.sh -fi - -source @out@/nix-support/utils.sh - - -# Figure out if linker flags should be passed. GCC prints annoying -# warnings when they are not needed. -dontLink=0 -getVersion=0 -nonFlagArgs=0 - -for i in "$@"; do - if test "$i" = "-c"; then - dontLink=1 - elif test "$i" = "-M"; then - dontLink=1 - elif test "${i:0:1}" != "-"; then - nonFlagArgs=1 - elif test "$i" = "-m32"; then - if test -e @out@/nix-support/dynamic-linker-m32; then - NIX_LDFLAGS="$NIX_LDFLAGS -dynamic-linker $(cat @out@/nix-support/dynamic-linker-m32)" - fi - fi -done - -# If we pass a flag like -Wl, then gcc will call the linker unless it -# can figure out that it has to do something else (e.g., because of a -# "-c" flag). So if no non-flag arguments are given, don't pass any -# linker flags. This catches cases like "gcc" (should just print -# "gcc: no input files") and "gcc -v" (should print the version). -if test "$nonFlagArgs" = "0"; then - dontLink=1 -fi - - -# Optionally filter out paths not refering to the store. -params=("$@") -if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then - rest=() - n=0 - while test $n -lt ${#params[*]}; do - p=${params[n]} - p2=${params[$((n+1))]} - if test "${p:0:3}" = "-L/" && badPath "${p:2}"; then - skip $p - elif test "${p:0:3}" = "-I/" && badPath "${p:2}"; then - skip $p - elif test "${p:0:4}" = "-aI/" && badPath "${p:3}"; then - skip $p - elif test "${p:0:4}" = "-aO/" && badPath "${p:3}"; then - skip $p - else - rest=("${rest[@]}" "$p") - fi - n=$((n + 1)) - done - params=("${rest[@]}") -fi - - -# Add the flags for the GNAT compiler proper. -extraAfter=($NIX_GNATFLAGS_COMPILE) -extraBefore=() - -if [ "`basename $0`x" = "gnatmakex" ]; then - extraBefore=("--GNATBIND=@out@/bin/gnatbind --GNATLINK=@out@/bin/gnatlink ") -fi - -# Add the flags that should be passed to the linker (and prevent -# `ld-wrapper' from adding NIX_LDFLAGS again). -#for i in $NIX_LDFLAGS_BEFORE; do -# extraBefore=(${extraBefore[@]} "-largs $i") -#done - -# Optionally print debug info. -if test "$NIX_DEBUG" = "1"; then - echo "original flags to @gnatProg@:" >&2 - for i in "${params[@]}"; do - echo " $i" >&2 - done - echo "extraBefore flags to @gnatProg@:" >&2 - for i in ${extraBefore[@]}; do - echo " $i" >&2 - done - echo "extraAfter flags to @gnatProg@:" >&2 - for i in ${extraAfter[@]}; do - echo " $i" >&2 - done -fi - -if test -n "$NIX_GNAT_WRAPPER_EXEC_HOOK"; then - source "$NIX_GNAT_WRAPPER_EXEC_HOOK" -fi - - -# Call the real `gcc'. Filter out warnings from stderr about unused -# `-B' flags, since they confuse some programs. Deep bash magic to -# apply grep to stderr (by swapping stdin/stderr twice). -if test -z "$NIX_GNAT_NEEDS_GREP"; then - @gnatProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]} -else - (@gnatProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]} 3>&2 2>&1 1>&3- \ - | (grep -v 'file path prefix' || true); exit ${PIPESTATUS[0]}) 3>&2 2>&1 1>&3- - exit $? -fi diff --git a/pkgs/build-support/gcc-wrapper-old/gnatlink-wrapper.sh b/pkgs/build-support/gcc-wrapper-old/gnatlink-wrapper.sh deleted file mode 100644 index 25907108b4db1..0000000000000 --- a/pkgs/build-support/gcc-wrapper-old/gnatlink-wrapper.sh +++ /dev/null @@ -1,43 +0,0 @@ -#! @shell@ -e - -# Add the flags for the GNAT compiler proper. -extraAfter="--GCC=@out@/bin/gcc" -extraBefore=() - -# Add the flags that should be passed to the linker (and prevent -# `ld-wrapper' from adding NIX_LDFLAGS again). -#for i in $NIX_LDFLAGS_BEFORE; do -# extraBefore=(${extraBefore[@]} "-largs $i") -#done - -# Optionally print debug info. -if test "$NIX_DEBUG" = "1"; then - echo "original flags to @gnatlinkProg@:" >&2 - for i in "$@"; do - echo " $i" >&2 - done - echo "extraBefore flags to @gnatlinkProg@:" >&2 - for i in ${extraBefore[@]}; do - echo " $i" >&2 - done - echo "extraAfter flags to @gnatlinkProg@:" >&2 - for i in ${extraAfter[@]}; do - echo " $i" >&2 - done -fi - -if test -n "$NIX_GNAT_WRAPPER_EXEC_HOOK"; then - source "$NIX_GNAT_WRAPPER_EXEC_HOOK" -fi - - -# Call the real `gcc'. Filter out warnings from stderr about unused -# `-B' flags, since they confuse some programs. Deep bash magic to -# apply grep to stderr (by swapping stdin/stderr twice). -if test -z "$NIX_GNAT_NEEDS_GREP"; then - @gnatlinkProg@ ${extraBefore[@]} "$@" ${extraAfter[@]} -else - (@gnatlinkProg@ ${extraBefore[@]} "$@" ${extraAfter[@]} 3>&2 2>&1 1>&3- \ - | (grep -v 'file path prefix' || true); exit ${PIPESTATUS[0]}) 3>&2 2>&1 1>&3- - exit $? -fi diff --git a/pkgs/build-support/gcc-wrapper-old/ld-solaris-wrapper.sh b/pkgs/build-support/gcc-wrapper-old/ld-solaris-wrapper.sh deleted file mode 100755 index 263ea5408e9a3..0000000000000 --- a/pkgs/build-support/gcc-wrapper-old/ld-solaris-wrapper.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!@shell@ - -set -e -set -u - -# I've also tried adding -z direct and -z lazyload, but it gave too many problems with C++ exceptions :'( -# Also made sure libgcc would not be lazy-loaded, as suggested here: https://www.illumos.org/issues/2534#note-3 -# but still no success. -cmd="@ld@ -z ignore" - -args=("$@"); - -# This loop makes sure all -L arguments are before -l arguments, or ld may complain it cannot find a library. -# GNU binutils does not have this problem: -# http://stackoverflow.com/questions/5817269/does-the-order-of-l-and-l-options-in-the-gnu-linker-matter -i=0; -while [[ $i -lt $# ]]; do - case "${args[$i]}" in - -L) cmd="$cmd ${args[$i]} ${args[($i+1)]}"; i=($i+1); ;; - -L*) cmd="$cmd ${args[$i]}" ;; - *) ;; - esac - i=($i+1); -done - -i=0; -while [[ $i -lt $# ]]; do - case "${args[$i]}" in - -L) i=($i+1); ;; - -L*) ;; - *) cmd="$cmd ${args[$i]}" ;; - esac - i=($i+1); -done - -# Trace: -set -x -exec $cmd - -exit 0 diff --git a/pkgs/build-support/gcc-wrapper-old/ld-wrapper.sh b/pkgs/build-support/gcc-wrapper-old/ld-wrapper.sh deleted file mode 100644 index db50d25cb3b99..0000000000000 --- a/pkgs/build-support/gcc-wrapper-old/ld-wrapper.sh +++ /dev/null @@ -1,166 +0,0 @@ -#! @shell@ -e - -if test -n "$NIX_LD_WRAPPER_START_HOOK"; then - source "$NIX_LD_WRAPPER_START_HOOK" -fi - -if test -z "$NIX_CC_WRAPPER_FLAGS_SET"; then - source @out@/nix-support/add-flags.sh -fi - -source @out@/nix-support/utils.sh - - -# Optionally filter out paths not refering to the store. -params=("$@") -if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE" \ - -a \( -z "$NIX_IGNORE_LD_THROUGH_GCC" -o -z "$NIX_LDFLAGS_SET" \); then - rest=() - n=0 - while test $n -lt ${#params[*]}; do - p=${params[n]} - p2=${params[$((n+1))]} - if test "${p:0:3}" = "-L/" && badPath "${p:2}"; then - skip $p - elif test "$p" = "-L" && badPath "$p2"; then - n=$((n + 1)); skip $p2 - elif test "$p" = "-rpath" && badPath "$p2"; then - n=$((n + 1)); skip $p2 - elif test "$p" = "-dynamic-linker" && badPath "$p2"; then - n=$((n + 1)); skip $p2 - elif test "${p:0:1}" = "/" && badPath "$p"; then - # We cannot skip this; barf. - echo "impure path \`$p' used in link" >&2 - exit 1 - elif test "${p:0:9}" = "--sysroot"; then - # Our ld is not built with sysroot support (Can we fix that?) - : - else - rest=("${rest[@]}" "$p") - fi - n=$((n + 1)) - done - params=("${rest[@]}") -fi - - -extra=() -extraBefore=() - -if test -z "$NIX_LDFLAGS_SET"; then - extra+=($NIX_LDFLAGS) - extraBefore+=($NIX_LDFLAGS_BEFORE) -fi - -extra+=($NIX_LDFLAGS_AFTER) - - -# Add all used dynamic libraries to the rpath. -if test "$NIX_DONT_SET_RPATH" != "1"; then - - libPath="" - addToLibPath() { - local path="$1" - if test "${path:0:1}" != "/"; then return 0; fi - case "$path" in - *..*|*./*|*/.*|*//*) - local path2 - if path2=$(readlink -f "$path"); then - path="$path2" - fi - ;; - esac - case $libPath in - *\ $path\ *) return 0 ;; - esac - libPath="$libPath $path " - } - - addToRPath() { - # If the path is not in the store, don't add it to the rpath. - # This typically happens for libraries in /tmp that are later - # copied to $out/lib. If not, we're screwed. - if test "${1:0:${#NIX_STORE}}" != "$NIX_STORE"; then return 0; fi - case $rpath in - *\ $1\ *) return 0 ;; - esac - rpath="$rpath $1 " - } - - libs="" - addToLibs() { - libs="$libs $1" - } - - rpath="" - - # First, find all -L... switches. - allParams=("${params[@]}" ${extra[@]}) - n=0 - while test $n -lt ${#allParams[*]}; do - p=${allParams[n]} - p2=${allParams[$((n+1))]} - if test "${p:0:3}" = "-L/"; then - addToLibPath ${p:2} - elif test "$p" = "-L"; then - addToLibPath ${p2} - n=$((n + 1)) - elif test "$p" = "-l"; then - addToLibs ${p2} - n=$((n + 1)) - elif test "${p:0:2}" = "-l"; then - addToLibs ${p:2} - elif test "$p" = "-dynamic-linker"; then - # Ignore the dynamic linker argument, or it - # will get into the next 'elif'. We don't want - # the dynamic linker path rpath to go always first. - n=$((n + 1)) - elif [[ "$p" =~ ^[^-].*\.so($|\.) ]]; then - # This is a direct reference to a shared library, so add - # its directory to the rpath. - path="$(dirname "$p")"; - addToRPath "${path}" - fi - n=$((n + 1)) - done - - # Second, for each directory in the library search path (-L...), - # see if it contains a dynamic library used by a -l... flag. If - # so, add the directory to the rpath. - # It's important to add the rpath in the order of -L..., so - # the link time chosen objects will be those of runtime linking. - - for i in $libPath; do - for j in $libs; do - if test -f "$i/lib$j.so"; then - addToRPath $i - break - fi - done - done - - - # Finally, add `-rpath' switches. - for i in $rpath; do - extra=(${extra[@]} -rpath $i) - done -fi - - -# Optionally print debug info. -if test "$NIX_DEBUG" = "1"; then - echo "original flags to @ld@:" >&2 - for i in "${params[@]}"; do - echo " $i" >&2 - done - echo "extra flags to @ld@:" >&2 - for i in ${extra[@]}; do - echo " $i" >&2 - done -fi - -if test -n "$NIX_LD_WRAPPER_EXEC_HOOK"; then - source "$NIX_LD_WRAPPER_EXEC_HOOK" -fi - -exec @ld@ ${extraBefore[@]} "${params[@]}" ${extra[@]} diff --git a/pkgs/build-support/gcc-wrapper-old/setup-hook.sh b/pkgs/build-support/gcc-wrapper-old/setup-hook.sh deleted file mode 100644 index ad3ffeffbbbcb..0000000000000 --- a/pkgs/build-support/gcc-wrapper-old/setup-hook.sh +++ /dev/null @@ -1,33 +0,0 @@ -gccWrapperOld_addCVars () { - if test -d $1/include; then - export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem $1/include" - fi - - if test -d $1/lib64; then - export NIX_LDFLAGS="$NIX_LDFLAGS -L$1/lib64" - fi - - if test -d $1/lib; then - export NIX_LDFLAGS="$NIX_LDFLAGS -L$1/lib" - fi -} - -envBuildBuildHooks+=(gccWrapperOld_addCVars) - -# Note: these come *after* $out in the PATH (see setup.sh). - -if test -n "@gcc@"; then - addToSearchPath PATH @gcc@/bin -fi - -if test -n "@binutils@"; then - addToSearchPath PATH @binutils@/bin -fi - -if test -n "@libc@"; then - addToSearchPath PATH @libc_bin@/bin -fi - -if test -n "@coreutils@"; then - addToSearchPath PATH @coreutils@/bin -fi diff --git a/pkgs/build-support/gcc-wrapper-old/utils.sh b/pkgs/build-support/gcc-wrapper-old/utils.sh deleted file mode 100644 index fa19f91bf5d28..0000000000000 --- a/pkgs/build-support/gcc-wrapper-old/utils.sh +++ /dev/null @@ -1,26 +0,0 @@ -skip () { - if test "$NIX_DEBUG" = "1"; then - echo "skipping impure path $1" >&2 - fi -} - - -# Checks whether a path is impure. E.g., `/lib/foo.so' is impure, but -# `/nix/store/.../lib/foo.so' isn't. -badPath() { - local p=$1 - - # Relative paths are okay (since they're presumably relative to - # the temporary build directory). - if test "${p:0:1}" != "/"; then return 1; fi - - @extraPathTests@ - - # Otherwise, the path should refer to the store or some temporary - # directory (including the build directory). - test \ - "$p" != "/dev/null" -a \ - "${p:0:${#NIX_STORE}}" != "$NIX_STORE" -a \ - "${p:0:4}" != "/tmp" -a \ - "${p:0:${#NIX_BUILD_TOP}}" != "$NIX_BUILD_TOP" -} diff --git a/pkgs/build-support/kernel/modules-closure.nix b/pkgs/build-support/kernel/modules-closure.nix index a527770adcd7b..d82e279799ba3 100644 --- a/pkgs/build-support/kernel/modules-closure.nix +++ b/pkgs/build-support/kernel/modules-closure.nix @@ -9,7 +9,7 @@ stdenvNoCC.mkDerivation { name = kernel.name + "-shrunk"; builder = ./modules-closure.sh; - buildInputs = [ nukeReferences kmod ]; + nativeBuildInputs = [ nukeReferences kmod ]; inherit kernel firmware rootModules allowMissing; allowedReferences = ["out"]; } |