Commit 80269cd2 authored by jan.koester's avatar jan.koester
Browse files

build-chroot.sh: desktop stack and desktop ISO; tzdata, glib2's libffi/pcre2

PACKAGES: bzip2, libffi and pcre2 before glib2 (it uses the system
libffi and pcre2 now), tzdata before syslite (syslite requires it).

DESKTOP_PACKAGES (built after PACKAGES): pkgconf, python3-modules, the
GTK 3 stack, alsa-lib, dejavu-fonts, xpara, FeMan, MePlay, deskctl,
cbindgen, Node.js and Firefox. xpara/feman/meplay/deskctl sources come
from *_SRC checkouts or clones of their pushed repositories.

ISO_VARIANTS gains desktop (default: server devel desktop): server and
devel leave out every package built from DESKTOP_PACKAGES' specs,
desktop is the server selection plus them, without their build tools
(ISO_DESKTOP_TOOLS: cbindgen nodejs python3-modules pkgconf). The
fenriros-devel docker image leaves the desktop out too.

Co-Authored-By: default avatarClaude Opus 5.5 <noreply@anthropic.com>
parent a5bc3cef
Loading
Loading
Loading
Loading
+62 −17
Changes for build-chroot.sh: 62 added lines, 17 removed lines.
Original line number Diff line number Diff line
@@ -46,6 +46,10 @@
#   ISCSID_SRC    iscsid checkout            (default: ../iscsid if it exists, else a clone of ISCSID_REPO)
#   UPSD_SRC      upsd checkout              (default: ../upsd if it exists, else a clone of UPSD_REPO)
#   FIREWALLD_SRC firewalld checkout         (default: ../firewalld if it exists, else a clone of FIREWALLD_REPO)
#   XPARA_SRC/FEMAN_SRC/MEPLAY_SRC/DESKCTL_SRC  the desktop's own programs (default: clones of
#                 XPARA_REPO/FEMAN_REPO/MEPLAY_REPO/DESKCTL_REPO, i.e. what is pushed)
#   DESKTOP_PACKAGES  the desktop stack built after PACKAGES (GTK 3, xpara, Firefox, ...);
#                 empty: no desktop
#   MAKEPLUS_REPO makeplus git repository    (default: git@git.tuxist.de:tuxist/makeplus.git)
#   MAKEPLUS_REF  makeplus branch/tag        (default: the repository's default branch)
#   CMAKE_REF     cmake git tag              (default: v4.4.3)
@@ -57,7 +61,8 @@
#                 host:/srv/www/fenriros (served as https://repo.tuxist.de/fenriros; default: none)
#   ISO_NAME/ISO_TITLE/ISO_VOLID/ISO_HOSTNAME  naming of the live ISOs (the variant
#                 is appended: <ISO_NAME>-server.iso, "<ISO_TITLE> server", <ISO_VOLID>_SERVER)
#   ISO_VARIANTS  ISOs the 'iso' step builds (default: server devel)
#   ISO_VARIANTS  ISOs the 'iso' step builds (default: server devel desktop); server and
#                 devel leave out the DESKTOP_PACKAGES, desktop is server plus them
#   ISO_DEVEL_TOOLS  packages besides *-dev, *-devel, *-headers left out of the server ISO
#                 (default: clang lld lldb llvm-project llvm-tools cmake ninja makeplus dwarves createrepo_c)
#   ISO_DEVEL_PATHS  paths not installed on the server ISO besides *.a, *.la and perl's CORE/
@@ -136,6 +141,10 @@ ISCSID_REPO="${ISCSID_REPO:-git@tuxist.de:tuxist/iscsid.git}"
UPSD_REPO="${UPSD_REPO:-git@git.tuxist.de:tuxist/upsd.git}"
FIREWALLD_REPO="${FIREWALLD_REPO:-git@git.tuxist.de:tuxist/firewalld.git}"
WEBCTL_REPO="${WEBCTL_REPO:-git@git.tuxist.de:tuxist/webctl.git}"
XPARA_REPO="${XPARA_REPO:-git@git.tuxist.de:tuxist/xpara.git}"
FEMAN_REPO="${FEMAN_REPO:-git@git.tuxist.de:tuxist/feman.git}"
MEPLAY_REPO="${MEPLAY_REPO:-git@git.tuxist.de:tuxist/meplay.git}"
DESKCTL_REPO="${DESKCTL_REPO:-ssh://git@git.tuxist.de/tuxist/deskctl.git}"
TUXIST_GIT="${TUXIST_GIT:-https://git.tuxist.de/git}"
# Specs whose local sources live in a differently named files/<dir>
declare -A FILES_DIRS=(
@@ -1370,6 +1379,15 @@ stage_sources() {
                              fetch_git "$WORK/src/upsd" "$UPSD_REPO"
                              tar_tree "$WORK/src/upsd" "$srcdir/$f" "$name-$version"
                          fi; continue ;;
                # the desktop's programs: a checkout (*_SRC) or the pushed repository
                xpara|feman|meplay|deskctl)
                          local var="${pkg^^}_SRC" rvar="${pkg^^}_REPO"
                          if [[ -n ${!var:-} ]]; then
                              tar_tree "${!var}" "$srcdir/$f" "$name-$version"
                          else
                              fetch_git "$WORK/src/$pkg" "${!rvar}"
                              tar_tree "$WORK/src/$pkg" "$srcdir/$f" "$name-$version"
                          fi; continue ;;
                firewalld) if [[ -n ${FIREWALLD_SRC:-} ]]; then
                              tar_tree "$FIREWALLD_SRC" "$srcdir/$f" "$name-$version"
                          else
