Skip to content

Commit 41cd83d

Browse files
committed
Install baselayout rather than duplicating dir/symlink behaviour here
crossdev environments need to support merged-usr now, especially now that the profile can be selected. The logic around this is messy and best handled by the baselayout package. This package now gets installed immediately before binutils. It means a few small extra files get installed, but that's a small price to pay. We could INSTALL_MASK them, but that would just add more complexity. Signed-off-by: James Le Cuirot <[email protected]>
1 parent e76f567 commit 41cd83d

File tree

1 file changed

+27
-69
lines changed

1 file changed

+27
-69
lines changed

crossdev

Lines changed: 27 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,52 +1616,6 @@ hr
16161616
xmkdir -p "${EPREFIX}"/usr/${CTARGET}
16171617
LLVM="${LLVM}" emerge-wrapper --target "${CTARGET}" --init --profile "${PROFILE}" || exit 1
16181618

1619-
#############################################################
1620-
### Create directories usually created by sys-apps/baselayout
1621-
###
1622-
### Why we do that at all:
1623-
### For multilib-aware targets (ppc64, s390x, sparc64, x86_64), Gentoo
1624-
### normally uses libdir=lib64.
1625-
### For crossdev, it means /lib and /usr/lib does not get created at all
1626-
### but gcc relies on their presence by refering to =/lib64 as
1627-
### =/usr/lib/../lib64 when builds itself (see https://bugs.gentoo.org/652724)
1628-
###
1629-
### Thus we create non-symlinked layout early.
1630-
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/lib
1631-
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/usr/lib
1632-
###
1633-
### We need some special riscv sauce here similar as in baselayout. Ugly.
1634-
### step 1: set up all multilib libdirs
1635-
### step 2: set up the compat symlink of the default abi for non-multilib
1636-
case ${CTARGET} in
1637-
riscv*)
1638-
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/lib64
1639-
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/lib64/lp64
1640-
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/lib64/lp64d
1641-
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/usr/lib64
1642-
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/usr/lib64/lp64
1643-
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/usr/lib64/lp64d
1644-
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/lib32
1645-
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/lib32/ilp32
1646-
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/lib32/ilp32d
1647-
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/usr/lib32
1648-
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/usr/lib32/ilp32
1649-
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/usr/lib32/ilp32d
1650-
;;&
1651-
riscv64*)
1652-
rmdir "${EPREFIX}"/usr/${CTARGET}/lib64/${DEFAULT_ABI}
1653-
ln -s . "${EPREFIX}"/usr/${CTARGET}/lib64/${DEFAULT_ABI}
1654-
rmdir "${EPREFIX}"/usr/${CTARGET}/usr/lib64/${DEFAULT_ABI}
1655-
ln -s . "${EPREFIX}"/usr/${CTARGET}/usr/lib64/${DEFAULT_ABI}
1656-
;;
1657-
riscv32*)
1658-
rmdir "${EPREFIX}"/usr/${CTARGET}/lib32/${DEFAULT_ABI}
1659-
ln -s ../lib "${EPREFIX}"/usr/${CTARGET}/lib32/${DEFAULT_ABI}
1660-
rmdir "${EPREFIX}"/usr/${CTARGET}/usr/lib32/${DEFAULT_ABI}
1661-
ln -s ../lib "${EPREFIX}"/usr/${CTARGET}/usr/lib32/${DEFAULT_ABI}
1662-
;;
1663-
esac
1664-
16651619
# HOSTCC is used by linux-headers to compile fixdeps program for CBUILD
16661620
if [[ "${LLVM}" == "yes" ]] ; then
16671621
cat <<-EOF > "${CONFIGROOT}/env/${CROSSDEV_OVERLAY_CATEGORY}/llvm.conf"
@@ -1706,30 +1660,31 @@ set_eopts_on_pkg_status() {
17061660
EOPTS=${EOPTS_UP}
17071661
}
17081662

