diff --git a/.gitignore b/.gitignore index 5b208c1..2e76102 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /images /linux /output +/.built /.prepared /.host-tools diff --git a/build.sh b/build.sh index 7f7e20e..37da754 100755 --- a/build.sh +++ b/build.sh @@ -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 \ diff --git a/config-portage.sh b/config-portage.sh index 4f1b5b1..64805f8 100755 --- a/config-portage.sh +++ b/config-portage.sh @@ -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 diff --git a/prepare.sh b/prepare.sh index 0d8158c..265306e 100755 --- a/prepare.sh +++ b/prepare.sh @@ -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}