@@ -1436,10 +1454,15 @@ stage_sources() {
# which this chroot doesn't have (its rpm dependencies are in /usr).
PACKAGES="${PACKAGES:-zlib zstd popt lua file systempp libressl libelf rpm fresh makeplus libbpf bpftool ninja cmake python3 llvm-project
    ca-certificates ncurses libjson-c libbrotli libcmdplus libuuidp libnetplus libhtmlpp libconfplus libhttppp libparitypp
    libauthdb-client libmediadb-client libsmtppp libimappp mammut libdbpp liblzma libxml2 libarchive glib2 curl libsolv librepo fmt toml11 libsmartcols dnf5 createrepo_c 
    fenriros-release proxyplus openssh dosfstools e2fsprogs gptfdisk syslite sharedd adconnect storaged iscsid upsd firewalld tinyxml2 snmpdd ntpplus containerd webctl limine perl rsync
    libauthdb-client libmediadb-client libsmtppp libimappp mammut libdbpp liblzma libxml2 libarchive bzip2 libffi pcre2 glib2 curl libsolv librepo fmt toml11 libsmartcols dnf5 createrepo_c 
    fenriros-release proxyplus openssh dosfstools e2fsprogs gptfdisk tzdata syslite sharedd adconnect storaged iscsid upsd firewalld tinyxml2 snmpdd ntpplus containerd webctl limine perl rsync
    nasm libwebp x264 x265 libaom ffmpeg
    fenriros-installer dwarves mrustc rust kernel systrace}"
# the xpara desktop: built after PACKAGES (they need rust, ffmpeg, glib2, ...),
# in the repository, only on the desktop ISO (glib2 needs libffi and pcre2,
# which therefore are in PACKAGES)
DESKTOP_PACKAGES="${DESKTOP_PACKAGES-pkgconf python3-modules expat libpng pixman freetype harfbuzz fontconfig fribidi
    cairo pango gdk-pixbuf atk libepoxy gtk3 alsa-lib dejavu-fonts xpara feman meplay deskctl cbindgen nodejs firefox}"

