mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-27 08:31:04 +02:00
Merge pull request #323 from marineam/gcc
Make ldconfig not matter so much
This commit is contained in:
commit
30372ccf9a
@ -145,10 +145,23 @@ write_contents() {
|
||||
# Generate a list of installed packages in the format:
|
||||
# sys-apps/systemd-212-r8::coreos
|
||||
write_packages() {
|
||||
local profile="${BUILD_DIR}/configroot/etc/portage/profile"
|
||||
info "Writing ${2##*/}"
|
||||
ROOT="$1" equery-$BOARD --no-color \
|
||||
list '*' --format '$cpv::$repo' \
|
||||
> "$2"
|
||||
if [[ -f "${profile}/package.provided" ]]; then
|
||||
cat "${profile}/package.provided" >> "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
# Add an entry to the image's package.provided
|
||||
package_provided() {
|
||||
local p profile="${BUILD_DIR}/configroot/etc/portage/profile"
|
||||
for p in "$@"; do
|
||||
info "Writing $p to package.provided"
|
||||
echo "$p" >> "${profile}/package.provided"
|
||||
done
|
||||
}
|
||||
|
||||
start_image() {
|
||||
@ -159,8 +172,10 @@ start_image() {
|
||||
|
||||
local disk_img="${BUILD_DIR}/${image_name}"
|
||||
|
||||
mkdir -p "${BUILD_DIR}"/configroot/etc/portage
|
||||
ln -s "${BOARD_ROOT}"/etc/portage/* \
|
||||
mkdir -p "${BUILD_DIR}"/configroot/etc/portage/profile
|
||||
ln -s "${BOARD_ROOT}"/etc/portage/make.* \
|
||||
"${BOARD_ROOT}"/etc/portage/package.* \
|
||||
"${BOARD_ROOT}"/etc/portage/repos.conf \
|
||||
"${BUILD_DIR}"/configroot/etc/portage/
|
||||
|
||||
info "Using image type ${disk_layout}"
|
||||
|
@ -5,24 +5,24 @@
|
||||
|
||||
# The GCC package includes both its libraries and the compiler.
|
||||
# In prod images we only need the shared libraries.
|
||||
emerge_prod_gcc() {
|
||||
extract_prod_gcc() {
|
||||
local root_fs_dir="$1"; shift
|
||||
local mask="${INSTALL_MASK:-$(portageq-$BOARD envvar INSTALL_MASK)}"
|
||||
test -n "$mask" || die "INSTALL_MASK not defined"
|
||||
local gcc=$(portageq-${BOARD} best_version "${BOARD_ROOT}" sys-devel/gcc)
|
||||
local pkg="$(portageq-${BOARD} pkgdir)/${gcc}.tbz2"
|
||||
|
||||
mask="${mask}
|
||||
/usr/bin
|
||||
/usr/*/gcc-bin
|
||||
/usr/lib/gcc/*/*/*.o
|
||||
/usr/lib/gcc/*/*/include
|
||||
/usr/lib/gcc/*/*/include-fixed
|
||||
/usr/lib/gcc/*/*/plugin
|
||||
/usr/libexec
|
||||
/usr/share/gcc-data/*/*/c89
|
||||
/usr/share/gcc-data/*/*/c99
|
||||
/usr/share/gcc-data/*/*/python"
|
||||
if [[ ! -f "${pkg}" ]]; then
|
||||
die "Binary package missing: $pkg"
|
||||
fi
|
||||
|
||||
INSTALL_MASK="${mask}" emerge_to_image "${root_fs_dir}" --nodeps sys-devel/gcc "$@"
|
||||
# Normally GCC's shared libraries are installed to:
|
||||
# /usr/lib/gcc/x86_64-cros-linux-gnu/$version/*
|
||||
# Instead we extract them to plain old /usr/lib
|
||||
qtbz2 -O -t "${pkg}" | \
|
||||
sudo tar -C "${root_fs_dir}" -xj \
|
||||
--transform 's#/usr/lib/.*/#/usr/lib/#' \
|
||||
--wildcards './usr/lib/gcc/*.so*'
|
||||
|
||||
package_provided "${gcc}"
|
||||
}
|
||||
|
||||
create_prod_image() {
|
||||
@ -39,7 +39,7 @@ create_prod_image() {
|
||||
|
||||
# Install minimal GCC (libs only) and then everything else
|
||||
set_image_profile prod
|
||||
emerge_prod_gcc "${root_fs_dir}"
|
||||
extract_prod_gcc "${root_fs_dir}"
|
||||
emerge_to_image "${root_fs_dir}" coreos-base/coreos
|
||||
write_packages "${root_fs_dir}" "${BUILD_DIR}/${image_packages}"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user