Skip to content

Commit

Permalink
Automatically move stuff in lib64 to lib
Browse files Browse the repository at this point in the history
  • Loading branch information
edolstra committed Oct 7, 2014
1 parent ab04b7d commit 51f1b4e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
21 changes: 21 additions & 0 deletions pkgs/build-support/setup-hooks/move-lib64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This setup hook, for each output, moves everything in $output/lib64
# to $output/lib, and replaces $output/lib64 with a symlink to
# $output/lib. The rationale is that lib64 directories are unnecessary
# in Nix (since 32-bit and 64-bit builds of a package are in different
# store paths anyway).

fixupOutputHooks+=(_moveLib64)

_moveLib64() {
if [ "$dontMoveLib64" = 1 ]; then return; fi
if [ ! -e "$prefix/lib64" -o -L "$prefix/lib64" ]; then return; fi
echo "moving $prefix/lib64/* to $prefix/lib"
mkdir -p $prefix/lib
shopt -s dotglob
for i in $prefix/lib64/*; do
mv "$i" $prefix/lib
done
shopt -u dotglob
rmdir $prefix/lib64
ln -s lib $prefix/lib64
}
2 changes: 1 addition & 1 deletion pkgs/build-support/setup-hooks/move-sbin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fixupOutputHooks+=(_moveSbin)

_moveSbin() {
if [ "$dontMoveSbin" = 1 ]; then return; fi
if ! [ -e "$prefix/sbin" ]; then return; fi
if [ ! -e "$prefix/sbin" -o -L "$prefix/sbin" ]; then return; fi
echo "moving $prefix/sbin/* to $prefix/bin"
mkdir -p $prefix/bin
shopt -s dotglob
Expand Down
1 change: 1 addition & 0 deletions pkgs/stdenv/generic/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ let
../../build-support/setup-hooks/strip.sh
../../build-support/setup-hooks/patch-shebangs.sh
../../build-support/setup-hooks/move-sbin.sh
../../build-support/setup-hooks/move-lib64.sh
gcc
];

Expand Down

3 comments on commit 51f1b4e

@vcunat
Copy link
Member

@vcunat vcunat commented on 51f1b4e Nov 13, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This destroys gcc_multi, as it uses the same library names in two different dirs, and this hook silently overwrites one set by the other one. I fixed gcc_multi in 4578503, but maybe we should consider this hook not overwriting libs, e.g. use mv -t $prefix/lib $prefix/lib64/* --no-clobber, which would skip moving files that would cause overrides and make the following rmdir fail.

@edolstra
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for adding --no-clobber.

@vcunat
Copy link
Member

@vcunat vcunat commented on 51f1b4e Nov 14, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have that queued to push after merging staging to master.

Please sign in to comment.