# rpmbuild's automatic Provides/Requires (libc.so.1()(64bit), ...) need
# libmagic to classify files as ELF. If it can't load its database,
@@ -1464,14 +1487,14 @@ step_packages() {
    local pkg spec log ok=() skipped=() failed=()
    mkdir -p "$LOGS/packages"
    
    for pkg in $PACKAGES; do
    for pkg in $PACKAGES $DESKTOP_PACKAGES; do
        spec="$FENRIR_FILES/rpm/specs/$pkg.spec"
        [[ -f $spec ]] || die "no spec $spec"
        cp "$spec" "$CHROOT/build/rpmbuild/SPECS/"
        stage_sources "$spec"
    done
    
    for pkg in $PACKAGES; do
    for pkg in $PACKAGES $DESKTOP_PACKAGES; do
        log="$LOGS/packages/$pkg.log"
        
        # Prüfen, ob bereits ein gültiges RPM für dieses Paket existiert
@@ -1606,7 +1629,9 @@ ISO_REQUIRED="systempp fresh syslite kernel limine"
# the headers, static libraries and pkg-config/cmake files of the packages
# that have no -dev subpackage (ISO_DEVEL_PATHS, plus every *.a and *.la);
# devel: all
ISO_VARIANTS="${ISO_VARIANTS:-server devel}"
ISO_VARIANTS="${ISO_VARIANTS:-server devel desktop}"
# build tools among the desktop packages: not on the desktop ISO either
ISO_DESKTOP_TOOLS="${ISO_DESKTOP_TOOLS:-cbindgen nodejs python3-modules pkgconf}"
ISO_DEVEL_TOOLS="${ISO_DEVEL_TOOLS:-clang lld lldb llvm-project llvm-tools cmake ninja makeplus dwarves createrepo_c rust cargo mrustc}"
ISO_DEVEL_PATHS="${ISO_DEVEL_PATHS:-/usr/include /usr/lib/pkgconfig /usr/share/pkgconfig /usr/lib/cmake /usr/share/cmake /usr/share/aclocal}"

@@ -1659,26 +1684,37 @@ step_iso() {
        compgen -G "$rpmdir/*/$p-[0-9]*.rpm" >/dev/null || die "no $p RPM -- build it with the 'packages' step first"
    done
    for v in $ISO_VARIANTS; do
        case $v in server|devel) ;; *) die "unknown ISO variant '$v' (ISO_VARIANTS: server devel)" ;; esac
        case $v in server|devel|desktop) ;; *) die "unknown ISO variant '$v' (ISO_VARIANTS: server devel desktop)" ;; esac
    done
    fetch_git "$WORK/src/limine" https://github.com/limine-bootloader/limine.git "$LIMINE_REF"
    run iso "$HOST_CC" -O2 -std=c99 -o "$BUILD/limine-host" "$WORK/src/limine/limine.c"

    newest_rpms iso-rpms
    # the binary packages built from DESKTOP_PACKAGES' specs (gtk3-devel,
    # xpara-devel, ... included): only the desktop ISO takes them
    in_chroot /bin/sh -c 'rpm -qp --qf "%{NAME} %{SOURCERPM}\n" $(cat /build/rpmbuild/iso-rpms) 2>/dev/null' |
        awk -v ds=" $(echo $DESKTOP_PACKAGES) " '{ src = $2; sub(/-[^-]+-[^-]+\.src\.rpm$/, "", src)
            if (index(ds, " " src " ")) print $1 }' >"$CHROOT/build/rpmbuild/iso-desktop-names"
    for v in $ISO_VARIANTS; do iso_image "$v"; done
}

