* Get rid of all the phase wrapper functions, just do that generically
in genericBuild. This also means that you can override a phase function by redefining it, like buildPhase() { ... do something ... } and you still get the log nesting stuff. * GNUmakefile is also a valid makefile name. * Evaluate the variables $preHook and $postHook to allow more stdenv overrideability. svn path=/nixpkgs/branches/stdenv-updates/; revision=10786
This commit is contained in:
parent
0ebff4e1d0
commit
39c3cd4259
@ -53,9 +53,8 @@ param2=@param2@
|
|||||||
param3=@param3@
|
param3=@param3@
|
||||||
param4=@param4@
|
param4=@param4@
|
||||||
param5=@param5@
|
param5=@param5@
|
||||||
if test -n "@preHook@"; then
|
if test -n "@preHook@"; then source @preHook@; fi
|
||||||
source @preHook@
|
eval "$preHook"
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Check that the pre-hook initialised SHELL.
|
# Check that the pre-hook initialised SHELL.
|
||||||
@ -210,16 +209,16 @@ if test "$useTempPrefix" = "1"; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Execute the post-hook.
|
|
||||||
if test -n "@postHook@"; then
|
|
||||||
source @postHook@
|
|
||||||
fi
|
|
||||||
|
|
||||||
PATH=$_PATH${_PATH:+:}$PATH
|
PATH=$_PATH${_PATH:+:}$PATH
|
||||||
if test "$NIX_DEBUG" = "1"; then
|
if test "$NIX_DEBUG" = "1"; then
|
||||||
echo "final path: $PATH"
|
echo "final path: $PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# Misc. helper functions.
|
||||||
|
|
||||||
|
|
||||||
stripDirs() {
|
stripDirs() {
|
||||||
local dirs="$1"
|
local dirs="$1"
|
||||||
local stripFlags="$2"
|
local stripFlags="$2"
|
||||||
@ -423,12 +422,12 @@ stripHash() {
|
|||||||
|
|
||||||
|
|
||||||
unpackFile() {
|
unpackFile() {
|
||||||
local file=$1
|
local file="$1"
|
||||||
local cmd
|
local cmd
|
||||||
|
|
||||||
header "unpacking source archive $file" 3
|
header "unpacking source archive $file" 3
|
||||||
|
|
||||||
case $file in
|
case "$file" in
|
||||||
*.tar)
|
*.tar)
|
||||||
tar xvf $file || fail
|
tar xvf $file || fail
|
||||||
;;
|
;;
|
||||||
@ -462,7 +461,7 @@ unpackFile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unpackW() {
|
unpackPhase() {
|
||||||
if test -n "$unpackPhase"; then
|
if test -n "$unpackPhase"; then
|
||||||
eval "$unpackPhase"
|
eval "$unpackPhase"
|
||||||
return
|
return
|
||||||
@ -532,23 +531,14 @@ unpackW() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unpackPhase() {
|
patchPhase() {
|
||||||
sourceRoot=. # don't change to user dir homeless shelter if custom unpackSource doesn't set sourceRoot
|
|
||||||
header "unpacking sources"
|
|
||||||
startLog "unpack"
|
|
||||||
unpackW
|
|
||||||
stopLog
|
|
||||||
stopNest
|
|
||||||
cd $sourceRoot
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
patchW() {
|
|
||||||
if test -n "$patchPhase"; then
|
if test -n "$patchPhase"; then
|
||||||
eval "$patchPhase"
|
eval "$patchPhase"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test -z "$patchPhase" -a -z "$patches"; then return; fi
|
||||||
|
|
||||||
if test -z "$patchFlags"; then
|
if test -z "$patchFlags"; then
|
||||||
patchFlags="-p1"
|
patchFlags="-p1"
|
||||||
fi
|
fi
|
||||||
@ -570,23 +560,13 @@ patchW() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
patchPhase() {
|
|
||||||
if test -z "$patchPhase" -a -z "$patches"; then return; fi
|
|
||||||
header "patching sources"
|
|
||||||
startLog "patch"
|
|
||||||
patchW
|
|
||||||
stopLog
|
|
||||||
stopNest
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fixLibtool() {
|
fixLibtool() {
|
||||||
sed 's^eval sys_lib_.*search_path=.*^^' < $1 > $1.tmp
|
sed 's^eval sys_lib_.*search_path=.*^^' < $1 > $1.tmp
|
||||||
mv $1.tmp $1
|
mv $1.tmp $1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
configureW() {
|
configurePhase() {
|
||||||
if test -n "$configurePhase"; then
|
if test -n "$configurePhase"; then
|
||||||
eval "$configurePhase"
|
eval "$configurePhase"
|
||||||
return
|
return
|
||||||
@ -627,16 +607,7 @@ configureW() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
configurePhase() {
|
buildPhase() {
|
||||||
header "configuring"
|
|
||||||
startLog "configure"
|
|
||||||
configureW
|
|
||||||
stopLog
|
|
||||||
stopNest
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
buildW() {
|
|
||||||
if test -n "$buildPhase"; then
|
if test -n "$buildPhase"; then
|
||||||
eval "$buildPhase"
|
eval "$buildPhase"
|
||||||
return
|
return
|
||||||
@ -644,8 +615,8 @@ buildW() {
|
|||||||
|
|
||||||
eval "$preBuild"
|
eval "$preBuild"
|
||||||
|
|
||||||
if ! test -n "$makefile" -o -e "Makefile" -o -e "makefile"; then
|
if ! test -n "$makefile" -o -e "Makefile" -o -e "makefile" -o -e "GNUmakefile"; then
|
||||||
echo "no Makefile or makefile, doing nothing"
|
echo "no Makefile, doing nothing"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -658,19 +629,7 @@ buildW() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
buildPhase() {
|
checkPhase() {
|
||||||
if test "$dontBuild" = 1; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
header "building"
|
|
||||||
startLog "build"
|
|
||||||
buildW
|
|
||||||
stopLog
|
|
||||||
stopNest
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
checkW() {
|
|
||||||
if test -n "$checkPhase"; then
|
if test -n "$checkPhase"; then
|
||||||
eval "$checkPhase"
|
eval "$checkPhase"
|
||||||
return
|
return
|
||||||
@ -687,18 +646,6 @@ checkW() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
checkPhase() {
|
|
||||||
if test "$doCheck" != 1; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
header "checking"
|
|
||||||
startLog "check"
|
|
||||||
checkW
|
|
||||||
stopLog
|
|
||||||
stopNest
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
patchELF() {
|
patchELF() {
|
||||||
# Patch all ELF executables and shared libraries.
|
# Patch all ELF executables and shared libraries.
|
||||||
header "patching ELF executables and libraries"
|
header "patching ELF executables and libraries"
|
||||||
@ -710,7 +657,7 @@ patchELF() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
installW() {
|
installPhase() {
|
||||||
if test -n "$installPhase"; then
|
if test -n "$installPhase"; then
|
||||||
eval "$installPhase"
|
eval "$installPhase"
|
||||||
return
|
return
|
||||||
@ -736,22 +683,10 @@ installW() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
installPhase() {
|
|
||||||
if test "$dontInstall" = 1; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
header "installing"
|
|
||||||
startLog "install"
|
|
||||||
installW
|
|
||||||
stopLog
|
|
||||||
stopNest
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# The fixup phase performs generic, package-independent, Nix-related
|
# The fixup phase performs generic, package-independent, Nix-related
|
||||||
# stuff, like running patchelf and setting the
|
# stuff, like running patchelf and setting the
|
||||||
# propagated-build-inputs. It should rarely be overriden.
|
# propagated-build-inputs. It should rarely be overriden.
|
||||||
fixupW() {
|
fixupPhase() {
|
||||||
if test -n "$fixupPhase"; then
|
if test -n "$fixupPhase"; then
|
||||||
eval "$fixupPhase"
|
eval "$fixupPhase"
|
||||||
return
|
return
|
||||||
@ -806,19 +741,7 @@ fixupW() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fixupPhase() {
|
distPhase() {
|
||||||
if test "$dontFixup" = 1; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
header "post-installation fixup"
|
|
||||||
startLog "fixup"
|
|
||||||
fixupW
|
|
||||||
stopLog
|
|
||||||
stopNest
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
distW() {
|
|
||||||
if test -n "$distPhase"; then
|
if test -n "$distPhase"; then
|
||||||
eval "$distPhase"
|
eval "$distPhase"
|
||||||
return
|
return
|
||||||
@ -849,15 +772,18 @@ distW() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
distPhase() {
|
showPhaseHeader() {
|
||||||
if test "$doDist" != 1; then
|
local phase="$1"
|
||||||
return
|
case $phase in
|
||||||
fi
|
unpackPhase) header "unpacking sources";;
|
||||||
header "creating distribution"
|
patchPhase) header "patching sources";;
|
||||||
startLog "dist"
|
configurePhase) header "configuring";;
|
||||||
distW
|
buildPhase) header "building";;
|
||||||
stopLog
|
checkPhase) header "running tests";;
|
||||||
stopNest
|
installPhase) header "installing";;
|
||||||
|
fixupPhase) header "post-installation fixup";;
|
||||||
|
*) header "$phase";;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -871,16 +797,39 @@ genericBuild() {
|
|||||||
|
|
||||||
if test -z "$phases"; then
|
if test -z "$phases"; then
|
||||||
phases="unpackPhase patchPhase configurePhase buildPhase checkPhase \
|
phases="unpackPhase patchPhase configurePhase buildPhase checkPhase \
|
||||||
installPhase fixupPhase distPhase";
|
installPhase fixupPhase distPhase $extraPhases";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for i in $phases; do
|
for curPhase in $phases; do
|
||||||
|
if test "$curPhase" = buildPhase -a -n "$dontBuild"; then continue; fi
|
||||||
|
if test "$curPhase" = checkPhase -a -z "$doCheck"; then continue; fi
|
||||||
|
if test "$curPhase" = installPhase -a -n "$dontInstall"; then continue; fi
|
||||||
|
if test "$curPhase" = fixupPhase -a -n "$dontFixup"; then continue; fi
|
||||||
|
if test "$curPhase" = distPhase -a -z "$doDist"; then continue; fi
|
||||||
|
|
||||||
|
showPhaseHeader "$curPhase"
|
||||||
|
startLog "$curPhase"
|
||||||
dumpVars
|
dumpVars
|
||||||
eval "$i"
|
|
||||||
|
# Evaluate the variable named $curPhase if it exists, otherwise the
|
||||||
|
# function named $curPhase.
|
||||||
|
eval "${!curPhase:-$curPhase}"
|
||||||
|
|
||||||
|
if test "$curPhase" = unpackPhase; then
|
||||||
|
cd "${sourceRoot:-.}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
stopLog
|
||||||
|
stopNest
|
||||||
done
|
done
|
||||||
|
|
||||||
stopNest
|
stopNest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Execute the post-hook.
|
||||||
|
if test -n "@postHook@"; then source @postHook@; fi
|
||||||
|
eval "$postHook"
|
||||||
|
|
||||||
|
|
||||||
dumpVars
|
dumpVars
|
||||||
|
Loading…
x
Reference in New Issue
Block a user