stdenv: add first iteration of the multiout hook
Now it should contain *all* information from stdenv/setup.sh of the original mutiple-output branch. However, the configurability of the output paths is much greater.
This commit is contained in:
parent
4e72b61de9
commit
def75f0282
|
@ -0,0 +1,51 @@
|
|||
preConfigureHooks+=(_multioutConfig)
|
||||
|
||||
# Assign the first nonempty string to variable named $1
|
||||
_assignFirst() {
|
||||
local varName="$1"
|
||||
shift
|
||||
while [ $# -ge 0 ]; do
|
||||
if [ -n "$1" ]; then eval "${varName}"="$1"; return; fi
|
||||
shift
|
||||
done
|
||||
return 1 # none found
|
||||
}
|
||||
|
||||
# Setup chains of sane default values with easy overridability.
|
||||
# The variables are global to be usable anywhere during the build.
|
||||
# ToDo: I was unable to get rid of the double-name redundancy (I hate bash eval ways)
|
||||
|
||||
_assignFirst outputDev "$outputDev" "$dev" "$out"
|
||||
_assignFirst outputBin "$outputBin" "$bin" "$out"
|
||||
|
||||
_assignFirst outputInclude "$outputInclude" "$outputDev"
|
||||
|
||||
# so-libs are often among the main things to keep, and so go to $out
|
||||
_assignFirst outputLib "$outputLib" "$lib" "$out"
|
||||
|
||||
_assignFirst outputDoc "$outputDoc" "$doc" "$out"
|
||||
# man and info pages are small and often useful to distribute with binaries
|
||||
_assignFirst outputMan "$outputMan" "$man" "$outputBin"
|
||||
_assignFirst outputInfo "$outputInfo" "$info" "$outputMan"
|
||||
|
||||
# Add standard flags to put files into the desired outputs.
|
||||
_multioutConfig() {
|
||||
if [ -n "${setOutputFlags-1}" ]; then
|
||||
configureFlags="\
|
||||
--bindir=$outputBin/bin --sbindir=$outputBin/sbin --libexecdir=$outputBin/libexec \
|
||||
--includedir=$outputInclude/include --oldincludedir=$outputInclude/include \
|
||||
--mandir=$outputMan/share/man --infodir=$outputInfo/share/info --docdir=$outputDoc/share/doc \
|
||||
--libdir=$outputLib/lib \
|
||||
$configureFlags"
|
||||
|
||||
installFlags="\
|
||||
pkgconfigdir=$outputDev/lib/pkgconfig \
|
||||
m4datadir=$outputDev/share/aclocal aclocaldir=$outputDev/share/aclocal \
|
||||
$installFlags"
|
||||
fi
|
||||
}
|
||||
|
||||
# Add rpath prefixes to library paths, and avoid stdenv doing it for $out.
|
||||
_addRpathPrefix "$outputLib"
|
||||
NIX_NO_SELF_RPATH=1
|
||||
|
|
@ -206,6 +206,12 @@ let
|
|||
inherit overrides;
|
||||
|
||||
inherit gcc;
|
||||
|
||||
# extra useful hooks, so we do not need to pass them as package arguments
|
||||
hookLib = {
|
||||
multiout = ../../build-support/setup-hooks/multiple-outputs.sh;
|
||||
#ToDo: add also autoreconf = pkgs.autoreconfHook
|
||||
};
|
||||
}
|
||||
|
||||
# Propagate any extra attributes. For instance, we use this to
|
||||
|
|
|
@ -259,16 +259,19 @@ for i in $crossPkgs; do
|
|||
done
|
||||
|
||||
|
||||
# Add the output as an rpath. ToDo: multiple-output?
|
||||
if [ "$NIX_NO_SELF_RPATH" != 1 ]; then
|
||||
export NIX_LDFLAGS="-rpath $out/lib $NIX_LDFLAGS"
|
||||
# Add $1/lib* into rpaths.
|
||||
_addRpathPrefix() {
|
||||
if [ "$NIX_NO_SELF_RPATH" != 1 ]; then
|
||||
export NIX_LDFLAGS="-rpath $1/lib $NIX_LDFLAGS"
|
||||
if [ -n "$NIX_LIB64_IN_SELF_RPATH" ]; then
|
||||
export NIX_LDFLAGS="-rpath $out/lib64 $NIX_LDFLAGS"
|
||||
export NIX_LDFLAGS="-rpath $1/lib64 $NIX_LDFLAGS"
|
||||
fi
|
||||
if [ -n "$NIX_LIB32_IN_SELF_RPATH" ]; then
|
||||
export NIX_LDFLAGS="-rpath $out/lib32 $NIX_LDFLAGS"
|
||||
export NIX_LDFLAGS="-rpath $1/lib32 $NIX_LDFLAGS"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
_addRpathPrefix "$out"
|
||||
|
||||
|
||||
# Set the TZ (timezone) environment variable, otherwise commands like
|
||||
|
|
Loading…
Reference in New Issue