stdenv: default builder fixes (merge #554)

With a minor fix.
I did some huge rebuilds with this on x86_64-linux, found no problems.
This commit is contained in:
Vladimír Čunát 2013-06-29 17:11:27 +02:00
parent 62759ea980
commit 0a44a09121

View File

@ -289,6 +289,9 @@ stripDirs() {
if [ -n "${dirs}" ]; then if [ -n "${dirs}" ]; then
header "stripping (with flags $stripFlags) in $dirs" header "stripping (with flags $stripFlags) in $dirs"
for dir in $dirs; do
test -L "$dir" || chmod -R +rw "$dir"
done
find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} strip $stripFlags || true find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} strip $stripFlags || true
stopNest stopNest
fi fi
@ -639,7 +642,7 @@ patchELF() {
find "$prefix" \( \ find "$prefix" \( \
\( -type f -a -name "*.so*" \) -o \ \( -type f -a -name "*.so*" \) -o \
\( -type f -a -perm +0100 \) \ \( -type f -a -perm +0100 \) \
\) -print -exec patchelf --shrink-rpath {} \; \) -print -exec patchelf --shrink-rpath '{}' \;
fi fi
stopNest stopNest
} }
@ -708,16 +711,22 @@ fixupPhase() {
fi fi
if [ -z "$dontGzipMan" ]; then if [ -z "$dontGzipMan" ]; then
echo "gzipping man pages"
GLOBIGNORE=.:..:*.gz:*.bz2 GLOBIGNORE=.:..:*.gz:*.bz2
for f in $out/share/man/*/* $out/share/man/*/*/*; do for f in "$out"/share/man/*/* "$out"/share/man/*/*/*; do
if [ -f $f ]; then if [ -f "$f" -a ! -L "$f" ]; then
if gzip -c $f > $f.gz; then if gzip -c "$f" > "$f".gz; then
rm $f rm "$f"
else else
rm $f.gz rm "$f".gz
fi fi
fi fi
done done
for f in "$out"/share/man/*/* "$out"/share/man/*/*/*; do
if [ -L "$f" -a -f `readlink -f "$f"`.gz ]; then
ln -sf `readlink "$f"`.gz "$f"
fi
done
unset GLOBIGNORE unset GLOBIGNORE
fi fi
@ -743,23 +752,23 @@ fixupPhase() {
fi fi
if [ -n "$propagatedBuildInputs" ]; then if [ -n "$propagatedBuildInputs" ]; then
mkdir -p "$out/nix-support" mkdir -p "$prefix/nix-support"
echo "$propagatedBuildInputs" > "$out/nix-support/propagated-build-inputs" echo "$propagatedBuildInputs" > "$prefix/nix-support/propagated-build-inputs"
fi fi
if [ -n "$propagatedNativeBuildInputs" ]; then if [ -n "$propagatedNativeBuildInputs" ]; then
mkdir -p "$out/nix-support" mkdir -p "$prefix/nix-support"
echo "$propagatedNativeBuildInputs" > "$out/nix-support/propagated-native-build-inputs" echo "$propagatedNativeBuildInputs" > "$prefix/nix-support/propagated-native-build-inputs"
fi fi
if [ -n "$propagatedUserEnvPkgs" ]; then if [ -n "$propagatedUserEnvPkgs" ]; then
mkdir -p "$out/nix-support" mkdir -p "$prefix/nix-support"
echo "$propagatedUserEnvPkgs" > "$out/nix-support/propagated-user-env-packages" echo "$propagatedUserEnvPkgs" > "$prefix/nix-support/propagated-user-env-packages"
fi fi
if [ -n "$setupHook" ]; then if [ -n "$setupHook" ]; then
mkdir -p "$out/nix-support" mkdir -p "$prefix/nix-support"
substituteAll "$setupHook" "$out/nix-support/setup-hook" substituteAll "$setupHook" "$prefix/nix-support/setup-hook"
fi fi
runHook postFixup runHook postFixup
@ -844,9 +853,16 @@ genericBuild() {
showPhaseHeader "$curPhase" showPhaseHeader "$curPhase"
dumpVars dumpVars
# Evaluate the variable named $curPhase if it exists, otherwise the if [ "$curPhase" = fixupPhase ]; then
# function named $curPhase. for pref in ${outputs:-out}; do
eval "${!curPhase:-$curPhase}" echo "fixup on \$$pref"
prefix=${!pref} eval "${!curPhase:-$curPhase}"
done
else
# Evaluate the variable named $curPhase if it exists, otherwise the
# function named $curPhase.
eval "${!curPhase:-$curPhase}"
fi
if [ "$curPhase" = unpackPhase ]; then if [ "$curPhase" = unpackPhase ]; then
cd "${sourceRoot:-.}" cd "${sourceRoot:-.}"