diff options
Diffstat (limited to 'pkgs/stdenv/generic/setup.sh')
-rw-r--r-- | pkgs/stdenv/generic/setup.sh | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 75be719c2b95..b5d31e09153a 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -145,12 +145,21 @@ ensureDir() { } -installBin() { - mkdir -p $out/bin - cp "$@" $out/bin +# Add $1/lib* into rpaths. +# The function is used in multiple-outputs.sh hook, +# so it is defined here but tried after the hook. +_addRpathPrefix() { + if [ "$NIX_NO_SELF_RPATH" != 1 ]; then + export NIX_LDFLAGS="-rpath $1/lib $NIX_LDFLAGS" + if [ -n "$NIX_LIB64_IN_SELF_RPATH" ]; then + export NIX_LDFLAGS="-rpath $1/lib64 $NIX_LDFLAGS" + fi + if [ -n "$NIX_LIB32_IN_SELF_RPATH" ]; then + export NIX_LDFLAGS="-rpath $1/lib32 $NIX_LDFLAGS" + fi + fi } - ###################################################################### # Initialisation. @@ -267,16 +276,7 @@ for i in $crossPkgs; do done -# Add the output as an rpath. -if [ "$NIX_NO_SELF_RPATH" != 1 ]; then - export NIX_LDFLAGS="-rpath $out/lib $NIX_LDFLAGS" - if [ -n "$NIX_LIB64_IN_SELF_RPATH" ]; then - export NIX_LDFLAGS="-rpath $out/lib64 $NIX_LDFLAGS" - fi - if [ -n "$NIX_LIB32_IN_SELF_RPATH" ]; then - export NIX_LDFLAGS="-rpath $out/lib32 $NIX_LDFLAGS" - fi -fi +_addRpathPrefix "$out" # Set the TZ (timezone) environment variable, otherwise commands like @@ -619,7 +619,7 @@ configurePhase() { done fi - if [ -z "$dontAddPrefix" ]; then + if [ -z "$dontAddPrefix" -a -n "$prefix" ]; then configureFlags="${prefixKey:---prefix=}$prefix $configureFlags" fi @@ -681,7 +681,9 @@ checkPhase() { installPhase() { runHook preInstall - mkdir -p "$prefix" + if [ -n "$prefix" ]; then + mkdir -p "$prefix" + fi installTargets=${installTargets:-install} echo "install flags: $installTargets $makeFlags ${makeFlagsArray[@]} $installFlags ${installFlagsArray[@]}" @@ -710,24 +712,27 @@ fixupPhase() { prefix=${!output} runHook fixupOutput done + # Multiple-output derivations mostly choose $dev instead of $out + local prOut="${propagateIntoOutput:-$out}" + if [ -n "$propagatedBuildInputs" ]; then - mkdir -p "$out/nix-support" - echo "$propagatedBuildInputs" > "$out/nix-support/propagated-build-inputs" + mkdir -p "$prOut/nix-support" + echo "$propagatedBuildInputs" > "$prOut/nix-support/propagated-build-inputs" fi if [ -n "$propagatedNativeBuildInputs" ]; then - mkdir -p "$out/nix-support" - echo "$propagatedNativeBuildInputs" > "$out/nix-support/propagated-native-build-inputs" + mkdir -p "$prOut/nix-support" + echo "$propagatedNativeBuildInputs" > "$prOut/nix-support/propagated-native-build-inputs" fi if [ -n "$propagatedUserEnvPkgs" ]; then - mkdir -p "$out/nix-support" - echo "$propagatedUserEnvPkgs" > "$out/nix-support/propagated-user-env-packages" + mkdir -p "$prOut/nix-support" + echo "$propagatedUserEnvPkgs" > "$prOut/nix-support/propagated-user-env-packages" fi if [ -n "$setupHook" ]; then - mkdir -p "$out/nix-support" - substituteAll "$setupHook" "$out/nix-support/setup-hook" + mkdir -p "$prOut/nix-support" + substituteAll "$setupHook" "$prOut/nix-support/setup-hook" fi runHook postFixup |