73 lines
3.7 KiB
Python
Executable File
73 lines
3.7 KiB
Python
Executable File
pkgname = "rustc" # TODO WEN UPDATING VERSION, RENEW BOOTSTRAP.TOML!!!!! # OKAY I DIDNT HAVE TO DO IT UPPERCASE
|
|
pkgver = "1.96.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"
|
|
openssl_ver = "0.10.78"
|
|
openssl_url = f"https://github.com/lfs-book/rust-openssl/archive/v{openssl_ver}/rust-openssl-{openssl_ver}.tar.gz"
|
|
|
|
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 && "
|
|
f"wget {openssl_url}",
|
|
|
|
# 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} && tar xf ../rust-openssl-{openssl_ver}.tar.gz",
|
|
f"""cd {builddir} && cat >> src/tools/cargo/Cargo.toml << EOF
|
|
[patch.crates-io]
|
|
openssl = {{ path = "../../../rust-openssl-{openssl_ver}/openssl" }}
|
|
openssl-sys = {{ path = "../../../rust-openssl-{openssl_ver}/openssl-sys" }}
|
|
EOF
|
|
""",
|
|
f"""cd {builddir} && sed -ri src/tools/cargo/Cargo.lock \
|
|
-e '/name = "openssl-sys"/,/^$/{{/source|checksum/d;s/0.9.112/0.9.114/}}' \
|
|
-e '/name = "openssl"/,/^$/{{/source|checksum/d;s/0.10.76/{openssl_ver}/}}' \
|
|
-e '/name = "openssl-macros"/,/^$/{{/source|checksum/d}}'""",
|
|
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",
|
|
|
|
f"cd /tmp && mkdir -p {destdir}/etc/profile.d",
|
|
f"""cd /tmp && cat > {destdir}/etc/profile.d/rustc.sh << "EOF"
|
|
# Begin /etc/profile.d/rustc.sh
|
|
|
|
pathprepend /opt/rustc/bin PATH
|
|
|
|
# End /etc/profile.d/rustc.sh
|
|
EOF""",
|
|
|
|
# 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",
|
|
] |