# iso_image <server|devel> -- $WORK/<ISO_NAME>-<variant>.iso
# iso_image <server|devel|desktop> -- $WORK/<ISO_NAME>-<variant>.iso
iso_image() {
    local v="$1" d="$CHROOT/build/rpmbuild" p
    local root="$CHROOT/build/iso-root-$v" iso="$WORK/iso-$v" out="$WORK/$ISO_NAME-$v.iso"
    local title="$ISO_TITLE $v" volid="${ISO_VOLID}_${v^^}"

    if [[ $v = server ]]; then
        # iso-candidates: "name evr path" of every RPM, iso-rpms the newest paths
        awk -v ex=" $ISO_DEVEL_TOOLS " 'NR == FNR { keep[$1]; next }
            ($3 in keep) && $1 !~ /-(dev|devel|headers)$/ && index(ex, " " $1 " ") == 0 { print $3 }' \
            "$d/iso-rpms" "$d/iso-candidates" >"$d/iso-rpms-$v"
    if [[ $v = server || $v = desktop ]]; then
        # iso-candidates: "name evr path" of every RPM, iso-rpms the newest
        # paths, iso-desktop-names the desktop stack's packages (server: none
        # of them, desktop: all but their build tools)
        local ex=" $ISO_DEVEL_TOOLS " nodesk=1
        [[ $v = desktop ]] && { ex+="$ISO_DESKTOP_TOOLS "; nodesk=0; }
        awk -v ex="$ex" -v nodesk=$nodesk 'FILENAME ~ /iso-desktop-names$/ { desk[$1]; next }
            NR == FNR { keep[$1]; next }
            ($3 in keep) && $1 !~ /-(dev|devel|headers)$/ && index(ex, " " $1 " ") == 0 &&
            !(nodesk && ($1 in desk)) { print $3 }' \
            "$d/iso-rpms" "$d/iso-desktop-names" "$d/iso-candidates" >"$d/iso-rpms-$v"
        for p in $ISO_REQUIRED; do
            grep -q "/$p-[0-9][^/]*\.rpm$" "$d/iso-rpms-$v" || die "iso: $p filtered out of the server ISO -- check ISO_DEVEL_TOOLS"
        done
@@ -1688,7 +1724,11 @@ iso_image() {
              grep -E '\.l?a$|/perl5/.*/CORE$'
        } | sort -u >"$d/iso-exclude-$v"
    else
        cp "$d/iso-rpms" "$d/iso-rpms-$v"
        # devel: every package but the desktop stack
        awk 'FILENAME ~ /iso-desktop-names$/ { desk[$1]; next }
            NR == FNR { keep[$1]; next }
            ($3 in keep) && !($1 in desk) { print $3 }' \
            "$d/iso-rpms" "$d/iso-desktop-names" "$d/iso-candidates" >"$d/iso-rpms-$v"
        : >"$d/iso-exclude-$v"
    fi

@@ -1914,9 +1954,14 @@ step_docker() {
    rpm_closure docker-all docker-minimal $DOCKER_MINIMAL
    docker_image fenriros docker-minimal

    awk -v ex=" $DOCKER_DEVEL_EXCLUDE " 'NR == FNR { keep[$1]; next }
        ($3 in keep) && index(ex, " " $1 " ") == 0 { print $3 }' \
        "$d/docker-all" "$d/iso-candidates" > "$d/docker-devel"
    # without the desktop stack, like the devel ISO
    in_chroot /bin/sh -c 'rpm -qp --qf "%{NAME} %{SOURCERPM}\n" $(cat /build/rpmbuild/docker-all) 2>/dev/null' |
        awk -v ds=" $(echo $DESKTOP_PACKAGES) " '{ src = $2; sub(/-[^-]+-[^-]+\.src\.rpm$/, "", src)
            if (index(ds, " " src " ")) print $1 }' >"$d/docker-desktop-names"
    awk -v ex=" $DOCKER_DEVEL_EXCLUDE " 'FILENAME ~ /docker-desktop-names$/ { desk[$1]; next }
        NR == FNR { keep[$1]; next }
        ($3 in keep) && index(ex, " " $1 " ") == 0 && !($1 in desk) { print $3 }' \
        "$d/docker-all" "$d/docker-desktop-names" "$d/iso-candidates" > "$d/docker-devel"
    docker_image fenriros-devel docker-devel

    msg "docker images ready: ${DOCKER_PREFIX}fenriros and ${DOCKER_PREFIX}fenriros-devel :$DOCKER_TAG (tarballs: $WORK/docker)"