Skip to content

Commit

Permalink
[figlet-musl-static] Use overlay ebuild with static USE flag
Browse files Browse the repository at this point in the history
- Before we set CFLAGS and LDFLAGS with `-static`, but because we
  these weren't tracked with an ebuild we had to ignore existing binary
  packages, causing it to always build a new binary package.
- I've added an ebuild with a static USE flag to my overlay, so now
  portage can track it and use an existing matching (static) binary
  package.
  • Loading branch information
berney committed Feb 11, 2025
1 parent a35fe9e commit e6e638c
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions images/figlet-musl-static/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
## This is an exercise in minimalism

# Don't set _packages so that baselayout won't be installed
PACKAGES_M="app-misc/figlet"
#PACKAGES_M="app-misc/figlet"
_packages="app-misc/figlet"

#
# this hook can be used to configure the build container itself, install packages, etc
Expand All @@ -16,6 +17,12 @@ configure_bob() {
configure_rootfs_build() {
# this runs in the builder, but as one of the last build steps the builder's /etc/passwd is copied to the custom root
useradd figlet

# Add our custom overlay
add_overlay berne https://github.com/berney/gentoo-overlay.git

update_use '+static-libs' '+minimal' '+static'

# Create home directory in custom root
# we don't need this for our purposes
#mkdir -p "${_EMERGE_ROOT}"/home/figlet
Expand All @@ -25,18 +32,18 @@ configure_rootfs_build() {
# We don't want to emerge the non-static binary package if it exists and emerge doesn't know not to because
# the use flags will be the same, so let's exclude the binary package so we always compile from source
# and hence honour our custom CFLAGS/CXXFLAGS/LDFLAGS
set -u
#set -u
#declare -p
CFLAGS="$(emerge --info|grep ^CFLAGS|grep -oP '(?<=").*(?=")') -static" \
CXXFLAGS=$CFLAGS \
LDFLAGS="$(emerge --info|grep LDFLAGS|grep -oP '(?<=").*(?=")') -static" \
"${_emerge_bin}" ${_emerge_opt} --binpkg-respect-use=y --usepkg-exclude="$PACKAGES_M" -v $PACKAGES_M
#CFLAGS="$(emerge --info|grep ^CFLAGS|grep -oP '(?<=").*(?=")') -static" \
#CXXFLAGS=$CFLAGS \
#LDFLAGS="$(emerge --info|grep LDFLAGS|grep -oP '(?<=").*(?=")') -static" \
#"${_emerge_bin}" ${_emerge_opt} --binpkg-respect-use=y --usepkg-exclude="$PACKAGES_M" -v $PACKAGES_M
# As we broke the normal builder chain, recreate the docs for the busybox image
init_docs "$PACKAGES_M"
#init_docs "$PACKAGES_M"
# XXX TODO would be nice to add/update fake USE flags +musl +static
#update_use "$PACKAGES_M" "+musl +static"
generate_doc_package_installed "$PACKAGES_M"
set +u
#generate_doc_package_installed "$PACKAGES_M"
#set +u
}

#
Expand Down

0 comments on commit e6e638c

Please sign in to comment.