Files
fempkg_recipes/rustc.recipe.py
2026-01-22 18:29:31 +01:00

50 lines
2.7 KiB
Python

pkgname = "rustc" # TODO WEN UPDATING VERSION, RENEW BOOTSTRAP.TOML!!!!!
pkgver = "1.92.0"
source = f"https://static.rust-lang.org/dist/rustc-{pkgver}-src.tar.xz"
builddir = f"/tmp/fempkg/build/{pkgname}/{pkgname}-{pkgver}-src"
fembuilddir = f"/tmp/fempkg/build/{pkgname}"
outputdir = "/home/gabry/lfs-repo/binpkg"
manifestdir = "/home/gabry/lfs-repo/manifests"
destdir = f"{fembuilddir}/DESTDIR"
exports = "export LIBSSH2_SYS_USE_PKG_CONFIG=1 && export LIBSQLITE3_SYS_USE_PKG_CONFIG=1"
deps = ["cmake", "curl", "libssh2", "llvm"]
build = [
# Extract
f"mkdir /tmp/fempkg/build {fembuilddir} || true && cd {fembuilddir} && tar -xvf /var/lib/fempkg/pkgs/{pkgname}-{pkgver}-src.tar.xz",
# 64-bit build
f"cd {builddir} && mkdir -pv {destdir}/opt/rustc-{pkgver} && ln -svfn rustc-{pkgver} {destdir}/opt/rustc",
f"cd {builddir} && wget https://rocketleaguechatp.duckdns.org/bootstrap.toml",
f"cd {builddir} && {exports} && ./x.py build",
f"cd {builddir} && {exports} && DESTDIR={destdir} ./x.py install",
f"cd {builddir} && {exports} && rm -fv {destdir}/opt/rustc-{pkgver}/share/doc/rustc-{pkgver}/*.old",
f"mkdir -p {destdir}/opt/rustc-{pkgver}/share/doc/rustc-{pkgver}/",
f"cd {builddir} && {exports} && install -vm644 README.md {destdir}/opt/rustc-{pkgver}/share/doc/rustc-{pkgver}/README.md",
f"cd {builddir} && {exports} && install -vdm755 {destdir}/usr/share/zsh/site-functions",
f"cd {builddir} && {exports} && install -vdm755 {destdir}/usr/share/bash-completion/completions",
f"cd {builddir} && {exports} && ln -sfv {destdir}/opt/rustc/share/zsh/site-functions/_cargo {destdir}/usr/share/zsh/site-functions",
f"cd {builddir} && {exports} && mv -v {destdir}/etc/bash_completion.d/cargo {destdir}/usr/share/bash-completion/completions",
# Create license directory
f"install -v -d -m755 {destdir}/usr/share/licenses/{pkgname}/",
f"install -v -m644 {builddir}/LICENSE-APACHE {destdir}/usr/share/licenses/{pkgname}/LICENSE-APACHE",
f"install -v -m644 {builddir}/LICENSE-MIT {destdir}/usr/share/licenses/{pkgname}/LICENSE-MIT",
f"install -v -m644 {builddir}/COPYRIGHT {destdir}/usr/share/licenses/{pkgname}/COPYRIGHT",
f"cp -rv {builddir}/LICENSES/* {destdir}/usr/share/licenses/{pkgname}/",
# 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}"
]
triggers = [
f"cd /tmp && find /opt -maxdepth 1 -type d -name \"rustc-*\" ! -name \"rustc-{pkgver}\" -exec rm -rf {{}} +",
f"ldconfig",
]