# Contributor: Zach van Rijn # Maintainer: Zach van Rijn pkgname=mrustc pkgver=0.11.0 _rustcver=1.74.1 _minorver=${_rustcver%.*}.0 pkgrel=0 pkgdesc="Alternative rust compiler (re-implementation)" url="https://github.com/thepowersgang/mrustc" arch="x86_64" license="MIT" depends="" makedepends="cmake python3 zlib-dev" subpackages="" source="mrustc-$pkgver.tar.gz::https://github.com/thepowersgang/mrustc/archive/refs/tags/v$pkgver.tar.gz https://static.rust-lang.org/dist/rustc-${_rustcver}-src.tar.xz rustc-0001-Fix-LLVM-build.patch rustc-0002-Fix-linking-to-zlib-when-cross-compiling.patch rustc-0003-Fix-rustdoc-when-cross-compiling-on-musl.patch rustc-0004-Remove-musl_root-and-CRT-fallback-from-musl-targets.patch rustc-0005-Prefer-libgcc_eh-over-libunwind-for-musl.patch rustc-0006-Link-libssp_nonshared.a-on-all-musl-targets.patch rustc-0007-test-failed-doctest-output-Fix-normalization.patch rustc-0008-test-sysroot-crates-are-unstable-Fix-test-when-rpath.patch rustc-0009-test-use-extern-for-plugins-Don-t-assume-multilib.patch rustc-0010-Ignore-broken-and-non-applicable-tests.patch rustc-0011-Link-stage-2-tools-dynamically-to-libstd.patch rustc-0012-Move-debugger-scripts-to-usr-share-rust.patch rustc-0013-Add-foxkit-target-specs.patch rustc-powerpc-atomics.patch rustc-ppc-libc-hugetlb.patch mrustc-use-cached-tarball.patch mrustc-0001-Fix-two-typos.patch mrustc-0002-HIR-Const-Eval-Fix-uninitialised-variable-leading-to.patch mrustc-0003-Patches-Add-extra-context-to-1.74-patch-file-hopeful.patch mrustc-0004-Patches-Fix-incorrect-line-numbers-in-patches.patch mrustc-0005-Patches-Fix-it-this-time.patch mrustc-0006-Codegen-C-Turn-down-gcc-optimisation-level-to-work-a.patch mrustc-0007-HIR-Typecheck-Properly-pass-type-params-to-const-eva.patch `#ppc32-default-target-detect.patch` mrustc-nuke-autodetection-logic.patch mrustc-unified-outdir.patch mrustc-adelie-targets.patch " prepare() { # manual patches find .. -mindepth 1 -maxdepth 1 -name '*.patch' | sort | while read k; do ( case "${k}" in */rustc-*) cd "${srcdir}"/rustc-${_rustcver}-src; ;; */mrustc-*) cd "${builddir}"; ;; *) printf "E: where to apply '%s'?\n" "${k}"; exit 1; ;; esac patch -p1 < "${k}" ) done # force consistent default (only available) target # after we nuke all the auto-detection logic, and # note that "unknown" is required to avoid patching # a ton of crates (though that is a better solution) sed -i tools/common/target_detect.h \ -e "s/__DEFAULT_TARGET_NAME__/${CHOST}/g" \ -e "s/foxkit/unknown/g" \ ; # use our cached copy and do not download during build mv "${srcdir}"/rustc-${_rustcver}-src "${builddir}"/rustc-${_minorver}-src } build() { # experimental but do you really want to build llvm with -j1? export PARLEVEL="${JOBS}" # see 'adelie-targets.patch' # the problem is that '--target' is not consistently applied to # all stages of the bootstrap process, so things break # export MRUSTC_TARGET="${CHOST}" export RUSTC_VERSION=${_minorver} MRUSTC_TARGET_VER=${_rustcver%.*} make make RUSTCSRC # FIXME: this generates all the right code but does not execute 'gcc' # (to generate the required objects) when '--target' is given (which # is added due to explicit 'MRUSTC_TARGET' above). Run it manually if # you use 'MRUSTC_TARGET' or comment it out if not. It appears that # this happens due to the aforementioned inconsistent '--target' issue. make -f minicargo.mk LIBS # _fix="$(find output-${_minorver} -name 'lib*_cmd.txt' | sort) output-${_minorver}/dump_cmd.txt" # for k in ${_fix}; do gcc @"${k}"; done make test make local_tests RUSTC_INSTALL_BINDIR=bin make -f minicargo.mk output-${_minorver}/rustc LIBGIT2_SYS_USE_PKG_CONFIG=1 make -f minicargo.mk -j ${PARLEVEL:-1} output-${_minorver}/cargo } check() { ./output-${_minorver}/rustc --version ./output-${_minorver}/cargo --version ./output-${_minorver}/rustc samples/no_core.rs #./output-${_minorver}/rustc samples/1.rs } package() { mkdir -p "$pkgdir"/usr/bin for k in cargo rustc; do cp "$builddir"/output-${_minorver}/${k} "$pkgdir"/usr/bin done } sha512sums="2cc4941f8747be4ddde4109ab93a1cec2792839b3083b5f4b39b8009823d212c43c95f9cc56a96901c416934033c4e94917d18ef3ff15899de8b2840e955bd3f mrustc-0.11.0.tar.gz 14c7e7ed2f38ab60299d8c7d41d78f042b6b57ef822d577b5138e60bdde31cf141eccd4332a25bc5da3d58eb5313d63c1448b5dfe9e11b8055bb8ea133a9038d rustc-1.74.1-src.tar.xz 0c284187d7862fb49cb027d0f52cbbbc80ce2ccf7f26c491de063101cc7a9c7dae6451068444a3c252fb6d1834dd78a0e632452647bcfdc0576e725843c80300 rustc-0001-Fix-LLVM-build.patch d885d1723d9dde01cad13ac87d93a0579779a09b98331f0799a4388afa3d1f7c6905522c0b152bc6af8071763df36b265045cba9e3dfe806d17cc251594e0d63 rustc-0002-Fix-linking-to-zlib-when-cross-compiling.patch fb0b40f085b9dee31985b1611394e23f41b7244b4d61031c0fe1db893dfa9ef10e18945ad211c4d3b501183942f2a6a9497b5dbe1ed39b9000a746f0b9e01d2a rustc-0003-Fix-rustdoc-when-cross-compiling-on-musl.patch c39324c283f16f8696d572e57c6bfe29692831a9601ce5eb122d310a4afb170b2f3f2db724044e4e0a3be6d6265e79a490984c767ab0e6d4107504bb95743d9e rustc-0004-Remove-musl_root-and-CRT-fallback-from-musl-targets.patch 0382ec5c0ffe082a252fc8d5fb84e74ac1ab09146a22ac4a9ba37446c4010a32113e0b28b16032a0b6816a5eb4b5e7fc8612ab2abd5d9fc429021b63132dafe4 rustc-0005-Prefer-libgcc_eh-over-libunwind-for-musl.patch 3cf4663242bfd6c67a644a2c6e9c49d26fb2dc93b8907daa86880adb9f57a3db222121a68004aae3f048da59d123ace301e28c63ea80a80f61f4b63f8089e497 rustc-0006-Link-libssp_nonshared.a-on-all-musl-targets.patch 5cf31dfaa0604bbc45ac85a78f0d2326c23a57f66e7c4fa1efe5b9f5967c8a3120dad921c70cdbcdf5e6038c22accf56cd34c0c15e576dda7691c2de3258d7cc rustc-0007-test-failed-doctest-output-Fix-normalization.patch bd032bda35b5881e04ea3fe335818fee63087ca26f76f2c1e494c135d9186de021e77a8c36d47f60dffe4e85217ab24775601031d6608a08559d4b27f1ca6da8 rustc-0008-test-sysroot-crates-are-unstable-Fix-test-when-rpath.patch 390e3b3569054ee4719959c0fc9a4aa1b28bae9f4cb54abae28f0313caa7c9ee2393e0877d6ed49ca54673fa162ab8e29113d97ed8f758d0f541cf57aa55e9cb rustc-0009-test-use-extern-for-plugins-Don-t-assume-multilib.patch faa6f2c3c94140798b476a794d77a304c0f3891a65c1ffe99666606cfe822d5651af6b8c011265a7f1114ade355994761d71aac550b8dd8617f44d500435e8e9 rustc-0010-Ignore-broken-and-non-applicable-tests.patch 163cc96971559f0c62aa0da267afd0b63fea3225b7aae5d710d9a4ad4c9756e34fd08bd5d1efb5b1e50726205c51693bd329d1c8929a096ddf8d5d7732986149 rustc-0011-Link-stage-2-tools-dynamically-to-libstd.patch 8d7bff08fec8feb63330e120805c2bb2623f60b91fe0d6ef79591a984264937f0f93a68995ec40daefcdbedb5f1edcc738125c0f41f81442933359ae42ceafa2 rustc-0012-Move-debugger-scripts-to-usr-share-rust.patch 72ce26e6f720a652305ef9c39542773247d6bac1c30c5af1d655b6929b1169df74c46a5178349c95ef795624d0944f5cfe2dd4e810562614bd808cb486866ea5 rustc-0013-Add-foxkit-target-specs.patch 931a08d7714f28424506ea8d733c4d496810bc9992f11d6b3162e688ac36c3be3e25ece63b3d9ce26cf8858dc1231d826ab166ec992e61bc3649041b5d2d819b rustc-powerpc-atomics.patch d830cd718414cbfaf70f6714f74f3f78dca0ef26277a7ceb9067f192852656dab0903d2bfbae627ef1909b20bbc10c8563cee61e103927a424815383dae579a9 rustc-ppc-libc-hugetlb.patch f301120ea9488d90511d55a123ebbab4738ff67d0a1352427e7002b59642beaf8a8fd3908c41a6eeb59fd017509d66eb637e048dd7c96ed21b8b97df9c506f58 mrustc-use-cached-tarball.patch 90db8205bcefb71bdf248d5d3c1e170b43f7a6d672931f15bd9fd000de7528088b048f48b6a5f18b61432f2d61041da8f875e6f7a135f62d05dc36c05edaf712 mrustc-0001-Fix-two-typos.patch 53bf7c21f0ee3384d1d3c284654819027f1a132ddd32ca8b51d82eca97b87421f331a3cfb974de8f45b18aadf05144cdcef80441db1c78a8b4fe025dd38c4f62 mrustc-0002-HIR-Const-Eval-Fix-uninitialised-variable-leading-to.patch 76f2cf36a7efa66295d20b1b3d2faeff74087a9b240801f3d6c2a4beb34bbabffc540f363b96c26dd8024a0ce13f7018d4cab4816bc0fe00c6be459b8b544852 mrustc-0003-Patches-Add-extra-context-to-1.74-patch-file-hopeful.patch debbc9d9a2d2398cd66987904ea62f26a64be078b97cbfa159e10b63c5fd2e1fbdf600a1326c9f6a7b4b3f7066fb0b0c66ebdb528232eac42b2e9c5bf56e18fa mrustc-0004-Patches-Fix-incorrect-line-numbers-in-patches.patch 11fed26ae226c810b2f06f983f665639e146c3ef2da1b68d64586a35555de0b0e58e3e8765b5bc45085b237dfe74ca6c33e864bdf9d2e89f1be75050f63aa922 mrustc-0005-Patches-Fix-it-this-time.patch 7e879056bf3debdaf469ef0b17cf91b6e61d8802094521b8df1d0c07f9d889897009e2987e3654c3560d03e3fa775b26ec11543c5ba630bc059c50f6bbc8145e mrustc-0006-Codegen-C-Turn-down-gcc-optimisation-level-to-work-a.patch 52a42716b73f13852c5507a9566250f174b6a87de0aed3752f5f54bdf25887930620b3c0ea597bdb86c33b8be00724fa94e5c38e156a7edadb3776e4c4a5fb39 mrustc-0007-HIR-Typecheck-Properly-pass-type-params-to-const-eva.patch 529e2dbd51f48f749e489fcf228c2ca56f7f1675f96d203f5447ac53cd6b9d0b2ec01af4f607f64f784a0cbeca6551cfba1434fe05e8d19165b674ecbe60c91f mrustc-nuke-autodetection-logic.patch 09cd2bd0329269ee4eaf656f1a367d51bc679f0a118035b38805a07520df48447a04518d0b6963039f3aa3cceab83b9914bb4f4ac15bac86bb124b8b36e70444 mrustc-unified-outdir.patch 1effb16522f9959f2d47aca885c7919a56fd0e3abd33212d242468ec25d21d949d298eb0c17ca65ed4542c33c9520d19bc6d92049a24f897d45318f1df305850 mrustc-adelie-targets.patch"