stdenv: Put moving docs to $out/share in a separate setup hook

This commit is contained in:
Eelco Dolstra 2014-07-08 14:26:35 +02:00
parent e3f7dbbac8
commit 9e31c66d1b
3 changed files with 26 additions and 20 deletions

View file

@ -0,0 +1,24 @@
# This setup hook automatically moves $out/{man,doc,info} to
# $out/share.
preFixupHooks+=(_moveDocs)
_moveDocs() {
forceShare=${forceShare:=man doc info}
if [ -z "$forceShare" ]; then return; fi
for d in $forceShare; do
if [ -d "$prefix/$d" ]; then
if [ -d "$prefix/share/$d" ]; then
echo "both $d/ and share/$d/ exist!"
else
echo "moving $prefix/$d to $prefix/share/$d"
mkdir -p $prefix/share
if [ -w $prefix/share ]; then
mv $prefix/$d $prefix/share
ln -s share/$d $prefix
fi
fi
fi
done
}

View file

@ -30,7 +30,8 @@ let
unsafeGetAttrPos = builtins.unsafeGetAttrPos or (n: as: null);
extraBuildInputs' = extraBuildInputs ++
[ ../../build-support/setup-hooks/compress-man-pages.sh
[ ../../build-support/setup-hooks/move-docs.sh
../../build-support/setup-hooks/compress-man-pages.sh
../../build-support/setup-hooks/strip.sh
../../build-support/setup-hooks/patch-shebangs.sh
gcc

View file

@ -701,25 +701,6 @@ fixupPhase() {
runHook preFixup
# Put man/doc/info under $out/share.
forceShare=${forceShare:=man doc info}
if [ -n "$forceShare" ]; then
for d in $forceShare; do
if [ -d "$prefix/$d" ]; then
if [ -d "$prefix/share/$d" ]; then
echo "both $d/ and share/$d/ exists!"
else
echo "fixing location of $d/ subdirectory"
mkdir -p $prefix/share
if [ -w $prefix/share ]; then
mv -v $prefix/$d $prefix/share
ln -sv share/$d $prefix
fi
fi
fi
done;
fi
# Apply fixup to each output.
local output
for output in $outputs; do