From 51f1b4ec48d53e01f219d3285a5f0acdb7fb6422 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 7 Oct 2014 15:04:13 +0200 Subject: [PATCH] Automatically move stuff in lib64 to lib --- pkgs/build-support/setup-hooks/move-lib64.sh | 21 ++++++++++++++++++++ pkgs/build-support/setup-hooks/move-sbin.sh | 2 +- pkgs/stdenv/generic/default.nix | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 pkgs/build-support/setup-hooks/move-lib64.sh diff --git a/pkgs/build-support/setup-hooks/move-lib64.sh b/pkgs/build-support/setup-hooks/move-lib64.sh new file mode 100644 index 00000000000..46c90fcea6b --- /dev/null +++ b/pkgs/build-support/setup-hooks/move-lib64.sh @@ -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 +} diff --git a/pkgs/build-support/setup-hooks/move-sbin.sh b/pkgs/build-support/setup-hooks/move-sbin.sh index 5db97afbbb6..cc51c27cafd 100644 --- a/pkgs/build-support/setup-hooks/move-sbin.sh +++ b/pkgs/build-support/setup-hooks/move-sbin.sh @@ -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 diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index 66afda48604..7351155bbd0 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -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 ];