2004-07-02 12:05:53 +02:00
|
|
|
set -e
|
|
|
|
|
|
|
|
test -z $NIX_GCC && NIX_GCC=@gcc@
|
|
|
|
|
|
|
|
|
|
|
|
# Set up the initial path.
|
|
|
|
PATH=
|
|
|
|
for i in $NIX_GCC @initialPath@; do
|
|
|
|
PATH=$PATH${PATH:+:}$i/bin
|
|
|
|
done
|
|
|
|
|
|
|
|
if test "$NIX_DEBUG" = "1"; then
|
|
|
|
echo "Initial path: $PATH"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Execute the pre-hook.
|
|
|
|
export SHELL=@shell@
|
|
|
|
param1=@param1@
|
|
|
|
param2=@param2@
|
|
|
|
param3=@param3@
|
|
|
|
param4=@param4@
|
|
|
|
param5=@param5@
|
|
|
|
if test -n "@preHook@"; then
|
2005-12-05 15:11:09 +01:00
|
|
|
source @preHook@
|
2004-07-02 12:05:53 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Check that the pre-hook initialised SHELL.
|
|
|
|
if test -z "$SHELL"; then echo "SHELL not set"; exit 1; fi
|
|
|
|
|
|
|
|
|
|
|
|
# Hack: run gcc's setup hook.
|
|
|
|
envHooks=()
|
|
|
|
if test -f $NIX_GCC/nix-support/setup-hook; then
|
2005-12-05 15:11:09 +01:00
|
|
|
source $NIX_GCC/nix-support/setup-hook
|
2004-07-02 12:05:53 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2005-06-17 13:42:53 +02:00
|
|
|
# Ensure that the given directory exists.
|
|
|
|
ensureDir() {
|
|
|
|
local dir=$1
|
|
|
|
if ! test -x "$dir"; then mkdir -p "$dir"; fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-12 14:34:02 +02:00
|
|
|
# Called when some build action fails. If $succeedOnFailure is set,
|
|
|
|
# create the file `$out/nix-support/failed' to signal failure, and
|
|
|
|
# exit normally. Otherwise, exit with failure.
|
|
|
|
fail() {
|
|
|
|
exitCode=$?
|
|
|
|
if test "$succeedOnFailure" = 1; then
|
|
|
|
ensureDir "$out/nix-support"
|
|
|
|
touch "$out/nix-support/failed"
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
exit $?
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Allow the caller to augment buildInputs (it's not always possible to
|
|
|
|
# do this before the call to setup.sh, since the PATH is empty at that
|
|
|
|
# point; here we have a basic Unix environment).
|
|
|
|
if test -n "$addInputsHook"; then
|
|
|
|
$addInputsHook
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2004-07-02 12:05:53 +02:00
|
|
|
# Recursively find all build inputs.
|
|
|
|
findInputs()
|
|
|
|
{
|
|
|
|
local pkg=$1
|
|
|
|
|
|
|
|
case $pkgs in
|
|
|
|
*\ $pkg\ *)
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
pkgs="$pkgs $pkg "
|
|
|
|
|
|
|
|
if test -f $pkg/nix-support/setup-hook; then
|
2005-12-05 15:11:09 +01:00
|
|
|
source $pkg/nix-support/setup-hook
|
2004-07-02 12:05:53 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if test -f $pkg/nix-support/propagated-build-inputs; then
|
|
|
|
for i in $(cat $pkg/nix-support/propagated-build-inputs); do
|
|
|
|
findInputs $i
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
pkgs=""
|
|
|
|
if test -n "$buildinputs"; then
|
|
|
|
buildInputs="$buildinputs" # compatibility
|
|
|
|
fi
|
|
|
|
for i in $buildInputs $propagatedBuildInputs; do
|
|
|
|
findInputs $i
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
# Set the relevant environment variables to point to the build inputs
|
|
|
|
# found above.
|
|
|
|
addToEnv()
|
|
|
|
{
|
|
|
|
local pkg=$1
|
|
|
|
|
2004-07-12 14:34:02 +02:00
|
|
|
if test "$ignoreFailedInputs" != "1" -a -e $1/nix-support/failed; then
|
|
|
|
echo "failed input $1" >&2
|
|
|
|
fail
|
|
|
|
fi
|
|
|
|
|
2004-07-02 12:05:53 +02:00
|
|
|
if test -d $1/bin; then
|
|
|
|
export _PATH=$_PATH${_PATH:+:}$1/bin
|
|
|
|
fi
|
|
|
|
|
|
|
|
for i in "${envHooks[@]}"; do
|
|
|
|
$i $pkg
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
for i in $pkgs; do
|
|
|
|
addToEnv $i
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
# Add the output as an rpath.
|
|
|
|
if test "$NIX_NO_SELF_RPATH" != "1"; then
|
|
|
|
export NIX_LDFLAGS="-rpath $out/lib $NIX_LDFLAGS"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Strip debug information by default.
|
|
|
|
if test -z "$NIX_STRIP_DEBUG"; then
|
|
|
|
export NIX_STRIP_DEBUG=1
|
2005-02-23 23:01:54 +01:00
|
|
|
export NIX_CFLAGS_STRIP="-g0 -Wl,--strip-debug"
|
|
|
|
fi
|
2004-07-02 12:05:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
# Do we know where the store is? This is required for purity checking.
|
|
|
|
if test -z "$NIX_STORE"; then
|
|
|
|
echo "Error: you have an old version of Nix that does not set the" \
|
|
|
|
"NIX_STORE variable. Please upgrade." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# We also need to know the root of the build directory for purity checking.
|
|
|
|
if test -z "$NIX_BUILD_TOP"; then
|
|
|
|
echo "Error: you have an old version of Nix that does not set the" \
|
|
|
|
"NIX_BUILD_TOP variable. Please upgrade." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Set the TZ (timezone) environment variable, otherwise commands like
|
|
|
|
# `date' will complain (e.g., `Tue Mar 9 10:01:47 Local time zone must
|
|
|
|
# be set--see zic manual page 2004').
|
|
|
|
export TZ=UTC
|
|
|
|
|
|
|
|
|
|
|
|
# Execute the post-hook.
|
|
|
|
if test -n "@postHook@"; then
|
2005-12-05 15:11:09 +01:00
|
|
|
source @postHook@
|
2004-07-02 12:05:53 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
PATH=$_PATH${_PATH:+:}$PATH
|
|
|
|
if test "$NIX_DEBUG" = "1"; then
|
|
|
|
echo "Final path: $PATH"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# What follows is the generic builder.
|
|
|
|
|
|
|
|
|
|
|
|
nestingLevel=0
|
|
|
|
|
|
|
|
startNest() {
|
|
|
|
nestingLevel=$(($nestingLevel + 1))
|
|
|
|
echo -en "\e[$1p"
|
|
|
|
}
|
|
|
|
|
|
|
|
stopNest() {
|
|
|
|
nestingLevel=$(($nestingLevel - 1))
|
|
|
|
echo -en "\e[q"
|
|
|
|
}
|
|
|
|
|
|
|
|
header() {
|
|
|
|
startNest "$2"
|
|
|
|
echo "$1"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Make sure that even when we exit abnormally, the original nesting
|
|
|
|
# level is properly restored.
|
|
|
|
closeNest() {
|
|
|
|
while test $nestingLevel -gt 0; do
|
|
|
|
stopNest
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
trap "closeNest" EXIT
|
|
|
|
|
|
|
|
|
2004-08-30 16:06:14 +02:00
|
|
|
# This function is useful for debugging broken Nix builds. It dumps
|
|
|
|
# all environment variables to a file `env-vars' in the build
|
|
|
|
# directory. If the build fails and the `-K' option is used, you can
|
|
|
|
# then go to the build directory and source in `env-vars' to reproduce
|
|
|
|
# the environment used for building.
|
|
|
|
dumpVars() {
|
|
|
|
if test "$noDumpEnvVars" != "1"; then
|
|
|
|
export > $NIX_BUILD_TOP/env-vars
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-08-11 17:26:09 +02:00
|
|
|
# Redirect stdout/stderr to a named pipe connected to a `tee' process
|
|
|
|
# that writes the specified file (and also to our original stdout).
|
|
|
|
# The original stdout is saved in descriptor 3.
|
2004-07-11 20:52:25 +02:00
|
|
|
startLog() {
|
|
|
|
local logFile=${logNr}_$1
|
|
|
|
logNr=$((logNr + 1))
|
|
|
|
if test "$logPhases" = 1; then
|
|
|
|
ensureDir $logDir
|
2004-08-11 17:26:09 +02:00
|
|
|
|
2004-07-11 20:52:25 +02:00
|
|
|
exec 3>&1
|
2004-08-11 17:26:09 +02:00
|
|
|
|
2004-07-11 20:52:25 +02:00
|
|
|
if test "$dontLogThroughTee" != 1; then
|
2004-08-11 17:26:09 +02:00
|
|
|
# This required named pipes (fifos).
|
|
|
|
logFifo=$NIX_BUILD_TOP/log_fifo
|
|
|
|
test -p $logFifo || mkfifo $logFifo
|
2005-02-22 16:03:24 +01:00
|
|
|
startLogWrite "$logDir/$logFile" "$logFifo"
|
2004-08-11 17:26:09 +02:00
|
|
|
exec > $logFifo 2>&1
|
2004-07-11 20:52:25 +02:00
|
|
|
else
|
|
|
|
exec > $logDir/$logFile 2>&1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2005-02-22 16:03:24 +01:00
|
|
|
# Factored into a separate function so that it can be overriden.
|
|
|
|
startLogWrite() {
|
|
|
|
tee "$1" < "$2" &
|
|
|
|
logWriterPid=$!
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-11 20:52:25 +02:00
|
|
|
if test -z "$logDir"; then
|
|
|
|
logDir=$out/log
|
|
|
|
fi
|
|
|
|
|
|
|
|
logNr=0
|
|
|
|
|
|
|
|
# Restore the original stdout/stderr.
|
|
|
|
stopLog() {
|
|
|
|
if test "$logPhases" = 1; then
|
|
|
|
exec >&3 2>&1
|
2004-08-11 17:26:09 +02:00
|
|
|
|
|
|
|
# Wait until the tee process has died. Otherwise output from
|
|
|
|
# different phases may be mixed up.
|
2005-02-22 16:03:24 +01:00
|
|
|
if test -n "$logWriterPid"; then
|
|
|
|
wait $logWriterPid
|
|
|
|
logWriterPid=
|
2004-08-11 17:26:09 +02:00
|
|
|
rm $logFifo
|
|
|
|
fi
|
2004-07-11 20:52:25 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-02 12:05:53 +02:00
|
|
|
# Utility function: return the base name of the given path, with the
|
|
|
|
# prefix `HASH-' removed, if present.
|
|
|
|
stripHash() {
|
|
|
|
strippedName=$(basename $1);
|
2005-03-10 18:32:09 +01:00
|
|
|
if echo "$strippedName" | grep -q '^[a-z0-9]\{32\}-'; then
|
2004-07-02 12:05:53 +02:00
|
|
|
strippedName=$(echo "$strippedName" | cut -c34-)
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
unpackFile() {
|
|
|
|
local file=$1
|
|
|
|
local cmd
|
|
|
|
|
|
|
|
case $file in
|
|
|
|
*.tar) cmd="tar xvf $file";;
|
|
|
|
*.tar.gz | *.tgz | *.tar.Z) cmd="tar xvfz $file";;
|
|
|
|
*.tar.bz2 | *.tbz2) cmd="tar xvfj $file";;
|
|
|
|
*.zip) cmd="unzip $file";;
|
|
|
|
*)
|
|
|
|
if test -d "$file"; then
|
|
|
|
stripHash $file
|
2004-07-11 22:02:57 +02:00
|
|
|
cmd="cp -prvd $file $strippedName"
|
2004-07-02 12:05:53 +02:00
|
|
|
else
|
|
|
|
if test -n "$findUnpacker"; then
|
|
|
|
$findUnpacker $1;
|
|
|
|
fi
|
|
|
|
if test -z "$unpackCmd"; then
|
|
|
|
echo "source archive $file has unknown type"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
cmd=$unpackCmd
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
header "unpacking source archive $file (using $cmd)" 3
|
2004-07-12 14:34:02 +02:00
|
|
|
$cmd || fail
|
2004-07-02 12:05:53 +02:00
|
|
|
stopNest
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
unpackW() {
|
|
|
|
if test -n "$unpackPhase"; then
|
|
|
|
$unpackPhase
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -z "$srcs"; then
|
|
|
|
if test -z "$src"; then
|
|
|
|
echo 'variable $src or $srcs should point to the source'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
srcs="$src"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# To determine the source directory created by unpacking the
|
|
|
|
# source archives, we record the contents of the current
|
|
|
|
# directory, then look below which directory got added. Yeah,
|
|
|
|
# it's rather hacky.
|
|
|
|
local dirsBefore=""
|
|
|
|
for i in *; do
|
|
|
|
if test -d "$i"; then
|
|
|
|
dirsBefore="$dirsBefore $i "
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# Unpack all source archives.
|
|
|
|
for i in $srcs; do
|
|
|
|
unpackFile $i
|
|
|
|
done
|
|
|
|
|
|
|
|
# Find the source directory.
|
|
|
|
if test -n "$setSourceRoot"; then
|
|
|
|
$setSourceRoot
|
|
|
|
else
|
|
|
|
sourceRoot=
|
|
|
|
for i in *; do
|
|
|
|
if test -d "$i"; then
|
|
|
|
case $dirsBefore in
|
|
|
|
*\ $i\ *)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
if test -n "$sourceRoot"; then
|
|
|
|
echo "unpacker produced multiple directories"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
sourceRoot=$i
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -z "$sourceRoot"; then
|
|
|
|
echo "unpacker appears to have produced no directories"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "source root is $sourceRoot"
|
|
|
|
|
2004-07-11 22:02:57 +02:00
|
|
|
# By default, add write permission to the sources. This is often
|
|
|
|
# necessary when sources have been copied from other store
|
|
|
|
# locations.
|
|
|
|
if test "dontMakeSourcesWritable" != 1; then
|
|
|
|
chmod -R +w $sourceRoot
|
|
|
|
fi
|
|
|
|
|
2004-07-02 12:05:53 +02:00
|
|
|
if test -n "$postUnpack"; then
|
|
|
|
$postUnpack
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
unpackPhase() {
|
|
|
|
header "unpacking sources"
|
2004-07-11 20:52:25 +02:00
|
|
|
startLog "unpack"
|
2004-07-02 12:05:53 +02:00
|
|
|
unpackW
|
2004-07-11 20:52:25 +02:00
|
|
|
stopLog
|
2004-07-02 12:05:53 +02:00
|
|
|
stopNest
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
patchW() {
|
|
|
|
if test -n "$patchPhase"; then
|
|
|
|
$patchPhase
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
for i in $patches; do
|
|
|
|
header "applying patch $i" 3
|
2004-07-12 14:34:02 +02:00
|
|
|
patch -p1 < $i || fail
|
2004-07-02 12:05:53 +02:00
|
|
|
stopNest
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
patchPhase() {
|
|
|
|
if test -z "$patchPhase" -a -z "$patches"; then return; fi
|
|
|
|
header "patching sources"
|
2004-07-11 20:52:25 +02:00
|
|
|
startLog "patch"
|
2004-07-02 12:05:53 +02:00
|
|
|
patchW
|
2004-07-11 20:52:25 +02:00
|
|
|
stopLog
|
2004-07-02 12:05:53 +02:00
|
|
|
stopNest
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fixLibtool() {
|
|
|
|
sed 's^eval sys_lib_.*search_path=.*^^' < $1 > $1.tmp
|
|
|
|
mv $1.tmp $1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
configureW() {
|
|
|
|
if test -n "$configurePhase"; then
|
|
|
|
$configurePhase
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -n "$preConfigure"; then
|
|
|
|
$preConfigure
|
|
|
|
fi
|
|
|
|
|
2004-09-18 19:23:18 +02:00
|
|
|
if test -z "$prefix"; then
|
|
|
|
prefix="$out";
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "$useTempPrefix" = "1"; then
|
|
|
|
prefix="$NIX_BUILD_TOP/tmp_prefix";
|
|
|
|
fi
|
|
|
|
|
2004-07-02 12:05:53 +02:00
|
|
|
if test -z "$configureScript"; then
|
|
|
|
configureScript=./configure
|
|
|
|
if ! test -x $configureScript; then
|
|
|
|
echo "no configure script, doing nothing"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -z "$dontFixLibtool"; then
|
|
|
|
for i in $(find . -name "ltmain.sh"); do
|
|
|
|
echo "fixing libtool script $i"
|
|
|
|
fixLibtool $i
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -z "$dontAddPrefix"; then
|
2004-07-11 18:32:34 +02:00
|
|
|
configureFlags="--prefix=$prefix $configureFlags"
|
2004-07-02 12:05:53 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "configure flags: $configureFlags"
|
2004-07-12 14:34:02 +02:00
|
|
|
$configureScript $configureFlags || fail
|
2004-07-02 12:05:53 +02:00
|
|
|
|
|
|
|
if test -n "$postConfigure"; then
|
|
|
|
$postConfigure
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
configurePhase() {
|
|
|
|
header "configuring"
|
2004-07-11 20:52:25 +02:00
|
|
|
startLog "configure"
|
2004-07-02 12:05:53 +02:00
|
|
|
configureW
|
2004-07-11 20:52:25 +02:00
|
|
|
stopLog
|
2004-07-02 12:05:53 +02:00
|
|
|
stopNest
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
buildW() {
|
|
|
|
if test -n "$buildPhase"; then
|
|
|
|
$buildPhase
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2004-08-09 16:33:14 +02:00
|
|
|
if test -n "$preBuild"; then
|
|
|
|
$preBuild
|
|
|
|
fi
|
|
|
|
|
2004-07-11 18:32:34 +02:00
|
|
|
echo "make flags: $makeFlags"
|
2004-07-12 14:34:02 +02:00
|
|
|
make $makeFlags || fail
|
2004-08-09 16:33:14 +02:00
|
|
|
|
|
|
|
if test -n "$postBuild"; then
|
|
|
|
$postBuild
|
|
|
|
fi
|
2004-07-02 12:05:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
buildPhase() {
|
2004-07-11 18:32:34 +02:00
|
|
|
if test "$dontBuild" = 1; then
|
|
|
|
return
|
|
|
|
fi
|
2004-07-02 12:05:53 +02:00
|
|
|
header "building"
|
2004-07-11 20:52:25 +02:00
|
|
|
startLog "build"
|
2004-07-02 12:05:53 +02:00
|
|
|
buildW
|
2004-07-11 20:52:25 +02:00
|
|
|
stopLog
|
2004-07-02 12:05:53 +02:00
|
|
|
stopNest
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-11 18:32:34 +02:00
|
|
|
checkW() {
|
|
|
|
if test -n "$checkPhase"; then
|
|
|
|
$checkPhase
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -z "$checkTarget"; then
|
|
|
|
checkTarget="check"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "check flags: $checkFlags"
|
2004-07-12 14:34:02 +02:00
|
|
|
make $checkFlags $checkTarget || fail
|
2004-07-11 18:32:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
checkPhase() {
|
|
|
|
if test "$doCheck" != 1; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
header "checking"
|
2004-07-11 20:52:25 +02:00
|
|
|
startLog "check"
|
2004-07-11 18:32:34 +02:00
|
|
|
checkW
|
2004-07-11 20:52:25 +02:00
|
|
|
stopLog
|
2004-07-11 18:32:34 +02:00
|
|
|
stopNest
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-02 20:27:50 +02:00
|
|
|
patchELF() {
|
|
|
|
# Patch all ELF executables and shared libraries.
|
2005-10-11 16:29:30 +02:00
|
|
|
header "patching ELF executables and libraries"
|
2005-06-17 15:46:04 +02:00
|
|
|
find "$prefix" \( \
|
|
|
|
\( -type f -a -name "*.so*" \) -o \
|
2004-10-02 20:27:50 +02:00
|
|
|
\( -type f -a -perm +0100 \) \
|
2005-10-11 16:29:30 +02:00
|
|
|
\) -print -exec patchelf --shrink-rpath {} \;
|
2004-10-02 20:27:50 +02:00
|
|
|
stopNest
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-02 12:05:53 +02:00
|
|
|
installW() {
|
|
|
|
if test -n "$installPhase"; then
|
|
|
|
$installPhase
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -n "$preInstall"; then
|
|
|
|
$preInstall
|
|
|
|
fi
|
|
|
|
|
2004-07-11 18:32:34 +02:00
|
|
|
ensureDir "$prefix"
|
2004-07-02 12:05:53 +02:00
|
|
|
|
|
|
|
if test -z "$dontMakeInstall"; then
|
|
|
|
echo "install flags: $installFlags"
|
2004-07-12 14:34:02 +02:00
|
|
|
make install $installFlags || fail
|
2004-07-02 12:05:53 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if test -z "$dontStrip" -a "$NIX_STRIP_DEBUG" = 1; then
|
2004-07-12 14:34:02 +02:00
|
|
|
find "$prefix" -name "*.a" -exec echo stripping {} \; \
|
|
|
|
-exec strip -S {} \; || fail
|
2004-07-02 12:05:53 +02:00
|
|
|
fi
|
|
|
|
|
2004-10-02 20:27:50 +02:00
|
|
|
if test "$havePatchELF" = 1 -a -z "$dontPatchELF"; then
|
|
|
|
patchELF "$prefix"
|
|
|
|
fi
|
|
|
|
|
2004-07-02 12:05:53 +02:00
|
|
|
if test -n "$propagatedBuildInputs"; then
|
2004-07-12 14:34:02 +02:00
|
|
|
ensureDir "$out/nix-support"
|
2004-07-02 12:05:53 +02:00
|
|
|
echo "$propagatedBuildInputs" > "$out/nix-support/propagated-build-inputs"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -n "$postInstall"; then
|
|
|
|
$postInstall
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
installPhase() {
|
2004-07-11 18:32:34 +02:00
|
|
|
if test "$dontInstall" = 1; then
|
|
|
|
return
|
|
|
|
fi
|
2004-07-02 12:05:53 +02:00
|
|
|
header "installing"
|
2004-07-11 20:52:25 +02:00
|
|
|
startLog "install"
|
2004-07-02 12:05:53 +02:00
|
|
|
installW
|
2004-07-11 20:52:25 +02:00
|
|
|
stopLog
|
2004-07-02 12:05:53 +02:00
|
|
|
stopNest
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-11 18:32:34 +02:00
|
|
|
distW() {
|
|
|
|
if test -n "$distPhase"; then
|
|
|
|
$distPhase
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2004-08-09 16:33:14 +02:00
|
|
|
if test -n "$preDist"; then
|
|
|
|
$preDist
|
|
|
|
fi
|
|
|
|
|
2004-07-11 18:32:34 +02:00
|
|
|
if test -z "$distTarget"; then
|
|
|
|
distTarget="dist"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "dist flags: $distFlags"
|
2004-07-12 14:34:02 +02:00
|
|
|
make $distFlags $distTarget || fail
|
2004-07-11 18:32:34 +02:00
|
|
|
|
|
|
|
if test "$dontCopyDist" != 1; then
|
|
|
|
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
|
2004-08-09 16:33:14 +02:00
|
|
|
|
|
|
|
if test -n "$postDist"; then
|
|
|
|
$postDist
|
|
|
|
fi
|
2004-07-11 18:32:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
distPhase() {
|
|
|
|
if test "$doDist" != 1; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
header "creating distribution"
|
2004-07-11 20:52:25 +02:00
|
|
|
startLog "dist"
|
2004-07-11 18:32:34 +02:00
|
|
|
distW
|
2004-07-11 20:52:25 +02:00
|
|
|
stopLog
|
2004-07-11 18:32:34 +02:00
|
|
|
stopNest
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-02 12:05:53 +02:00
|
|
|
genericBuild() {
|
|
|
|
header "building $out"
|
2004-07-11 18:32:34 +02:00
|
|
|
|
2004-07-02 12:05:53 +02:00
|
|
|
unpackPhase
|
|
|
|
cd $sourceRoot
|
2004-07-11 18:32:34 +02:00
|
|
|
|
|
|
|
if test -z "$phases"; then
|
|
|
|
phases="patchPhase configurePhase buildPhase checkPhase \
|
|
|
|
installPhase distPhase";
|
|
|
|
fi
|
|
|
|
|
|
|
|
for i in $phases; do
|
2004-08-30 16:06:14 +02:00
|
|
|
dumpVars
|
2004-07-11 18:32:34 +02:00
|
|
|
$i
|
|
|
|
done
|
|
|
|
|
2004-07-02 12:05:53 +02:00
|
|
|
stopNest
|
|
|
|
}
|
2004-08-30 16:06:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
dumpVars
|