Skip to content

Commit 9437f9b

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 <chewi@gentoo.org>
1 parent f68a0db commit 9437f9b

1 file changed

Lines changed: 27 additions & 69 deletions

File tree

crossdev

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

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

1708-
doemerge() {
1662+
do_emerge_cross() {
17091663
local category="${CROSSDEV_OVERLAY_CATEGORY}"
17101664
local pn=$1
17111665
local atom="${category}/${pn}"
17121666

17131667
[[ ${pn} == "[none]" ]] && return 0
1714-
17151668
set_use ${pn} ${USE} $( [[ ${MULTILIB_USE} == "no" ]] && echo - )multilib
1669+
do_emerge "${atom}" "${CROSSDEV_OVERLAY_CATEGORY_PREFIX}${2:-${pn}}"
1670+
}
17161671

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

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

1678+
local logfile="${PORT_LOGDIR}/cross-${CTARGET}-${2:-${pn}}.log"
17241679
einfo "Log: ${logfile}"
1725-
ebegin "Emerging ${CROSSDEV_OVERLAY_CATEGORY_PREFIX}${2:-${pn}}"
1680+
ebegin "Emerging ${2:-${pn}}"
17261681

17271682
if contains_any "${UOPTS}" -v || contains_any "${UOPTS}" -p || contains_any "${UOPTS}" -vp || contains_any "${UOPTS}" -pv ; then
17281683
SHOW_FAIL_LOG="no"
1729-
emerge ${atom} ${EOPTS} 2>&1 | tee "${logfile}"
1684+
${EMERGE:-emerge} ${atom} ${EOPTS} 2>&1 | tee "${logfile}"
17301685
else
1731-
emerge ${atom} ${EOPTS} >& "${logfile}"
1686+
${EMERGE:-emerge} ${atom} ${EOPTS} >& "${logfile}"
17321687
fi
17331688
local _pipestatus=${PIPESTATUS[*]}
17341689
if [[ "${_pipestatus// /}" -ne 0 ]] ; then
@@ -1758,7 +1713,7 @@ doemerge() {
17581713
# gcc wanting updated mpfr/gmp). Don't use --oneshot anymore to
17591714
# follow normal emerge behavior; people can pass the -1 to portage
17601715
# themselves if they want that.
1761-
EOPTS_DEF="${UOPTS}"
1716+
EOPTS_DEF="--buildpkg=n ${UOPTS}"
17621717
EOPTS_UP="${EOPTS_DEF} -u"
17631718
EOPTS=${EOPTS_UP}
17641719
# keep things like --ask from screwing us up
@@ -1793,6 +1748,9 @@ USE="${USE} -selinux"
17931748

17941749
if ! ex_fast ; then
17951750

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

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

1828-
USE="${CUSE}" doemerge ${CPKG}
1786+
USE="${CUSE}" do_emerge_cross ${CPKG}
18291787
else
1830-
USE="${BUSE}" doemerge ${BPKG}
1788+
USE="${BUSE}" do_emerge_cross ${BPKG}
18311789
fi
18321790

18331791
# stage1: bare C compiler
@@ -1838,7 +1796,7 @@ if ! ex_fast ; then
18381796
# install kernel headers (since the C library often uses them)
18391797
USE="${KUSE} ${USE} headers-only" \
18401798
CROSSCOMPILE_OPTS="headers-only" \
1841-
doemerge ${KPKG} ${KPKG}-quick
1799+
do_emerge_cross ${KPKG} ${KPKG}-quick
18421800

18431801
if [[ -n ${LPKG} ]] ; then
18441802
# install C library headers
@@ -1848,7 +1806,7 @@ if ! ex_fast ; then
18481806
USE="${LUSE} ${USE} ${LUSE_DISABLE} headers-only" \
18491807
CROSSCOMPILE_OPTS="headers-only" \
18501808
EOPTS="${EOPTS} --nodeps" \
1851-
doemerge ${LPKG} ${LPKG}-headers
1809+
do_emerge_cross ${LPKG} ${LPKG}-headers
18521810
fi
18531811
fi
18541812

@@ -1857,11 +1815,11 @@ if ! ex_fast ; then
18571815
# Compile compiler-rt
18581816
USE="${RUSE} ${USE}" \
18591817
CROSSCOMPILE_OPTS="" \
1860-
doemerge ${RPKG}
1818+
do_emerge_cross ${RPKG}
18611819
else
18621820
USE="${GUSE} ${USE} ${GUSE_DISABLE_STAGE_1}" \
18631821
CROSSCOMPILE_OPTS="" \
1864-
doemerge ${GPKG} ${GPKG}-stage1
1822+
do_emerge_cross ${GPKG} ${GPKG}-stage1
18651823
fi
18661824

18671825
fi
@@ -1872,7 +1830,7 @@ if ! ex_fast ; then
18721830

18731831
USE="${KUSE} ${USE}" \
18741832
CROSSCOMPILE_OPTS="" \
1875-
doemerge ${KPKG}
1833+
do_emerge_cross ${KPKG}
18761834
fi
18771835

18781836
# stage3: full C library (headers/libs/etc...)
@@ -1883,24 +1841,24 @@ if ! ex_fast ; then
18831841

18841842
USE="${LUSE} ${USE} ${LUSE_DISABLE}" \
18851843
CROSSCOMPILE_OPTS="" \
1886-
doemerge ${LPKG}
1844+
do_emerge_cross ${LPKG}
18871845
fi
18881846

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

18971855
# all the extra things (like debuggers)
18981856
EOPTS="${EOPTS_UP} --newuse"
1899-
ex_gcc && USE="${GUSE} ${USE}" doemerge ${GPKG} ${GPKG}-extra
1900-
ex_gdb && USE="${DUSE} ${USE}" doemerge ${DPKG}
1857+
ex_gcc && USE="${GUSE} ${USE}" do_emerge_cross ${GPKG} ${GPKG}-extra
1858+
ex_gdb && USE="${DUSE} ${USE}" do_emerge_cross ${DPKG}
19011859
if ex_pkgs ; then
19021860
for pkg in "${XPKGS[@]}" ; do
1903-
doemerge "${pkg#*/}"
1861+
do_emerge_cross "${pkg#*/}"
19041862
done
19051863
fi
19061864

0 commit comments

Comments
 (0)