* buildPhase: skip if there is no Makefile (just like configurePhase

is skipped when there is no configure script).  So you don't need to
  set

    buildPhase = "true";

  for derivations that don't have any build action.

* Variable $makefile to allow the makefile to be specified.

svn path=/nixpkgs/branches/stdenv-updates/; revision=10784
This commit is contained in:
Eelco Dolstra 2008-02-20 15:16:48 +00:00
parent bcffa9bb34
commit 0ebff4e1d0

View File

@ -1,8 +1,4 @@
set -e ######################################################################
test -z $NIX_GCC && NIX_GCC=@gcc@
# Helper functions that might be useful in setup hooks. # Helper functions that might be useful in setup hooks.
@ -27,6 +23,14 @@ addToSearchPath()
} }
######################################################################
# Initialisation.
set -e
test -z $NIX_GCC && NIX_GCC=@gcc@
# Set up the initial path. # Set up the initial path.
PATH= PATH=
for i in $NIX_GCC @initialPath@; do for i in $NIX_GCC @initialPath@; do
@ -34,7 +38,7 @@ for i in $NIX_GCC @initialPath@; do
done done
if test "$NIX_DEBUG" = "1"; then if test "$NIX_DEBUG" = "1"; then
echo "Initial path: $PATH" echo "initial path: $PATH"
fi fi
@ -213,7 +217,7 @@ 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
stripDirs() { stripDirs() {
@ -640,8 +644,13 @@ buildW() {
eval "$preBuild" eval "$preBuild"
if ! test -n "$makefile" -o -e "Makefile" -o -e "makefile"; then
echo "no Makefile or makefile, doing nothing"
return
fi
echo "make flags: $makeFlags ${makeFlagsArray[@]} $buildFlags ${buildFlagsArray[@]}" echo "make flags: $makeFlags ${makeFlagsArray[@]} $buildFlags ${buildFlagsArray[@]}"
make \ make ${makefile:+-f $makefile} \
$makeFlags "${makeFlagsArray[@]}" \ $makeFlags "${makeFlagsArray[@]}" \
$buildFlags "${buildFlagsArray[@]}" || fail $buildFlags "${buildFlagsArray[@]}" || fail
@ -672,7 +681,7 @@ checkW() {
fi fi
echo "check flags: $makeFlags ${makeFlagsArray[@]} $checkFlags ${checkFlagsArray[@]}" echo "check flags: $makeFlags ${makeFlagsArray[@]} $checkFlags ${checkFlagsArray[@]}"
make \ make ${makefile:+-f $makefile} \
$makeFlags "${makeFlagsArray[@]}" \ $makeFlags "${makeFlagsArray[@]}" \
$checkFlags "${checkFlagsArray[@]}" $checkTarget || fail $checkFlags "${checkFlagsArray[@]}" $checkTarget || fail
} }
@ -716,7 +725,7 @@ installW() {
installTargets=install installTargets=install
fi fi
echo "install flags: $installTargets $makeFlags ${makeFlagsArray[@]} $installFlags ${installFlagsArray[@]}" echo "install flags: $installTargets $makeFlags ${makeFlagsArray[@]} $installFlags ${installFlagsArray[@]}"
make $installTargets \ make ${makefile:+-f $makefile} $installTargets \
$makeFlags "${makeFlagsArray[@]}" \ $makeFlags "${makeFlagsArray[@]}" \
$installFlags "${installFlagsArray[@]}" || fail $installFlags "${installFlagsArray[@]}" || fail
else else
@ -756,9 +765,9 @@ fixupW() {
for d in $forceShare; do for d in $forceShare; do
if test -d "$prefix/$d"; then if test -d "$prefix/$d"; then
if test -d "$prefix/share/$d"; then if test -d "$prefix/share/$d"; then
echo "Both $d/ and share/$d/ exists!" echo "both $d/ and share/$d/ exists!"
else else
echo Fixing location of $d/ subdirectory echo "fixing location of $d/ subdirectory"
ensureDir $prefix/share ensureDir $prefix/share
if test -w $prefix/share; then if test -w $prefix/share; then
mv -v $prefix/$d $prefix/share mv -v $prefix/$d $prefix/share
@ -771,10 +780,12 @@ fixupW() {
# TODO: strip _only_ ELF executables, and return || fail here... # TODO: strip _only_ ELF executables, and return || fail here...
if test -z "$dontStrip"; then if test -z "$dontStrip"; then
echo "Stripping debuging symbols from files in" stripDebugList=${stripDebugList:-lib}
stripDirs "${stripDebugList:-lib}" -S echo "stripping debuging symbols from files in $stripDebugList"
echo "Stripping all symbols from files in" stripDirs "$stripDebugList" -S
stripDirs "${stripAllList:-bin sbin}" -s stripAllList=${stripAllList:-bin sbin}
echo "stripping all symbols from files in $stripAllList"
stripDirs "$stripAllList" -s
fi fi
if test "$havePatchELF" = 1 -a -z "$dontPatchELF"; then if test "$havePatchELF" = 1 -a -z "$dontPatchELF"; then
@ -820,7 +831,7 @@ distW() {
fi fi
echo "dist flags: $distFlags ${distFlagsArray[@]}" echo "dist flags: $distFlags ${distFlagsArray[@]}"
make $distFlags "${distFlagsArray[@]}" $distTarget || fail make ${makefile:+-f $makefile} $distFlags "${distFlagsArray[@]}" $distTarget || fail
if test "$dontCopyDist" != 1; then if test "$dontCopyDist" != 1; then
ensureDir "$out/tarballs" ensureDir "$out/tarballs"