1709-
doemerge() {
1663+
do_emerge_cross() {
17101664
local category="${CROSSDEV_OVERLAY_CATEGORY}"
17111665
local pn=$1
17121666
local atom="${category}/${pn}"
17131667

17141668
[[ ${pn} == "[none]" ]] && return 0
1715-
17161669
set_use ${pn} ${USE} $( [[ ${MULTILIB_USE} == "no" ]] && echo - )multilib
1670+
do_emerge "${atom}" "${CROSSDEV_OVERLAY_CATEGORY_PREFIX}${2:-${pn}}"
1671+
}
17171672

1718-
[[ ${INIT_TARGET_ONLY} == "yes" ]] && return 0
1673+
do_emerge() {
1674+
local atom=$1
1675+
local pn=${1##*/}
17191676

1720-
local logfile=${PORT_LOGDIR}/${category}
1721-
[[ -z $2 ]] \
1722-
&& logfile=${logfile}-${pn}.log \
1723-
|| logfile=${logfile}-$2.log
1677+
[[ ${INIT_TARGET_ONLY} == "yes" ]] && return 0
17241678

1679+
local logfile="${PORT_LOGDIR}/cross-${CTARGET}-${2:-${pn}}.log"
17251680
einfo "Log: ${logfile}"
1726-
ebegin "Emerging ${CROSSDEV_OVERLAY_CATEGORY_PREFIX}${2:-${pn}}"
1681+
ebegin "Emerging ${2:-${pn}}"
17271682

17281683
if has -v ${UOPTS} || has -p ${UOPTS} || has -vp ${UOPTS} || has -pv ${UOPTS} ; then
17291684
SHOW_FAIL_LOG="no"
1730-
emerge ${atom} ${EOPTS} 2>&1 | tee "${logfile}"
1685+
${EMERGE:-emerge} ${atom} ${EOPTS} 2>&1 | tee "${logfile}"
17311686
else
1732-
emerge ${atom} ${EOPTS} >& "${logfile}"
1687+
${EMERGE:-emerge} ${atom} ${EOPTS} >& "${logfile}"
17331688
fi
17341689
local _pipestatus=${PIPESTATUS[*]}
17351690
if [[ "${_pipestatus// /}" -ne 0 ]] ; then
@@ -1759,7 +1714,7 @@ doemerge() {
17591714
# gcc wanting updated mpfr/gmp). Don't use --oneshot anymore to
17601715
# follow normal emerge behavior; people can pass the -1 to portage
17611716
# themselves if they want that.
1762-
EOPTS_DEF="${UOPTS}"
1717+
EOPTS_DEF="--buildpkg=n ${UOPTS}"
17631718
EOPTS_UP="${EOPTS_DEF} -u"
17641719
EOPTS=${EOPTS_UP}
17651720
# keep things like --ask from screwing us up
@@ -1794,6 +1749,9 @@ USE="${USE} -selinux"
17941749

17951750
if ! ex_fast ; then
17961751

1752+
# stage 0: baselayout
1753+
USE+=" build" EMERGE="${CTARGET}-emerge" do_emerge sys-apps/baselayout
1754+
17971755
# stage 0: binutils
17981756
if [[ "${LLVM}" == "yes" ]] ; then
17991757
if ! portageq has_version / "llvm-core/llvm" ; then
@@ -1826,9 +1784,9 @@ if ! ex_fast ; then
18261784

18271785
[[ ${supported_arch} -eq 0 ]] && die "Target architecture not supported by installed LLVM toolchain"
18281786

1829-
USE="${CUSE}" doemerge ${CPKG}
1787+
USE="${CUSE}" do_emerge_cross ${CPKG}
18301788
else
1831-
USE="${BUSE}" doemerge ${BPKG}
1789+
USE="${BUSE}" do_emerge_cross ${BPKG}
18321790
fi
18331791

18341792
# stage1: bare C compiler
@@ -1839,7 +1797,7 @@ if ! ex_fast ; then
18391797
# install kernel headers (since the C library often uses them)
18401798
USE="${KUSE} ${USE} headers-only" \
18411799
CROSSCOMPILE_OPTS="headers-only" \
1842-
doemerge ${KPKG} ${KPKG}-quick
1800+
do_emerge_cross ${KPKG} ${KPKG}-quick
18431801

18441802
if [[ -n ${LPKG} ]] ; then
18451803
# install C library headers
@@ -1849,7 +1807,7 @@ if ! ex_fast ; then
18491807
USE="${LUSE} ${USE} ${LUSE_DISABLE} headers-only" \
18501808
CROSSCOMPILE_OPTS="headers-only" \
18511809
EOPTS="${EOPTS} --nodeps" \
1852-
doemerge ${LPKG} ${LPKG}-headers
1810+
do_emerge_cross ${LPKG} ${LPKG}-headers
18531811
fi
18541812
fi
18551813

@@ -1858,11 +1816,11 @@ if ! ex_fast ; then
18581816
# Compile compiler-rt
18591817
USE="${RUSE} ${USE}" \
18601818
CROSSCOMPILE_OPTS="" \
1861-
doemerge ${RPKG}
1819+
do_emerge_cross ${RPKG}
18621820
else
18631821
USE="${GUSE} ${USE} ${GUSE_DISABLE_STAGE_1}" \
18641822
CROSSCOMPILE_OPTS="" \
1865-
doemerge ${GPKG} ${GPKG}-stage1
1823+
do_emerge_cross ${GPKG} ${GPKG}-stage1
18661824
fi
18671825

18681826
fi
@@ -1873,7 +1831,7 @@ if ! ex_fast ; then
18731831

18741832
USE="${KUSE} ${USE}" \
18751833
CROSSCOMPILE_OPTS="" \
1876-
doemerge ${KPKG}
1834+
do_emerge_cross ${KPKG}
18771835
fi
18781836

18791837
# stage3: full C library (headers/libs/etc...)
@@ -1884,24 +1842,24 @@ if ! ex_fast ; then
18841842

18851843
USE="${LUSE} ${USE} ${LUSE_DISABLE}" \
18861844
CROSSCOMPILE_OPTS="" \
1887-
doemerge ${LPKG}
1845+
do_emerge_cross ${LPKG}
18881846
fi
18891847

18901848
# stage4: full compiler (C/C++/etc...)
18911849
if is_s4 && [[ "${LLVM}" != "yes" ]] ; then
18921850
EOPTS="${EOPTS_UP} --newuse" \
18931851
USE="${GUSE} ${USE} ${GUSE_DISABLE_STAGE_2}" \
1894-
doemerge ${GPKG} ${GPKG}-stage2
1852+
do_emerge_cross ${GPKG} ${GPKG}-stage2
18951853
fi
18961854
fi
18971855

18981856
# all the extra things (like debuggers)
18991857
EOPTS="${EOPTS_UP} --newuse"
1900-
ex_gcc && USE="${GUSE} ${USE}" doemerge ${GPKG} ${GPKG}-extra
1901-
ex_gdb && USE="${DUSE} ${USE}" doemerge ${DPKG}
1858+
ex_gcc && USE="${GUSE} ${USE}" do_emerge_cross ${GPKG} ${GPKG}-extra
1859+
ex_gdb && USE="${DUSE} ${USE}" do_emerge_cross ${DPKG}
19021860
if ex_pkgs ; then
19031861
for pkg in "${XPKGS[@]}" ; do
1904-
doemerge "${pkg#*/}"
1862+
do_emerge_cross "${pkg#*/}"
19051863
done
19061864
fi
19071865

0 commit comments

Comments
 (0)