Files
fempkg_recipes/lz4.recipe.py

40 lines
1.5 KiB
Python

# lz4.recipe.py
pkgname = "lz4"
pkgver = "1.10.0"
source = f"https://github.com/lz4/lz4/releases/download/v{pkgver}/lz4-{pkgver}.tar.gz"
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
f"mkdir -p {fembuilddir} && cd {fembuilddir} && tar -xvf /var/lib/fempkg/pkgs/{pkgname}-{pkgver}.tar.gz",
# 64-bit build
f"cd {builddir} && make BUILD_STATIC=no PREFIX=/usr -j$(nproc)",
f"cd {builddir} && make BUILD_STATIC=no PREFIX=/usr DESTDIR={destdir} install",
# Clean for 32-bit
f"cd {builddir} && make clean",
f"cd {builddir} && rm -f config.log",
# 32-bit build
f"cd {builddir} && CC=\"gcc -m32\" make BUILD_STATIC=no -j$(nproc)",
f"cd {builddir} && make BUILD_STATIC=no PREFIX=/usr LIBDIR=/usr/lib32 DESTDIR=$PWD/tmpdestdir install && mkdir -p {destdir}/usr/lib32 && "
f"cp -Rv $PWD/tmpdestdir/usr/lib32/* {destdir}/usr/lib32/",
f"install -v -d -m755 {destdir}/usr/share/licenses/{pkgname}/",
f"install -v -m644 {builddir}/LICENSE {destdir}/usr/share/licenses/{pkgname}/LICENSE",
# 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",
# Cleanup
f"rm -rf {fembuilddir}"
]