* Add write permission to sources copied from the store.
* A new `distPhase' to build source distributions (enabled when $doDist = 1). * A new `checkPhase' to perform `make check' (enabled when $doCheck = 1). * Allow the prefix to be redirected, either by setting $prefix or by setting $useTempPrefix to 1. Useful when making distributions. * Allow the build or install phases to be skipped by setting $dontBuild $dontInstall to 1. * Allow the order of phases to be changed by setting $phases. svn path=/nixpkgs/trunk/; revision=1151
This commit is contained in:
parent
e86a4a1112
commit
331f913861
@ -15,3 +15,8 @@
|
|||||||
depend on 2 copies of coreutils (the first one impure in
|
depend on 2 copies of coreutils (the first one impure in
|
||||||
stdenv-nix-linux!)
|
stdenv-nix-linux!)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* change dontMake & dontMakeInstall into dontBuild and dontInstall in
|
||||||
|
./development/libraries/xlibs/xlibs/builder.sh (or put it in its
|
||||||
|
default.nix)
|
||||||
|
@ -178,6 +178,13 @@ stripHash() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Ensure that the given directory exists.
|
||||||
|
ensureDir() {
|
||||||
|
local dir=$1
|
||||||
|
if ! test -x "$dir"; then mkdir "$dir"; fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
unpackFile() {
|
unpackFile() {
|
||||||
local file=$1
|
local file=$1
|
||||||
local cmd
|
local cmd
|
||||||
@ -189,8 +196,11 @@ unpackFile() {
|
|||||||
*.zip) cmd="unzip $file";;
|
*.zip) cmd="unzip $file";;
|
||||||
*)
|
*)
|
||||||
if test -d "$file"; then
|
if test -d "$file"; then
|
||||||
|
# Copy directories and add write permission (this is
|
||||||
|
# because such directories are usually in the store
|
||||||
|
# and are this read-only).
|
||||||
stripHash $file
|
stripHash $file
|
||||||
cmd="cp -prvd $file $strippedName"
|
cmd="cp -prvd $file $strippedName && chmod -R +w $strippedName"
|
||||||
else
|
else
|
||||||
if test -n "$findUnpacker"; then
|
if test -n "$findUnpacker"; then
|
||||||
$findUnpacker $1;
|
$findUnpacker $1;
|
||||||
@ -335,8 +345,16 @@ configureW() {
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test -z "$prefix"; then
|
||||||
|
prefix="$out";
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$useTempPrefix" = "1"; then
|
||||||
|
prefix="$NIX_BUILD_TOP/tmp_prefix";
|
||||||
|
fi
|
||||||
|
|
||||||
if test -z "$dontAddPrefix"; then
|
if test -z "$dontAddPrefix"; then
|
||||||
configureFlags="--prefix=$out $configureFlags"
|
configureFlags="--prefix=$prefix $configureFlags"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "configure flags: $configureFlags"
|
echo "configure flags: $configureFlags"
|
||||||
@ -361,20 +379,46 @@ buildW() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "$dontMake"; then
|
|
||||||
echo "make flags: $makeFlags"
|
echo "make flags: $makeFlags"
|
||||||
make $makeFlags
|
make $makeFlags
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
buildPhase() {
|
buildPhase() {
|
||||||
|
if test "$dontBuild" = 1; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
header "building"
|
header "building"
|
||||||
buildW
|
buildW
|
||||||
stopNest
|
stopNest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
checkW() {
|
||||||
|
if test -n "$checkPhase"; then
|
||||||
|
$checkPhase
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -z "$checkTarget"; then
|
||||||
|
checkTarget="check"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "check flags: $checkFlags"
|
||||||
|
make $checkFlags $checkTarget
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
checkPhase() {
|
||||||
|
if test "$doCheck" != 1; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
header "checking"
|
||||||
|
checkW
|
||||||
|
stopNest
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
installW() {
|
installW() {
|
||||||
if test -n "$installPhase"; then
|
if test -n "$installPhase"; then
|
||||||
$installPhase
|
$installPhase
|
||||||
@ -385,7 +429,7 @@ installW() {
|
|||||||
$preInstall
|
$preInstall
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! test -x "$out"; then mkdir "$out"; fi
|
ensureDir "$prefix"
|
||||||
|
|
||||||
if test -z "$dontMakeInstall"; then
|
if test -z "$dontMakeInstall"; then
|
||||||
echo "install flags: $installFlags"
|
echo "install flags: $installFlags"
|
||||||
@ -393,11 +437,12 @@ installW() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "$dontStrip" -a "$NIX_STRIP_DEBUG" = 1; then
|
if test -z "$dontStrip" -a "$NIX_STRIP_DEBUG" = 1; then
|
||||||
find "$out" -name "*.a" -exec echo stripping {} \; -exec strip -S {} \;
|
find "$prefix" -name "*.a" -exec echo stripping {} \; -exec strip -S {} \;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$propagatedBuildInputs"; then
|
if test -n "$propagatedBuildInputs"; then
|
||||||
if ! test -x "$out/nix-support"; then mkdir "$out/nix-support"; fi
|
ensureDir "$out"
|
||||||
|
if ! test -x "$/nix-support"; then mkdir "$out/nix-support"; fi
|
||||||
echo "$propagatedBuildInputs" > "$out/nix-support/propagated-build-inputs"
|
echo "$propagatedBuildInputs" > "$out/nix-support/propagated-build-inputs"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -408,19 +453,67 @@ installW() {
|
|||||||
|
|
||||||
|
|
||||||
installPhase() {
|
installPhase() {
|
||||||
|
if test "$dontInstall" = 1; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
header "installing"
|
header "installing"
|
||||||
installW
|
installW
|
||||||
stopNest
|
stopNest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
genericBuild() {
|
distW() {
|
||||||
header "building $out"
|
if test -n "$distPhase"; then
|
||||||
unpackPhase
|
$distPhase
|
||||||
cd $sourceRoot
|
return
|
||||||
patchPhase
|
fi
|
||||||
configurePhase
|
|
||||||
buildPhase
|
if test -z "$distTarget"; then
|
||||||
installPhase
|
distTarget="dist"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "dist flags: $distFlags"
|
||||||
|
make $distFlags $distTarget
|
||||||
|
|
||||||
|
if test "$dontCopyDist" != 1; then
|
||||||
|
ensureDir "$out"
|
||||||
|
ensureDir "$out/tarballs"
|
||||||
|
|
||||||
|
if test -z "$tarballs"; then
|
||||||
|
tarballs="*.tar.gz"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Note: don't quote $tarballs, since we explicitly permit
|
||||||
|
# wildcards in there.
|
||||||
|
cp -pvd $tarballs $out/tarballs
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
distPhase() {
|
||||||
|
if test "$doDist" != 1; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
header "creating distribution"
|
||||||
|
distW
|
||||||
|
stopNest
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
genericBuild() {
|
||||||
|
header "building $out"
|
||||||
|
|
||||||
|
unpackPhase
|
||||||
|
cd $sourceRoot
|
||||||
|
|
||||||
|
if test -z "$phases"; then
|
||||||
|
phases="patchPhase configurePhase buildPhase checkPhase \
|
||||||
|
installPhase distPhase";
|
||||||
|
fi
|
||||||
|
|
||||||
|
for i in $phases; do
|
||||||
|
$i
|
||||||
|
done
|
||||||
|
|
||||||
stopNest
|
stopNest
|
||||||
}
|
}
|
||||||
|
@ -148,4 +148,19 @@
|
|||||||
noSysDirs = false;
|
noSysDirs = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
# Testing the new stdenv-linux (TODO: remove this eventually).
|
||||||
|
stdenvLinuxTest = (import ../stdenv/nix-linux) {
|
||||||
|
stdenv = stdenvLinuxBoot2;
|
||||||
|
pkgs = stdenvLinuxBoot2Pkgs;
|
||||||
|
glibc = stdenvLinuxGlibc;
|
||||||
|
genericStdenv = import ../stdenv/generic-branch;
|
||||||
|
inherit gccWrapper;
|
||||||
|
};
|
||||||
|
|
||||||
|
stdenvLinuxTestPkgs = allPackages {
|
||||||
|
stdenv = stdenvLinuxTest;
|
||||||
|
bootCurl = stdenvLinuxBoot2Pkgs.curl;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user