Merge pull request #2063 from redbaron/libmsgpack
Proper separation between build and runtime outputs
This commit is contained in:
commit
c5f019e9a0
56
pkgs/build-support/setup-hooks/scatter_output.sh
Normal file
56
pkgs/build-support/setup-hooks/scatter_output.sh
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
preFixupPhases+=" scatter_files"
|
||||||
|
preDistPhases+=" propagate_bin_input"
|
||||||
|
|
||||||
|
SCATTER_BIN_DEFAULT=${SCATTER_BIN_DEFAULT:-"/lib/*.so* /bin/*"}
|
||||||
|
SCATTER_DOC_DEFAULT=${SCATTER_DOC_DEFAULT:-"/share/man/* /share/doc/*"}
|
||||||
|
|
||||||
|
|
||||||
|
scatter_files() {
|
||||||
|
save_nullglob=$(shopt -p nullglob)
|
||||||
|
for o in $outputs; do
|
||||||
|
[[ "$o" == "out" ]] && continue
|
||||||
|
v=files_${o}
|
||||||
|
|
||||||
|
#if files_'output' isn't set in derivative, use defualts for some
|
||||||
|
[[ ${!v} ]] || {
|
||||||
|
case $o in
|
||||||
|
bin)
|
||||||
|
v=SCATTER_BIN_DEFAULT
|
||||||
|
;;
|
||||||
|
doc)
|
||||||
|
v=SCATTER_DOC_DEFAULT
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
continue
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# prepend each path with $out
|
||||||
|
paths=$out${!v// \// $out/}
|
||||||
|
shopt -s nullglob
|
||||||
|
for f in $paths; do
|
||||||
|
shopt -u nullglob
|
||||||
|
dist=${!o}${f#$out}
|
||||||
|
mkdir -p $(dirname $dist)
|
||||||
|
cp -pr $f $dist
|
||||||
|
# remove source, not forgetting to clean empty dirs
|
||||||
|
rm -r $f
|
||||||
|
rmdir --ignore-fail-on-non-empty $(dirname $f)
|
||||||
|
done
|
||||||
|
find ${!o} -type f -exec $SHELL -c 'patchelf --set-rpath $(patchelf --print-rpath {} 2>/dev/null):'${!o}'/lib {} 2>/dev/null && patchelf --shrink-rpath {}' \;
|
||||||
|
done
|
||||||
|
eval $save_nullglob
|
||||||
|
}
|
||||||
|
|
||||||
|
propagate_bin_input() {
|
||||||
|
if [[ -n ${bin:-} ]]; then
|
||||||
|
mkdir -p $out/nix-support
|
||||||
|
echo $bin >> $out/nix-support/propagated-native-build-inputs
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n ${bin:-} && -n ${doc:-} ]]; then
|
||||||
|
mkdir -p $bin/nix-support
|
||||||
|
echo $doc >> $bin/nix-support/propagated-user-env-packages
|
||||||
|
fi
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
{ stdenv, fetchurl, autoconf, automake, libtool, ruby }:
|
{ stdenv, fetchurl, autoconf, automake, libtool, ruby, scatterOutputHook }:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
version = "0.5.8";
|
version = "0.5.8";
|
||||||
@ -9,17 +9,18 @@ stdenv.mkDerivation rec {
|
|||||||
sha256 = "1h6k9kdbfavmw3by5kk3raszwa64hn9k8yw9rdhvl5m8g2lks89k";
|
sha256 = "1h6k9kdbfavmw3by5kk3raszwa64hn9k8yw9rdhvl5m8g2lks89k";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [ scatterOutputHook ];
|
||||||
buildInputs = [ autoconf automake libtool ruby ];
|
buildInputs = [ autoconf automake libtool ruby ];
|
||||||
|
|
||||||
outputs = [ "out" "lib" ];
|
outputs = [ "out" "bin" ];
|
||||||
|
|
||||||
preConfigure = "./bootstrap";
|
preConfigure = ''
|
||||||
|
sed -i s,glibtoolize,libtoolize, ./bootstrap
|
||||||
postInstall = ''
|
./bootstrap
|
||||||
mkdir -p $lib/lib
|
|
||||||
mv $out/lib/*.so.* $lib/lib/
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
description = "MessagePack implementation for C and C++";
|
description = "MessagePack implementation for C and C++";
|
||||||
homepage = http://msgpack.org;
|
homepage = http://msgpack.org;
|
||||||
|
@ -278,6 +278,8 @@ let
|
|||||||
dotnetfx = dotnetfx40;
|
dotnetfx = dotnetfx40;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
scatterOutputHook = makeSetupHook {} ../build-support/setup-hooks/scatter_output.sh;
|
||||||
|
|
||||||
vsenv = callPackage ../build-support/vsenv {
|
vsenv = callPackage ../build-support/vsenv {
|
||||||
vs = vs90wrapper;
|
vs = vs90wrapper;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user