3
0
Fork 0
forked from mirrors/nixpkgs

buildFHSEnv: use separate gcc for 64- and 32-bit

This commit is contained in:
Nikolay Amiantov 2016-05-29 21:40:53 +03:00
parent 46df051890
commit 1b2139b3e2

View file

@ -37,21 +37,20 @@ let
# list of packages which are installed for both x86 and x86_64 on x86_64 # list of packages which are installed for both x86 and x86_64 on x86_64
# systems # systems
multiPaths = if isMultiBuild multiPaths = multiPkgs nixpkgs_i686;
then multiPkgs nixpkgs_i686
else [];
# base packages of the chroot # base packages of the chroot
# these match the host's architecture, gcc/glibc_multi are used for multilib # these match the host's architecture, glibc_multi is used for multilib
# builds. # builds.
chosenGcc = if isMultiBuild then nixpkgs.gcc_multi else nixpkgs.gcc;
basePkgs = with nixpkgs; basePkgs = with nixpkgs;
[ (if isMultiBuild then glibc_multi else glibc) [ (if isMultiBuild then glibc_multi else glibc)
chosenGcc gcc.cc.lib bashInteractive coreutils less shadow su
bashInteractive coreutils less shadow su
gawk diffutils findutils gnused gnugrep gawk diffutils findutils gnused gnugrep
gnutar gzip bzip2 xz glibcLocales gnutar gzip bzip2 xz glibcLocales
]; ];
baseMultiPkgs = with nixpkgs_i686;
[ gcc.cc.lib
];
etcProfile = nixpkgs.writeText "profile" '' etcProfile = nixpkgs.writeText "profile" ''
export PS1='${name}-chrootenv:\u@\h:\w\$ ' export PS1='${name}-chrootenv:\u@\h:\w\$ '
@ -125,8 +124,8 @@ let
}; };
staticUsrProfileMulti = nixpkgs.buildEnv { staticUsrProfileMulti = nixpkgs.buildEnv {
name = "system-profile-multi"; name = "${name}-usr-multi";
paths = multiPaths; paths = baseMultiPkgs ++ multiPaths;
extraOutputsToInstall = [ "lib" "out" ] ++ extraOutputsToInstall; extraOutputsToInstall = [ "lib" "out" ] ++ extraOutputsToInstall;
ignoreCollisions = true; ignoreCollisions = true;
}; };
@ -154,18 +153,8 @@ let
# copy content of targetPaths (64bit libs) # copy content of targetPaths (64bit libs)
cp -rsHf ${staticUsrProfileTarget}/lib/* lib64/ && chmod u+w -R lib64/ cp -rsHf ${staticUsrProfileTarget}/lib/* lib64/ && chmod u+w -R lib64/
# most 64bit only libs put their stuff into /lib
# some pkgs (like gcc_multi) put 32bit libs into /lib and 64bit libs into /lib64
# by overwriting these we will hopefully catch all these cases
# in the end /lib32 should only contain 32bit and /lib64 only 64bit libs
cp -rsHf ${staticUsrProfileTarget}/lib64/* lib64/ && chmod u+w -R lib64/
# copy gcc libs
cp -rsHf ${chosenGcc.cc.lib}/lib/* lib32/
cp -rsHf ${chosenGcc.cc.lib}/lib64/* lib64/
# symlink 32-bit ld-linux.so # symlink 32-bit ld-linux.so
ln -s ${staticUsrProfileTarget}/lib/32/ld-linux.so.2 lib/ ln -Ls ${staticUsrProfileTarget}/lib/32/ld-linux.so.2 lib/
''; '';
setupLibDirs = if isTargetBuild then setupLibDirs_target setupLibDirs = if isTargetBuild then setupLibDirs_target