diff options
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/cabal/default.nix | 6 | ||||
-rw-r--r-- | pkgs/build-support/clang-wrapper/add-flags | 2 | ||||
-rw-r--r-- | pkgs/build-support/clang-wrapper/clang-wrapper.sh | 6 | ||||
-rw-r--r-- | pkgs/build-support/clang-wrapper/default.nix | 4 | ||||
-rw-r--r-- | pkgs/build-support/clang-wrapper/ld-wrapper.sh | 164 | ||||
-rw-r--r-- | pkgs/build-support/clang-wrapper/utils.sh | 24 | ||||
-rw-r--r-- | pkgs/build-support/gcc-wrapper/gcc-wrapper.sh | 1 | ||||
-rw-r--r-- | pkgs/build-support/gcc-wrapper/ld-wrapper.sh | 9 | ||||
-rw-r--r-- | pkgs/build-support/kdewrapper/default.nix | 2 | ||||
-rw-r--r-- | pkgs/build-support/make-startupitem/default.nix | 2 | ||||
-rw-r--r-- | pkgs/build-support/release/functions.sh | 2 | ||||
-rw-r--r-- | pkgs/build-support/vm/windows/bootstrap.nix | 2 | ||||
-rw-r--r-- | pkgs/build-support/vm/windows/install/default.nix | 4 |
13 files changed, 23 insertions, 205 deletions
diff --git a/pkgs/build-support/cabal/default.nix b/pkgs/build-support/cabal/default.nix index 6c806c4bf1f..69423004d65 100644 --- a/pkgs/build-support/cabal/default.nix +++ b/pkgs/build-support/cabal/default.nix @@ -248,12 +248,12 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version; ./Setup copy - ensureDir $out/bin # necessary to get it added to PATH + mkdir -p $out/bin # necessary to get it added to PATH local confDir=$out/lib/ghc-${ghc.ghc.version}/package.conf.d local installedPkgConf=$confDir/${self.fname}.installedconf local pkgConf=$confDir/${self.fname}.conf - ensureDir $confDir + mkdir -p $confDir ./Setup register --gen-pkg-config=$pkgConf if test -f $pkgConf; then echo '[]' > $installedPkgConf @@ -265,7 +265,7 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version; fi ${optionalString (self.enableSharedExecutables && self.isExecutable && self.stdenv.isDarwin) '' - for exe in $out/bin/* ; do + for exe in "$out/bin/"* ; do install_name_tool -add_rpath \ $out/lib/${ghc.ghc.name}/${self.pname}-${self.version} $exe done diff --git a/pkgs/build-support/clang-wrapper/add-flags b/pkgs/build-support/clang-wrapper/add-flags index 3b064547153..7a9711290aa 100644 --- a/pkgs/build-support/clang-wrapper/add-flags +++ b/pkgs/build-support/clang-wrapper/add-flags @@ -21,4 +21,4 @@ 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_CLANG_WRAPPER_FLAGS_SET=1 +export NIX_GCC_WRAPPER_FLAGS_SET=1 diff --git a/pkgs/build-support/clang-wrapper/clang-wrapper.sh b/pkgs/build-support/clang-wrapper/clang-wrapper.sh index b39aa2d721e..57715274f1e 100644 --- a/pkgs/build-support/clang-wrapper/clang-wrapper.sh +++ b/pkgs/build-support/clang-wrapper/clang-wrapper.sh @@ -1,10 +1,10 @@ #! @shell@ -e -if test -n "$NIX_CLANG_WRAPPER_START_HOOK"; then - source "$NIX_CLANG_WRAPPER_START_HOOK" +if test -n "$NIX_GCC_WRAPPER_START_HOOK"; then + source "$NIX_GCC_WRAPPER_START_HOOK" fi -if test -z "$NIX_CLANG_WRAPPER_FLAGS_SET"; then +if test -z "$NIX_GCC_WRAPPER_FLAGS_SET"; then source @out@/nix-support/add-flags.sh fi diff --git a/pkgs/build-support/clang-wrapper/default.nix b/pkgs/build-support/clang-wrapper/default.nix index 4b2a5a1182e..7a5d87127d9 100644 --- a/pkgs/build-support/clang-wrapper/default.nix +++ b/pkgs/build-support/clang-wrapper/default.nix @@ -29,8 +29,8 @@ stdenv.mkDerivation { builder = ./builder.sh; setupHook = ./setup-hook.sh; clangWrapper = ./clang-wrapper.sh; - ldWrapper = ./ld-wrapper.sh; - utils = ./utils.sh; + ldWrapper = ../gcc-wrapper/ld-wrapper.sh; + utils = ../gcc-wrapper/utils.sh; addFlags = ./add-flags; inherit nativeTools nativeLibc nativePrefix clang clangVersion libcxx; diff --git a/pkgs/build-support/clang-wrapper/ld-wrapper.sh b/pkgs/build-support/clang-wrapper/ld-wrapper.sh deleted file mode 100644 index ae45c62d460..00000000000 --- a/pkgs/build-support/clang-wrapper/ld-wrapper.sh +++ /dev/null @@ -1,164 +0,0 @@ -#! @shell@ -e - -if test -n "$NIX_LD_WRAPPER_START_HOOK"; then - source "$NIX_LD_WRAPPER_START_HOOK" -fi - -if test -z "$NIX_CLANG_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_CLANG" -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=(${extra[@]} $NIX_LDFLAGS) - extraBefore=(${extraBefore[@]} $NIX_LDFLAGS_BEFORE) -fi - - -# 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/clang-wrapper/utils.sh b/pkgs/build-support/clang-wrapper/utils.sh deleted file mode 100644 index 753b3772e95..00000000000 --- a/pkgs/build-support/clang-wrapper/utils.sh +++ /dev/null @@ -1,24 +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 - - # 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/gcc-wrapper/gcc-wrapper.sh b/pkgs/build-support/gcc-wrapper/gcc-wrapper.sh index 2ad7783a442..c53fd44207d 100644 --- a/pkgs/build-support/gcc-wrapper/gcc-wrapper.sh +++ b/pkgs/build-support/gcc-wrapper/gcc-wrapper.sh @@ -77,6 +77,7 @@ if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then n=$((n + 1)) done params=("${rest[@]}") + NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE --sysroot=/var/empty" fi diff --git a/pkgs/build-support/gcc-wrapper/ld-wrapper.sh b/pkgs/build-support/gcc-wrapper/ld-wrapper.sh index 74b6273848e..822c4a03a21 100644 --- a/pkgs/build-support/gcc-wrapper/ld-wrapper.sh +++ b/pkgs/build-support/gcc-wrapper/ld-wrapper.sh @@ -32,6 +32,9 @@ if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE" \ # 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 @@ -45,10 +48,12 @@ extra=() extraBefore=() if test -z "$NIX_LDFLAGS_SET"; then - extra=(${extra[@]} $NIX_LDFLAGS) - extraBefore=(${extraBefore[@]} $NIX_LDFLAGS_BEFORE) + 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 diff --git a/pkgs/build-support/kdewrapper/default.nix b/pkgs/build-support/kdewrapper/default.nix index 6dcf68a324a..64dfd7d0ca6 100644 --- a/pkgs/build-support/kdewrapper/default.nix +++ b/pkgs/build-support/kdewrapper/default.nix @@ -20,7 +20,7 @@ stdenv.mkDerivation { inherit libs; buildCommand = '' - ensureDir $out/bin + mkdir -p $out/bin KDEDIRS=${program} QT_PLUGIN_PATH=${program}/lib/qt4/plugins:${program}/lib/kde4/plugins diff --git a/pkgs/build-support/make-startupitem/default.nix b/pkgs/build-support/make-startupitem/default.nix index dc78b8a704e..fad6f00d821 100644 --- a/pkgs/build-support/make-startupitem/default.nix +++ b/pkgs/build-support/make-startupitem/default.nix @@ -19,7 +19,7 @@ stdenv.mkDerivation { priority = 5; buildCommand = '' - ensureDir $out/share/autostart + mkdir -p $out/share/autostart target=${name}.desktop cp ${package}/share/applications/${srcPrefix}${name}.desktop $target chmod +rw $target diff --git a/pkgs/build-support/release/functions.sh b/pkgs/build-support/release/functions.sh index 9f2d03519c8..8ac67a19672 100644 --- a/pkgs/build-support/release/functions.sh +++ b/pkgs/build-support/release/functions.sh @@ -9,6 +9,6 @@ findTarballs() { } propagateImageName() { - ensureDir $out/nix-support + mkdir -p $out/nix-support cat "$diskImage"/nix-support/full-name > $out/nix-support/full-name } diff --git a/pkgs/build-support/vm/windows/bootstrap.nix b/pkgs/build-support/vm/windows/bootstrap.nix index e3b44d1b6ab..ebea819b191 100644 --- a/pkgs/build-support/vm/windows/bootstrap.nix +++ b/pkgs/build-support/vm/windows/bootstrap.nix @@ -69,7 +69,7 @@ in rec { -b "${installedVM}/disk.img" \ -f qcow2 winvm.img ${runAndSuspend} - ensureDir "$out" + mkdir -p "$out" cp winvm.img "$out/disk.img" cp state.gz "$out/state.gz" ''; diff --git a/pkgs/build-support/vm/windows/install/default.nix b/pkgs/build-support/vm/windows/install/default.nix index 10690bf6b28..fe8e8f61de0 100644 --- a/pkgs/build-support/vm/windows/install/default.nix +++ b/pkgs/build-support/vm/windows/install/default.nix @@ -22,7 +22,7 @@ let cygwinSshKey = stdenv.mkDerivation { name = "snakeoil-ssh-cygwin"; buildCommand = '' - ensureDir "$out" + mkdir -p "$out" ${openssh}/bin/ssh-keygen -t ecdsa -f "$out/key" -N "" ''; }; @@ -65,7 +65,7 @@ in stdenv.mkDerivation { buildCommand = '' ${qemu}/bin/qemu-img create -f qcow2 winvm.img 2G ${installController} - ensureDir "$out" + mkdir -p "$out" cp winvm.img "$out/disk.img" ''; passthru = { |