Skip to content

Commit c833a09

Browse files
committed
crossdev: usrmerge for the Hurd
This shows up when we build Hurd for stage2. The startup files are in /usr/lib64 (say with x86_64-gnu) while libc is in /lib64, and Hurd expects everything in / (inverse usr-merge). For Hurd targets, at least for now, always usr-merge. We may want to do what Debian did and patch in real /usr support in a few places in future. Signed-off-by: Sam James <sam@gentoo.org>
1 parent e29ecb9 commit c833a09

1 file changed

Lines changed: 42 additions & 2 deletions

File tree

crossdev

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,8 +1705,48 @@ LLVM="${LLVM}" emerge-wrapper --target ${CTARGET} --init || exit 1
17051705
### =/usr/lib/../lib64 when builds itself (see https://bugs.gentoo.org/652724)
17061706
###
17071707
### Thus we create non-symlinked layout early.
1708-
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/lib
1709-
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/usr/lib
1708+
if [[ ${CTARGET} == *-gnu* ]] ; then
1709+
# Identify if it is really Hurd or not
1710+
case ${CTARGET} in
1711+
*-linux*)
1712+
# Same as non-Hurd patch
1713+
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/lib
1714+
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/usr/lib
1715+
;;
1716+
i[3-7]86*-gnu*)
1717+
# Hurd is special as it defaults upstream to implicit inverse usr-merge
1718+
# (i.e. /usr -> /). If we don't do this here, then when we build
1719+
# cross glibc, startup files are in /usr/lib while libc.so is in
1720+
# /lib.
1721+
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/usr/lib
1722+
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/usr/bin
1723+
ln -s usr/lib "${EPREFIX}"/usr/${CTARGET}/lib
1724+
ln -s usr/bin "${EPREFIX}"/usr/${CTARGET}/bin
1725+
ln -s usr/bin "${EPREFIX}"/usr/${CTARGET}/sbin
1726+
ln -s bin "${EPREFIX}"/usr/${CTARGET}/usr/sbin
1727+
;;
1728+
x86_64-gnu)
1729+
# Hurd is special as it defaults upstream to implicit inverse usr-merge
1730+
# (i.e. /usr -> /). If we don't do this here, then when we build
1731+
# cross glibc, startup files are in /usr/lib64 while libc.so is in
1732+
# /lib64.
1733+
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/usr/lib{,64}
1734+
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/usr/bin
1735+
ln -s usr/lib "${EPREFIX}"/usr/${CTARGET}/lib
1736+
ln -s usr/lib64 "${EPREFIX}"/usr/${CTARGET}/lib64
1737+
ln -s usr/bin "${EPREFIX}"/usr/${CTARGET}/bin
1738+
ln -s usr/bin "${EPREFIX}"/usr/${CTARGET}/sbin
1739+
ln -s bin "${EPREFIX}"/usr/${CTARGET}/usr/sbin
1740+
;;
1741+
*)
1742+
die "Unknown Hurd target, please file a bug"
1743+
;;
1744+
esac
1745+
else
1746+
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/lib
1747+
xmkdir -p "${EPREFIX}"/usr/${CTARGET}/usr/lib
1748+
fi
1749+
17101750
###
17111751
### We need some special riscv sauce here similar as in baselayout. Ugly.
17121752
### step 1: set up all multilib libdirs

0 commit comments

Comments
 (0)