diff options
Diffstat (limited to 'pkgs/build-support')
-rwxr-xr-x | pkgs/build-support/build-fhs-userenv/chroot-user.rb | 1 | ||||
-rw-r--r-- | pkgs/build-support/build-fhs-userenv/default.nix | 4 | ||||
-rwxr-xr-x | pkgs/build-support/buildenv/builder.pl | 18 | ||||
-rw-r--r-- | pkgs/build-support/cc-wrapper/default.nix | 1 | ||||
-rwxr-xr-x | pkgs/build-support/fetchgit/nix-prefetch-git | 11 | ||||
-rw-r--r-- | pkgs/build-support/gcc-cross-wrapper/builder.sh | 1 | ||||
-rw-r--r-- | pkgs/build-support/gcc-cross-wrapper/default.nix | 4 | ||||
-rw-r--r-- | pkgs/build-support/setup-hooks/make-wrapper.sh | 2 | ||||
-rw-r--r-- | pkgs/build-support/setup-hooks/patch-shebangs.sh | 3 | ||||
-rw-r--r-- | pkgs/build-support/trivial-builders.nix | 1 |
10 files changed, 36 insertions, 10 deletions
diff --git a/pkgs/build-support/build-fhs-userenv/chroot-user.rb b/pkgs/build-support/build-fhs-userenv/chroot-user.rb index e3b268d57af6..11f672acb9ff 100755 --- a/pkgs/build-support/build-fhs-userenv/chroot-user.rb +++ b/pkgs/build-support/build-fhs-userenv/chroot-user.rb @@ -20,6 +20,7 @@ envvars = [ 'TERM', 'XDG_RUNTIME_DIR', 'LANG', 'SSL_CERT_FILE', + 'DBUS_SESSION_BUS_ADDRESS', ] require 'tmpdir' diff --git a/pkgs/build-support/build-fhs-userenv/default.nix b/pkgs/build-support/build-fhs-userenv/default.nix index 233db39788b0..d91cdffcf392 100644 --- a/pkgs/build-support/build-fhs-userenv/default.nix +++ b/pkgs/build-support/build-fhs-userenv/default.nix @@ -32,7 +32,7 @@ in runCommand name { passthru = passthru // { env = runCommand "${name}-shell-env" { shellHook = '' - export CHROOTENV_EXTRA_BINDS="${lib.concatStringsSep ":" extraBindMounts}:$CHROOTENV_EXTRA_BINDS" + ${lib.optionalString (extraBindMounts != []) ''export CHROOTENV_EXTRA_BINDS="${lib.concatStringsSep ":" extraBindMounts}:$CHROOTENV_EXTRA_BINDS"''} exec ${chroot-user} ${init "bash"} "$(pwd)" ''; } '' @@ -46,7 +46,7 @@ in runCommand name { mkdir -p $out/bin cat <<EOF >$out/bin/${name} #! ${stdenv.shell} - export CHROOTENV_EXTRA_BINDS="${lib.concatStringsSep ":" extraBindMounts}:\$CHROOTENV_EXTRA_BINDS" + ${lib.optionalString (extraBindMounts != []) ''export CHROOTENV_EXTRA_BINDS="${lib.concatStringsSep ":" extraBindMounts}:$CHROOTENV_EXTRA_BINDS"''} exec ${chroot-user} ${init runScript} "\$(pwd)" "\$@" EOF chmod +x $out/bin/${name} diff --git a/pkgs/build-support/buildenv/builder.pl b/pkgs/build-support/buildenv/builder.pl index f6cfe52dc318..678f5a3fe9e6 100755 --- a/pkgs/build-support/buildenv/builder.pl +++ b/pkgs/build-support/buildenv/builder.pl @@ -31,9 +31,23 @@ sub isInPathsToLink { my %symlinks; +# Add all pathsToLink and all parent directories. +# +# For "/a/b/c" that will include +# [ "", "/a", "/a/b", "/a/b/c" ] +# +# That ensures the whole directory tree needed by pathsToLink is +# created as directories and not symlinks. +$symlinks{""} = ["", 0]; for my $p (@pathsToLink) { - $p = "" if $p eq "/"; - $symlinks{$p} = ["", 0]; + my @parts = split '/', $p; + + my $cur = ""; + for my $x (@parts) { + $cur = $cur . "/$x"; + $cur = "" if $cur eq "/"; + $symlinks{$cur} = ["", 0]; + } } sub findFiles; diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index da114fdb347f..a37c806905fd 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -96,6 +96,7 @@ stdenv.mkDerivation { echo "-L${libc_lib}/lib" > $out/nix-support/libc-ldflags echo "${libc_lib}" > $out/nix-support/orig-libc + echo "${libc_dev}" > $out/nix-support/orig-libc-dev '' + (if nativeTools then '' diff --git a/pkgs/build-support/fetchgit/nix-prefetch-git b/pkgs/build-support/fetchgit/nix-prefetch-git index 9b330d821f85..705d84c648bf 100755 --- a/pkgs/build-support/fetchgit/nix-prefetch-git +++ b/pkgs/build-support/fetchgit/nix-prefetch-git @@ -20,6 +20,7 @@ http_proxy=${http_proxy:-} fullRev= humanReadableRev= commitDate= +commitDateStrict8601= if test -n "$deepClone"; then deepClone=true @@ -287,9 +288,12 @@ _clone_user_rev() { fi;; esac - fullRev="$(cd "$dir" && (git rev-parse "$rev" 2> /dev/null || git rev-parse "refs/heads/$branchName") | tail -n1)" - humanReadableRev="$(cd "$dir" && (git describe "$fullRev" 2> /dev/null || git describe --tags "$fullRev" 2> /dev/null || echo -- none --))" - commitDate="$(cd "$dir" && git show --no-patch --pretty=%ci "$fullRev")" + pushd "$dir" >/dev/null + fullRev=$( (git rev-parse "$rev" 2>/dev/null || git rev-parse "refs/heads/$branchName") | tail -n1) + humanReadableRev=$(git describe "$fullRev" 2> /dev/null || git describe --tags "$fullRev" 2> /dev/null || echo -- none --) + commitDate=$(git show --no-patch --pretty=%ci "$fullRev") + commitDateStrict8601=$(git show --no-patch --pretty=%cI "$fullRev") + popd >/dev/null # Allow doing additional processing before .git removal eval "$NIX_PREFETCH_GIT_CHECKOUT_HOOK" @@ -337,6 +341,7 @@ print_results() { echo "{" echo " \"url\": \"$url\"," echo " \"rev\": \"$fullRev\"," + echo " \"date\": \"$commitDateStrict8601\"," echo -n " \"$hashType\": \"$hash\"" if test -n "$fetchSubmodules"; then echo "," diff --git a/pkgs/build-support/gcc-cross-wrapper/builder.sh b/pkgs/build-support/gcc-cross-wrapper/builder.sh index c6bc2a7c8bf9..9396ace84f11 100644 --- a/pkgs/build-support/gcc-cross-wrapper/builder.sh +++ b/pkgs/build-support/gcc-cross-wrapper/builder.sh @@ -111,6 +111,7 @@ chmod +x "$out/bin/$crossConfig-ld" # Glibc. test -n "$gcc" && echo $gcc > $out/nix-support/orig-cc test -n "$libc" && echo $libc > $out/nix-support/orig-libc +test -n "$libc_dev" && echo $libc_dev > $out/nix-support/orig-libc-dev doSubstitute "$addFlags" "$out/nix-support/add-flags" diff --git a/pkgs/build-support/gcc-cross-wrapper/default.nix b/pkgs/build-support/gcc-cross-wrapper/default.nix index d3494b83a87b..505d80a6b2ac 100644 --- a/pkgs/build-support/gcc-cross-wrapper/default.nix +++ b/pkgs/build-support/gcc-cross-wrapper/default.nix @@ -44,7 +44,9 @@ stdenv.mkDerivation { ldWrapper = ./ld-wrapper.sh; utils = ./utils.sh; addFlags = ./add-flags; - inherit nativeTools nativeLibc nativePrefix gcc libc binutils; + inherit nativeTools nativeLibc nativePrefix gcc binutils; + libc = if libc ? out then libc.out else libc; + libc_dev = if libc ? dev then libc.dev else libc; crossConfig = if cross != null then cross.config else null; osxMinVersion = cross.osxMinVersion or null; gccLibs = if gcc != null then gccLibs else null; diff --git a/pkgs/build-support/setup-hooks/make-wrapper.sh b/pkgs/build-support/setup-hooks/make-wrapper.sh index 7d0f88abb855..d922db5ccf58 100644 --- a/pkgs/build-support/setup-hooks/make-wrapper.sh +++ b/pkgs/build-support/setup-hooks/make-wrapper.sh @@ -16,7 +16,7 @@ makeWrapper() { varName=${params[$((n + 1))]} value=${params[$((n + 2))]} n=$((n + 2)) - echo "export $varName=$value" >> $wrapper + echo "export $varName=\"$value\"" >> $wrapper fi if test "$p" = "--unset"; then diff --git a/pkgs/build-support/setup-hooks/patch-shebangs.sh b/pkgs/build-support/setup-hooks/patch-shebangs.sh index 38660718d0e2..4317a5f4dade 100644 --- a/pkgs/build-support/setup-hooks/patch-shebangs.sh +++ b/pkgs/build-support/setup-hooks/patch-shebangs.sh @@ -46,7 +46,8 @@ patchShebangs() { args="$arg0 $args" fi - newInterpreterLine="$newPath $args" + # Strip trailing whitespace introduced when no arguments are present + newInterpreterLine="$(echo "$newPath $args" | sed 's/[[:space:]]*$//')" if [ -n "$oldPath" -a "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ]; then if [ -n "$newPath" -a "$newPath" != "$oldPath" ]; then diff --git a/pkgs/build-support/trivial-builders.nix b/pkgs/build-support/trivial-builders.nix index 73f4d7783c43..18e49105ae78 100644 --- a/pkgs/build-support/trivial-builders.nix +++ b/pkgs/build-support/trivial-builders.nix @@ -8,6 +8,7 @@ rec { runCommand = name: env: buildCommand: stdenv.mkDerivation ({ inherit name buildCommand; + passAsFile = [ "buildCommand" ]; } // env); |