* setup.sh: turn on nullglob globally.

* setup.sh: removed some obsolete features, specifically some that
  were only used by the old build farm.
* addToSearchPath: removed some parameters that weren't used
  anywhere.

svn path=/nixpkgs/branches/stdenv-updates/; revision=15136
This commit is contained in:
Eelco Dolstra 2009-04-18 22:22:51 +00:00
parent ba0682330d
commit 6b9ccbaf78
9 changed files with 29 additions and 104 deletions

View File

@ -17,13 +17,13 @@ envHooks=(${envHooks[@]} addCVars)
# Note: these come *after* $out in the PATH (see setup.sh).
if test -n "@gcc@"; then
PATH=$PATH:@gcc@/bin
addToSearchPath PATH @gcc@/bin
fi
if test -n "@binutils@"; then
PATH=$PATH:@binutils@/bin
addToSearchPath PATH @binutils@/bin
fi
if test -n "@libc@"; then
PATH=$PATH:@libc@/bin
addToSearchPath PATH @libc@/bin
fi

View File

@ -1,5 +1,5 @@
addPerlLibPath () {
addToSearchPath PERL5LIB /lib/site_perl "" $1
addToSearchPath PERL5LIB $1/lib/site_perl
}
envHooks=(${envHooks[@]} addPerlLibPath)

View File

@ -1,5 +1,5 @@
addPerlLibPath () {
addToSearchPath PERL5LIB /lib/site_perl "" $1
addToSearchPath PERL5LIB $1/lib/site_perl
}
envHooks=(${envHooks[@]} addPerlLibPath)

View File

