Femboyos 2 full rewrite full working CI
This commit is contained in:
132
glibc.recipe.py
Normal file
132
glibc.recipe.py
Normal file
@@ -0,0 +1,132 @@
|
||||
# glibc.recipe.py
|
||||
pkgname = "glibc"
|
||||
pkgver = "2.42"
|
||||
atomic = True
|
||||
source = f"https://ftpmirror.gnu.org/gnu/glibc/glibc-{pkgver}.tar.xz"
|
||||
builddir = f"/tmp/fempkg/build/{pkgname}/{pkgname}-{pkgver}"
|
||||
fembuilddir = f"/tmp/fempkg/build/{pkgname}"
|
||||
outputdir = "/home/gabry/lfs-repo/binpkg"
|
||||
manifestdir = "/home/gabry/lfs-repo/manifests"
|
||||
destdir = f"{fembuilddir}/DESTDIR"
|
||||
deps = []
|
||||
|
||||
build = [
|
||||
# Extract tarball
|
||||
f"mkdir -p {fembuilddir} && cd {fembuilddir} && tar -xvf /var/lib/fempkg/pkgs/{pkgname}-{pkgver}.tar.xz && wget "
|
||||
f"https://www.linuxfromscratch.org/patches/lfs/development/glibc-{pkgver}-fhs-1.patch "
|
||||
f"https://www.iana.org/time-zones/repository/releases/tzdata2025b.tar.gz https://www.linuxfromscratch.org/patches/lfs/development/glibc-"
|
||||
f"{pkgver}-upstream_fixes-1.patch",
|
||||
|
||||
# Apply patches
|
||||
f"cd {builddir} && patch -Np1 -i ../glibc-{pkgver}-upstream_fixes-1.patch",
|
||||
f"cd {builddir} && patch -Np1 -i ../glibc-{pkgver}-fhs-1.patch",
|
||||
|
||||
# sed fix (operate inside source tree)
|
||||
|
||||
f"cd {builddir} && " # DONT REMOVE THE ADDITIONAL SPACES (idk if important but it works so KEEP IT AAAAA)
|
||||
f"sed -i -e '/unistd.h/i #include <string.h>' -e '/libc_rwlock_init/c\\ __libc_rwlock_define_initialized (, reset_lock);\\ "
|
||||
f"memcpy (&lock, &reset_lock, sizeof (lock));' stdlib/abort.c",
|
||||
|
||||
# Create 64-bit build dir & configure
|
||||
f"cd {builddir} && mkdir -v build",
|
||||
f"cd {builddir}/build && echo 'rootsbindir=/usr/sbin' > configparms",
|
||||
(
|
||||
f"cd {builddir}/build && ../configure --prefix=/usr "
|
||||
"--disable-werror --disable-nscd libc_cv_slibdir=/usr/lib "
|
||||
"--enable-stack-protector=strong --enable-kernel=5.4"
|
||||
),
|
||||
|
||||
# Build 64-bit
|
||||
f"cd {builddir}/build && make -j$(nproc)",
|
||||
|
||||
# Prevent the installation test script from aborting install (adjust Makefile)
|
||||
# edit the top-level Makefile (one dir up from build)
|
||||
f"cd {builddir}/build && sed '/test-installation/s@\\$(PERL)@echo not running@' -i ../Makefile",
|
||||
|
||||
# Install 64-bit
|
||||
f"cd {builddir}/build && make DESTDIR={destdir} install",
|
||||
|
||||
# fix ldd RTLDLIST edit (as in LFS instructions)
|
||||
f"sed '/RTLDLIST=/s@/usr@@g' -i {destdir}/usr/bin/ldd",
|
||||
|
||||
# Install locales from the build dir (objdir must be set)
|
||||
f"cd {builddir}/build && make DESTDIR={destdir} localedata/install-locales ",
|
||||
|
||||
f"mkdir -pv {destdir}/etc",
|
||||
# Create nsswitch.conf (heredoc)
|
||||
f"""cat > {destdir}/etc/nsswitch.conf << "EOF"
|
||||
passwd: files
|
||||
group: files
|
||||
shadow: files
|
||||
|
||||
hosts: files dns
|
||||
networks: files
|
||||
|
||||
protocols: files
|
||||
services: files
|
||||
ethers: files
|
||||
rpc: files
|
||||
EOF""",
|
||||
|
||||
# Timezone setup: ensure ZONEINFO is exported for the whole block and run in /sourc
|
||||
# Timezone setup: ensure we stay in /sources
|
||||
(
|
||||
f"mkdir -pv {builddir}/localodoto && cd {builddir}/localodoto && tar -xf ../../tzdata2025b.tar.gz && mkdir -pv {destdir}/usr/share/licenses/tzdata/ && cp -pv LICENSE {destdir}/usr/share/licenses/tzdata/ && "
|
||||
f"ZONEINFO={destdir}/usr/share/zoneinfo && "
|
||||
"mkdir -pv $ZONEINFO/{posix,right} && "
|
||||
|
||||
# Compile all timezones into DESTDIR
|
||||
"for tz in etcetera southamerica northamerica europe africa antarctica asia australasia backward; do "
|
||||
" zic -L /dev/null -d $ZONEINFO ${tz}; "
|
||||
" zic -L /dev/null -d $ZONEINFO/posix ${tz}; "
|
||||
" zic -L leapseconds -d $ZONEINFO/right ${tz}; "
|
||||
"done && "
|
||||
|
||||
# Copy metadata files (zone.tab etc.) to DESTDIR
|
||||
f"cp -v zone.tab zone1970.tab iso3166.tab {destdir}/usr/share/zoneinfo && "
|
||||
|
||||
# Set default timezone inside DESTDIR (not host system!)
|
||||
f"zic -d {destdir}/usr/share/zoneinfo -p America/New_York && "
|
||||
|
||||
# Install the default /etc/localtime into DESTDIR
|
||||
f"mkdir -p {destdir}/etc && "
|
||||
f"ln -sfv ../usr/share/zoneinfo/Europe/Rome {destdir}/etc/localtime"
|
||||
),
|
||||
|
||||
|
||||
f"mkdir -pv {destdir}/etc/ld.so.conf.d",
|
||||
|
||||
# --- 32-bit Glibc build (do this inside the same build dir) ---
|
||||
# clean objdir but keep source tree
|
||||
f"cd {builddir}/build && rm -rf ./*",
|
||||
f"cd {builddir}/build && find .. -name '*.a' -delete",
|
||||
|
||||
# configure 32-bit build from build dir (use CC/CXX -m32)
|
||||
(
|
||||
f"cd {builddir}/build && "
|
||||
"CC=\"gcc -m32\" CXX=\"g++ -m32\" ../configure "
|
||||
"--prefix=/usr "
|
||||
"--host=i686-pc-linux-gnu "
|
||||
"--build=$(../scripts/config.guess) "
|
||||
"--libdir=/usr/lib32 "
|
||||
"--libexecdir=/usr/lib32 "
|
||||
"--disable-werror "
|
||||
"--disable-nscd "
|
||||
"libc_cv_slibdir=/usr/lib32 "
|
||||
"--enable-stack-protector=strong "
|
||||
"--enable-kernel=5.4"
|
||||
),
|
||||
|
||||
|
||||
# build & install 32-bit into DESTDIR then copy files to root locations
|
||||
f"cd {builddir}/build && make -j$(nproc)",
|
||||
f"cd {builddir}/build && make DESTDIR={destdir} install",
|
||||
|
||||
f"install -v -d -m755 {destdir}/usr/share/licenses/{pkgname}/",
|
||||
f"install -v -m644 {builddir}/COPYING.LIB {destdir}/usr/share/licenses/{pkgname}/COPYING.LIB",
|
||||
f"install -v -m644 {builddir}/COPYING {destdir}/usr/share/licenses/{pkgname}/COPYING",
|
||||
|
||||
# Make tarball + manifests
|
||||
f"mkdir -p {outputdir} && cd {destdir} && tar --transform 's|^\\.||' -I zstd -cf {outputdir}/{pkgname}-{pkgver}.tar.zst .",
|
||||
f"mkdir -p {manifestdir} && tar -tf {outputdir}/{pkgname}-{pkgver}.tar.zst | grep -v '/$' > {manifestdir}/{pkgname}.txt",
|
||||
]
|
||||
Reference in New Issue
Block a user