build-fhs-chrootenv: fix gcc libs on x86
This commit is contained in:
parent
2d912e29d5
commit
64f873461f
@ -14,11 +14,36 @@ assert targetPkgs != null -> multiPkgs != null;
|
|||||||
assert multiPkgs != null -> targetPkgs != null;
|
assert multiPkgs != null -> targetPkgs != null;
|
||||||
assert targetPkgs != null -> pkgs == [];
|
assert targetPkgs != null -> pkgs == [];
|
||||||
|
|
||||||
|
|
||||||
|
# HOWTO:
|
||||||
|
# If pkgs is defined buildFHSChrootEnv will run in legacy mode. This means
|
||||||
|
# it will build all pkgs contained in pkgs and basePkgs and then just merge
|
||||||
|
# all of their contents together via buildEnv.
|
||||||
|
#
|
||||||
|
# The new way is to define both targetPkgs and multiPkgs. These two are
|
||||||
|
# functions which get a pkgs environment supplied and should then return a list
|
||||||
|
# of packages based this environment.
|
||||||
|
# For example: targetPkgs = pkgs: [ pkgs.nmap ];
|
||||||
|
#
|
||||||
|
# All packages (most likeley programs) placed in targetPkgs will only be
|
||||||
|
# installed once--matching the hosts architecture (64bit on x86_64 and 32bit on
|
||||||
|
# x86). These packages will populate the chroot directory tree.
|
||||||
|
#
|
||||||
|
# Packages (most likeley libraries) defined in multiPkgs will be installed once
|
||||||
|
# on x86 systems and twice on x86_64 systems.
|
||||||
|
# On x86 they will just be merge with the packages defined in targetPkgs.
|
||||||
|
# On x86_64 they will be added to targetPkgs and in addition their 32bit
|
||||||
|
# versions will also be installed. The final directory should look as follows:
|
||||||
|
# /lib will include 32bit libraries from multiPkgs
|
||||||
|
# /lib32 will link to /lib
|
||||||
|
# /lib64 will include 64bit libraries from multiPkgs and targetPkgs
|
||||||
|
# /x86 will contain a complete 32bit environment composed by multiPkgs
|
||||||
|
|
||||||
let
|
let
|
||||||
is64Bit = system == "x86_64-linux";
|
is64Bit = system == "x86_64-linux";
|
||||||
# enable multi builds on x86_64 hosts if pakgs_target/multi are defined
|
# enable multi builds on x86_64 hosts if pakgs_target/multi are defined
|
||||||
isMultiBuild = is64Bit && targetPkgs != null;
|
isMultiBuild = is64Bit && targetPkgs != null;
|
||||||
isNormalBuild = !isMultiBuild;
|
isTargetBuild = !isMultiBuild;
|
||||||
|
|
||||||
# list of packages (usually programs) which will only be installed for the
|
# list of packages (usually programs) which will only be installed for the
|
||||||
# hosts architecture
|
# hosts architecture
|
||||||
@ -75,7 +100,7 @@ let
|
|||||||
destroySh = ./destroy.sh.in;
|
destroySh = ./destroy.sh.in;
|
||||||
|
|
||||||
linkProfile = profile: ''
|
linkProfile = profile: ''
|
||||||
for i in ${profile}/{etc,bin,lib{,32,64},sbin,share,var}; do
|
for i in ${profile}/{etc,bin,sbin,share,var}; do
|
||||||
if [ -x "$i" ]
|
if [ -x "$i" ]
|
||||||
then
|
then
|
||||||
ln -s "$i"
|
ln -s "$i"
|
||||||
@ -86,9 +111,12 @@ let
|
|||||||
# the target profile is the actual profile that will be used for the chroot
|
# the target profile is the actual profile that will be used for the chroot
|
||||||
setupTargetProfile = ''
|
setupTargetProfile = ''
|
||||||
${linkProfile staticUsrProfileTarget}
|
${linkProfile staticUsrProfileTarget}
|
||||||
|
${setupLibDirs}
|
||||||
|
|
||||||
mkdir -m0755 usr
|
mkdir -m0755 usr
|
||||||
cd usr
|
cd usr
|
||||||
${linkProfile staticUsrProfileTarget}
|
${linkProfile staticUsrProfileTarget}
|
||||||
|
${setupLibDirs}
|
||||||
cd ..
|
cd ..
|
||||||
'';
|
'';
|
||||||
|
|
||||||
@ -97,21 +125,30 @@ let
|
|||||||
# /lib, /lib32 -> links to 32bit binaries
|
# /lib, /lib32 -> links to 32bit binaries
|
||||||
# /lib64 -> links to 64bit binaries
|
# /lib64 -> links to 64bit binaries
|
||||||
# /usr/lib* -> same as above
|
# /usr/lib* -> same as above
|
||||||
setupMultiProfile = if isNormalBuild then "" else ''
|
setupMultiProfile = if isTargetBuild then "" else ''
|
||||||
mkdir -m0755 x86
|
mkdir -m0755 x86
|
||||||
cd x86
|
cd x86
|
||||||
${linkProfile staticUsrProfileMulti}
|
${linkProfile staticUsrProfileMulti}
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
${setupMultiLibDirs}
|
|
||||||
|
|
||||||
cd usr
|
|
||||||
${setupMultiLibDirs}
|
|
||||||
cd ..
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
setupMultiLibDirs = ''
|
setupLibDirs = if isTargetBuild then setupLibDirs_target
|
||||||
rm -f lib lib32 lib64
|
else setupLibDirs_multi;
|
||||||
|
|
||||||
|
# setup library paths only for the targeted architecture
|
||||||
|
setupLibDirs_target = ''
|
||||||
|
mkdir -m0755 lib
|
||||||
|
|
||||||
|
# copy content of targetPaths
|
||||||
|
cp -rsf ${staticUsrProfileTarget}/lib/* lib/
|
||||||
|
|
||||||
|
# copy gcc libs
|
||||||
|
cp -rsf ${choosenGcc.gcc}/lib/* lib/
|
||||||
|
|
||||||
|
'';
|
||||||
|
|
||||||
|
# setup /lib, /lib32 and /lib64
|
||||||
|
setupLibDirs_multi = ''
|
||||||
mkdir -m0755 lib
|
mkdir -m0755 lib
|
||||||
mkdir -m0755 lib64
|
mkdir -m0755 lib64
|
||||||
ln -s lib lib32
|
ln -s lib lib32
|
||||||
@ -120,12 +157,13 @@ let
|
|||||||
cp -rsf ${staticUsrProfileTarget}/lib/32/* lib/
|
cp -rsf ${staticUsrProfileTarget}/lib/32/* lib/
|
||||||
|
|
||||||
# copy content of multiPaths (32bit libs)
|
# copy content of multiPaths (32bit libs)
|
||||||
cp -rsf ${staticUsrProfileMulti}/lib/* lib/
|
cp -rsf ${staticUsrProfileMulti}/lib/* lib/
|
||||||
|
|
||||||
# copy content of targetPaths (64bit libs)
|
# copy content of targetPaths (64bit libs)
|
||||||
cp -rsf ${staticUsrProfileTarget}/lib/* lib64/
|
cp -rsf ${staticUsrProfileTarget}/lib/* lib64/
|
||||||
|
|
||||||
# most 64bit only libs put their stuff into /lib
|
# most 64bit only libs put their stuff into /lib
|
||||||
# some pkgs (like gcc_multi) put 32bit libs into /lib 64bit libs into /lib64
|
# some pkgs (like gcc_multi) put 32bit libs into and /lib 64bit libs into /lib64
|
||||||
# by overwriting these we will hopefully catch all these cases
|
# by overwriting these we will hopefully catch all these cases
|
||||||
# in the end /lib should only contain 32bit and /lib64 only 64bit libs
|
# in the end /lib should only contain 32bit and /lib64 only 64bit libs
|
||||||
cp -rsf ${staticUsrProfileTarget}/lib64/* lib64/
|
cp -rsf ${staticUsrProfileTarget}/lib64/* lib64/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user