nixpkgs/pkgs-ng/stdenv/generic/setup.sh
Eelco Dolstra 1894a8b86c * Converting packages. This is the minimal Nix stdenv for building
the ATerm library.

svn path=/nixpkgs/trunk/; revision=459
2003-11-02 17:42:19 +00:00

66 lines
1.3 KiB
Bash

# Set up the initial path.
for i in @INITIALPATH@; do
PATH=$PATH:$i/bin
done
echo $PATH
# Execute the pre-hook.
param1=@PARAM1@
param2=@PARAM2@
param3=@PARAM3@
param4=@PARAM4@
param5=@PARAM5@
. @PREHOOK@
# Add the directory containing the GCC wrappers to the PATH.
export PATH=@OUT@/bin:$PATH
# Recursively add all buildinputs to the relevant environment variables.
addtoenv()
{
pkgs="$buildinputs $1"
if test -d $1/bin; then
export PATH=$1/bin:$PATH
fi
if test -d $1/lib; then
export NIX_CFLAGS_LINK="-L$1/lib $NIX_CFLAGS_LINK"
export NIX_LDFLAGS="-rpath $1/lib $NIX_LDFLAGS"
fi
if test -d $1/lib/pkgconfig; then
export PKG_CONFIG_PATH=$1/lib/pkgconfig:$PKG_CONFIG_PATH
fi
if test -d $1/include; then
export NIX_CFLAGS_COMPILE="-I$1/include $NIX_CFLAGS_COMPILE"
fi
if test -f $1/propagated-build-inputs; then
for i in $(cat $1/propagated-build-inputs); do
addtoenv $i
done
fi
}
oldbuildinputs=$buildinputs
buildinputs=
for i in $oldbuildinputs; do
addtoenv $i
done
# Add the output as an rpath.
export NIX_LDFLAGS="-rpath $out/lib $NIX_LDFLAGS"
# Strip debug information by default.
export NIX_STRIP_DEBUG=1
# Execute the post-hook.
. @POSTHOOK@
if test "$NIX_DEBUG" == "1"; then
echo "Setup: PATH=$PATH"
fi