forked from FemboyOS/fempkg_recipes
32 lines
1.8 KiB
Python
32 lines
1.8 KiB
Python
pkgname = "nodejs"
|
|
pkgver = "22.21.1"
|
|
source = f"https://nodejs.org/dist/v{pkgver}/node-v{pkgver}.tar.xz"
|
|
builddir = f"/tmp/fempkg/build/{pkgname}/node-v{pkgver}"
|
|
fembuilddir = f"/tmp/fempkg/build/{pkgname}"
|
|
outputdir = "/home/gabry/lfs-repo/binpkg"
|
|
manifestdir = "/home/gabry/lfs-repo/manifests"
|
|
destdir = f"{fembuilddir}/DESTDIR"
|
|
deps = ["which", "brotli", "c-ares", "icu", "nghttp2"]
|
|
|
|
build = [
|
|
# Extract
|
|
f"mkdir /tmp/fempkg/build {fembuilddir} || true && cd {fembuilddir} && tar -xvf /var/lib/fempkg/pkgs/node-v{pkgver}.tar.xz && wget https://www.linuxfromscratch.org/patches/blfs/svn/node-v{pkgver}-python_build_fix-1.patch",
|
|
|
|
# 64-bit build
|
|
f"cd {builddir} && patch -Np1 -i ../node-v{pkgver}-python_build_fix-1.patch && ./configure --prefix=/usr --shared-brotli --shared-cares --shared-libuv --shared-openssl --shared-nghttp2 --shared-zlib --with-intl=system-icu",
|
|
f"cd {builddir} && make -j$(nproc)",
|
|
f"cd {builddir} && make DESTDIR={destdir} install && install -d -m 755 {destdir}/usr/share/doc && ln -sf node {destdir}/usr/share/doc/node-{pkgver}",
|
|
|
|
f"rm -rf {destdir}/usr/bin/{{npm,npx,corepack}} && for i in {{npm,npx}}; do ln -sf /lib/node_modules/npm/bin/$i-cli.js {destdir}/usr/bin/$i; done && "
|
|
f"ln -sf /lib/node_modules/corepack/dist/corepack.js {destdir}/usr/bin/corepack", # fix symlinks
|
|
|
|
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 {builddir} {fembuilddir}"
|
|
] |