In effort to support different builds of Aimee OS using the same scripts, without necessarily having to fork this repository, the build system now supports a `CONFIGDIR` setting. When this variable is set, files defining the target environment, such as the lists of packages to install, the kernel configuration, the Portage configuration, etc. are found in the path it specifes. The reference build, for the Home Assistant Yellow board, is configured in the `yellow` directory. To build it, run: ```sh CONFIGDIR=yellow ./vm-build.sh ```
65 lines
1.9 KiB
Bash
Executable File
65 lines
1.9 KiB
Bash
Executable File
#!/bin/sh
|
|
# vim: set sw=4 ts=4 sts=4 et :
|
|
|
|
set -e
|
|
|
|
. "${CONFIGDIR:=${PWD}}"/config
|
|
|
|
# Ensure we have a Portage repo
|
|
if [ ! -f /var/db/repos/gentoo/metadata/timestamp ]; then
|
|
emerge-webrsync
|
|
fi
|
|
|
|
chown portage: "$(portageq envvar DISTDIR)"
|
|
|
|
ARCH=$(PORTAGE_CONFIGROOT=/usr/${target} portageq envvar ARCH)
|
|
PKGDIR=$(portageq envvar PKGDIR)
|
|
FEATURES="${FEATURES} binpkg-multi-instance"
|
|
|
|
# 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.
|
|
FEATURES="${FEATURES}" \
|
|
PKGDIR="${PKGDIR}" \
|
|
${target}-emerge -kb1vnj 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 [ ! -f portage/make.conf/10-crossdev.conf ]; then
|
|
sed -r \
|
|
-e 's: ?-pam::' \
|
|
-e '/PKGDIR=/d' \
|
|
/usr/${target}/etc/portage/make.conf \
|
|
> "${CONFIGDIR}"/portage/target/etc/portage/make.conf/10-crossdev.conf
|
|
fi
|
|
|
|
ln -snf /var/db/repos/gentoo/profiles/default/linux/${ARCH}/17.0 \
|
|
/usr/${target}/etc/portage/make.profile
|
|
|
|
FEATURES="${FEATURES}" \
|
|
PKGDIR="${PKGDIR}" \
|
|
${target}-emerge -bk1nvj sys-libs/glibc
|
|
|
|
FEATURES="${FEATURES}" \
|
|
PKGDIR=$(portageq envvar PKGDIR) \
|
|
USE=pam \
|
|
${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}
|
|
|
|
# Set the Portage profile
|
|
ln -snf \
|
|
/var/db/repos/gentoo/profiles/${profile} \
|
|
${CONFIGDIR}/portage/target/etc/portage/make.profile
|
|
ln -snf \
|
|
$(realpath /etc/portage/make.profile) \
|
|
${CONFIGDIR}/portage/host/etc/portage/make.profile
|