Improve handling of circular dependencies

Several packages end up with circular dependencies, depending on which
Portage profile is selected.  The default profiles have a circular
dependency between *sys-libs/pam* and *sys-libs/libcap*.  Systemd and
SELinux profiles have even more issues.

We can break the circular dependencies by explicitly building *libcap*
with`USE=-pam` first, which happens to be the default configuration
generated by `crossdev`.  Then, we need to switch to a more complete
profile in order to build *glibc* and *util-linux*.  At this point, the
build root should be complete enough to build anything without circular
dependencies.
gentoo
Dustin 2023-02-21 09:47:38 -06:00
parent 50b20eee8c
commit a8ccbe45a0
4 changed files with 32 additions and 11 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
/images
/linux
/output
/.built
/.prepared
/.host-tools

View File

@ -5,10 +5,7 @@ set -e
. ./config
USE=-pam \
${target}-emerge -1nvj --nodeps sys-libs/libcap
USE='-cramfs -ncurses -nls -pam -readline -su -suid -systemd -udev' \
${target}-emerge -1nvj --nodeps sys-apps/util-linux
${target}-emerge -vuUDj sys-apps/util-linux
${target}-emerge -vnuUDj \
net-misc/openssh \

View File

@ -7,3 +7,8 @@ set -e
cp -r host-portage/. /etc/portage/
cp -r portage/. /usr/${target}/etc/portage/
# Set the Portage profile
ln -snf \
/var/db/repos/gentoo/profiles/${profile} \
/usr/${target}/etc/portage/make.profile

View File

@ -10,14 +10,26 @@ if [ ! -f /var/db/repos/gentoo/metadata/timestamp ]; then
emerge-webrsync
fi
# Migrate to the merged-usr layout
mkdir -p /usr/${target}/bin
emerge -bknv --quiet-build=y merge-usr
merge-usr --root=/usr/${target}
ARCH=$(PORTAGE_CONFIGROOT=/usr/${target} portageq envvar ARCH)
# For some reason, libcap installs its pkg-config files in the wrong
# place. More strangely, even though `PKG_CONFIG_PATH` contains that
# directory, `pkg-config` does not find the `.pc` files for libcap.
# We work around this by merging /usr/lib64/pkgconfig and
# /usr/lib/pkgconfig.
${target}-emerge -bk1vnj sys-libs/libcap
if [ -d /usr/${target}/usr/lib/pkgconfig ] \
&& [ ! -d /usr/${target}/usr/lib64/pkgconfig ]; then
mv /usr/${target}/usr/lib/pkgconfig /usr/${target}/usr/lib64
ln -snf ../lib64/pkgconfig /usr/${target}/usr/lib/pkgconfig
fi
if [ ! -d /usr/${target}/etc/portage/make.conf ]; then
mv /usr/${target}/etc/portage/make.conf \
/usr/${target}/etc/portage/make.conf.orig
sed -ri 's: ?-pam::' /usr/${target}/etc/portage/make.conf.orig
ls -l /usr/${target}/etc/portage
mkdir /usr/${target}/etc/portage/make.conf
mv /usr/${target}/etc/portage/make.conf.orig \
/usr/${target}/etc/portage/make.conf/10-base.conf
@ -31,8 +43,14 @@ if [ ! -d /etc/portage/make.conf ]; then
/etc/portage/make.conf/10-base.conf
fi
# Set the Portage profile
ln -snf \
/var/db/repos/gentoo/profiles/${profile} \
ln -snf /var/db/repos/gentoo/profiles/default/linux/${ARCH}/17.0 \
/usr/${target}/etc/portage/make.profile
${target}-emerge -bk1nvj sys-libs/glibc
${target}-emerge -bknvj sys-apps/util-linux
# Migrate to the merged-usr layout
mkdir -p /usr/${target}/bin
emerge -bknv --quiet-build=y merge-usr
merge-usr --root=/usr/${target}