@ -1,5 +1,5 @@
addPythonPath() {
addToSearchPathWithCustomDelimiter : PYTHONPATH /lib/python2.4/site-packages "" $1
addToSearchPathWithCustomDelimiter : PYTHONPATH $1/lib/python2.4/site-packages
}
toPythonPath() {

View File

@ -1,5 +1,5 @@
addPythonPath() {
addToSearchPathWithCustomDelimiter : PYTHONPATH /lib/python2.5/site-packages "" $1
addToSearchPathWithCustomDelimiter : PYTHONPATH $1/lib/python2.5/site-packages
}
toPythonPath() {

View File

@ -1,8 +1,8 @@
addCMakeParams()
{
addToSearchPath CMAKE_INCLUDE_PATH /include "" $1
addToSearchPath CMAKE_LIBRARY_PATH /lib "" $1
addToSearchPath CMAKE_MODULE_PATH /share/cmake-@majorVersion@/Modules "" $1
addToSearchPath CMAKE_INCLUDE_PATH $1/include
addToSearchPath CMAKE_LIBRARY_PATH $1/lib
addToSearchPath CMAKE_MODULE_PATH $1/share/cmake-@majorVersion@/Modules
}
fixCmakeFiles()

View File

@ -1,5 +1,5 @@
addAclocals () {
addToSearchPathWithCustomDelimiter : ACLOCAL_PATH /share/aclocal "" $1
addToSearchPathWithCustomDelimiter ACLOCAL_PATH $1/share/aclocal
}
envHooks=(${envHooks[@]} addAclocals)

View File

@ -1,6 +1,6 @@
addPkgConfigPath () {
addToSearchPath PKG_CONFIG_PATH /lib/pkgconfig "" $1
addToSearchPath PKG_CONFIG_PATH /share/pkgconfig "" $1
addToSearchPath PKG_CONFIG_PATH $1/lib/pkgconfig
addToSearchPath PKG_CONFIG_PATH $1/share/pkgconfig
}
envHooks=(${envHooks[@]} addPkgConfigPath)

View File

@ -60,18 +60,14 @@ trap "exitHandler" EXIT
addToSearchPathWithCustomDelimiter() {
local delimiter=$1
local varName=$2
local needDir=$3
local addDir=${4:-$needDir}
local prefix=$5
if [ -d $prefix$needDir ]; then
if [ -z ${!varName} ]; then
eval export ${varName}=${prefix}$addDir
else
eval export ${varName}=${!varName}${delimiter}${prefix}$addDir
fi
local dir=$3
if [ -d "$dir" ]; then
eval export ${varName}=${!varName}${!varName:+$delimiter}${dir}
fi
}
PATH_DELIMITER=':'
addToSearchPath() {
addToSearchPathWithCustomDelimiter "${PATH_DELIMITER}" "$@"
}
@ -85,11 +81,17 @@ set -e
test -z $NIX_GCC && NIX_GCC=@gcc@
# Wildcard expansions that don't match should expand to an empty list.
# This ensures that, for instance, "for i in *; do ...; done" does the
# right thing.
shopt -s nullglob
# Set up the initial path.
PATH=
for i in $NIX_GCC @initialPath@; do
if test "$i" = /; then i=; fi
PATH=$PATH${PATH:+:}$i/bin
addToSearchPath PATH $i/bin
done
if test "$NIX_DEBUG" = "1"; then
@ -99,7 +101,6 @@ fi
# Execute the pre-hook.
export SHELL=@shell@
PATH_DELIMITER=':'
if test -z "$shell"; then
export shell=@shell@
fi
@ -132,15 +133,8 @@ ensureDir() {
}
installBin() {
ensureDir $out/bin
cp "$@" $out/bin
}
assertEnvExists(){
if test -z "${!1}"; then
msg=${2:-error: assertion failed: env var $1 is required}
echo $msg >&2; exit 1
fi
ensureDir $out/bin
cp "$@" $out/bin
}
@ -184,15 +178,11 @@ done
addToEnv() {
local pkg=$1
if test "$ignoreFailedInputs" != "1" -a -e $1/nix-support/failed; then
echo "failed input $1" >&2
exit 1
fi
if test -d $1/bin; then
export _PATH=$_PATH${_PATH:+:}$1/bin
addToSearchPath _PATH $1/bin
fi
# Run the package-specific hooks set by the setup-hook scripts.
for i in "${envHooks[@]}"; do
$i $pkg
done
@ -219,17 +209,6 @@ if test -z "$NIX_STRIP_DEBUG"; then
fi
assertEnvExists NIX_STORE \
"Error: you have an old version of Nix that does not set the
NIX_STORE variable. This is required for purity checking.
Please upgrade."
assertEnvExists NIX_BUILD_TOP \
"Error: you have an old version of Nix that does not set the
NIX_BUILD_TOP variable. This is required for purity checking.
Please upgrade."
# 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').
@ -397,58 +376,6 @@ dumpVars() {
}
# 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.
startLog() {
local logFile=${logNr}_$1
logNr=$((logNr + 1))
if test "$logPhases" = 1; then
ensureDir $logDir
exec 3>&1
if test "$dontLogThroughTee" != 1; then
# This required named pipes (fifos).
logFifo=$NIX_BUILD_TOP/log_fifo
test -p $logFifo || mkfifo $logFifo
startLogWrite "$logDir/$logFile" "$logFifo"
exec > $logFifo 2>&1
else
exec > $logDir/$logFile 2>&1
fi
fi
}
# Factored into a separate function so that it can be overriden.
startLogWrite() {
tee "$1" < "$2" &
logWriterPid=$!
}
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
# Wait until the tee process has died. Otherwise output from
# different phases may be mixed up.
if test -n "$logWriterPid"; then
wait $logWriterPid
logWriterPid=
rm $logFifo
fi
fi
}
# Utility function: return the base name of the given path, with the
# prefix `HASH-' removed, if present.
stripHash() {
@ -823,7 +750,6 @@ genericBuild() {
if test "$curPhase" = distPhase -a -z "$doDist"; then continue; fi
showPhaseHeader "$curPhase"
startLog "$curPhase"
dumpVars
# Evaluate the variable named $curPhase if it exists, otherwise the
@ -834,7 +760,6 @@ genericBuild() {
cd "${sourceRoot:-.}"
fi
stopLog
stopNest
done