-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13513 from mati865/rust-aarch64-v2
Second attempt at AArch64 Rust
- Loading branch information
Showing
2 changed files
with
371 additions
and
14 deletions.
There are no files selected for viewing
321 changes: 321 additions & 0 deletions
321
mingw-w64-rust/0009-build-gnullvm-targets-natively.patch
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,10 @@ pkgbase=mingw-w64-${_realname} | |
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}" | ||
"${MINGW_PACKAGE_PREFIX}-rust-docs") | ||
pkgver=1.64.0 | ||
pkgrel=1 | ||
pkgrel=2 | ||
pkgdesc="Systems programming language focused on safety, speed and concurrency (mingw-w64)" | ||
arch=('any') | ||
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64') | ||
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64') | ||
url="https://www.rust-lang.org/" | ||
license=('MIT' 'Apache') | ||
makedepends=("${MINGW_PACKAGE_PREFIX}-cmake" | ||
|
@@ -36,18 +36,33 @@ source=("https://static.rust-lang.org/dist/${_realname}c-${pkgver}-src.tar.gz"{, | |
"0004-unbundle-gcc.patch" | ||
"0005-win32-config.patch" | ||
"0007-clang-subsystem.patch" | ||
"0008-disable-self-contained.patch") | ||
"0008-disable-self-contained.patch" | ||
"0009-build-gnullvm-targets-natively.patch") | ||
sha256sums=('b3cd9f481e1a2901bf6f3808d30c69cc4ea80d93c4cc4e2ed52258b180381205' | ||
'SKIP' | ||
'7cb1773c288ffb1c1e751edc49b1890c84bf9c362742bc5225d19d474edb73a0' | ||
'36c531c73a2c12b3e66aa22526a404c3f770f1ab7e0e76c55af6fcc1a17e46fe' | ||
'c4e5ffeef84296d39c3e3e8f807fc8b33ce786b1e4edb21eef26b053586aca27' | ||
'c38450682a48bb1d5a0ddaa37ae5b324d39a9e0626daa2fc695caec1a53d6c35' | ||
'29f84cb8e05ce304e102e28912a3b4464add406a8ec37a6c6d717b9b7d81b67b') | ||
'29f84cb8e05ce304e102e28912a3b4464add406a8ec37a6c6d717b9b7d81b67b' | ||
'c70cb2bceafdd5b0e7d9d58c52a4f5dcff3d639ac57b134a29961d377a97e457') | ||
validpgpkeys=('108F66205EAEB0AAA8DD5E1C85AB96E6FA1BE5FE' # Rust Language (Tag and Release Signing Key) <[email protected]> | ||
'474E22316ABF4785A88C6E8EA2C794A986419D8A' # Tom Stellard <[email protected]> | ||
'B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <[email protected]> | ||
|
||
# hack the bootstrap | ||
if [[ $MINGW_PACKAGE_PREFIX == *-clang-aarch64 ]]; then | ||
source+=("https://github.com/mati865/rust-gnullvm-builds/releases/download/1.63.0-v2/cargo-1.63.0-dev-aarch64-pc-windows-gnullvm.tar.xz" | ||
"https://github.com/mati865/rust-gnullvm-builds/releases/download/1.63.0-v2/rust-std-1.63.0-dev-aarch64-pc-windows-gnullvm.tar.xz" | ||
"https://github.com/mati865/rust-gnullvm-builds/releases/download/1.63.0-v2/rustc-1.63.0-dev-aarch64-pc-windows-gnullvm.tar.xz") | ||
sha256sums+=('5a72ff6d89277c96f72cb7de7f35c4a3b4686b3dc6ea0d4966883e83179db0a8' | ||
'0a5087acf06faa2a02ff7f41afb7be42b22575a2ff0b3f790b6bb64418f3ea5d' | ||
'96c7877b4821fe7bb4aaa35aa8f2056d19d622902d6583d0aef8a35f3fef8dbb') | ||
noextract+=('cargo-1.63.0-dev-aarch64-pc-windows-gnullvm.tar.xz' | ||
'rust-std-1.63.0-dev-aarch64-pc-windows-gnullvm.tar.xz' | ||
'rustc-1.63.0-dev-aarch64-pc-windows-gnullvm.tar.xz') | ||
fi | ||
|
||
# =========================================== # | ||
# Helper macros to help make tasks easier # | ||
apply_patch_with_msg() { | ||
|
@@ -70,18 +85,22 @@ prepare() { | |
0005-win32-config.patch \ | ||
0008-disable-self-contained.patch | ||
|
||
if [[ $MINGW_PACKAGE_PREFIX == *-clang-* ]]; then | ||
if [[ $MINGW_PACKAGE_PREFIX == *-clang-x86_64 ]]; then | ||
apply_patch_with_msg \ | ||
0007-clang-subsystem.patch | ||
fi | ||
if [[ $MINGW_PACKAGE_PREFIX == *-clang-aarch64 ]]; then | ||
apply_patch_with_msg \ | ||
0009-build-gnullvm-targets-natively.patch | ||
fi | ||
} | ||
|
||
build() { | ||
[[ -d "${srcdir}/${MSYSTEM}" ]] && rm -rf "${srcdir}/${MSYSTEM}" | ||
mkdir -p "${srcdir}/${MSYSTEM}" && cd "${srcdir}/${MSYSTEM}" | ||
|
||
# The ultimate hack to let the bootstrap compiler use libgcc* libs | ||
if [[ $MINGW_PACKAGE_PREFIX == *-clang-* ]]; then | ||
if [[ $MINGW_PACKAGE_PREFIX == *-clang-x86_64 ]]; then | ||
export GCC_LIBS_HACK="$(cygpath -am build/missing-libs-hack)" | ||
mkdir -p "${GCC_LIBS_HACK}" | ||
cp "$(cygpath -u $(clang -print-libgcc-file-name))" "${GCC_LIBS_HACK}/libgcc.a" | ||
|
@@ -90,11 +109,27 @@ build() { | |
export RUSTFLAGS_BOOTSTRAP="-C link-arg=-L$(cygpath -am build/missing-libs-hack)" | ||
fi | ||
|
||
# We have to do the following because rust doesn't count x86_64-w64-mingw32 as a target triple | ||
OSTYPE="$CARCH-pc-windows-gnu" | ||
# hack to inject the bootstrap compiler | ||
if [[ $MINGW_PACKAGE_PREFIX == *-clang-aarch64 ]]; then | ||
local rustdate="2022-08-11" | ||
mkdir -p "build/cache/${rustdate}/" | ||
cp -f "${srcdir}/cargo-1.63.0-dev-aarch64-pc-windows-gnullvm.tar.xz" "${srcdir}/rust-std-1.63.0-dev-aarch64-pc-windows-gnullvm.tar.xz" "${srcdir}/rustc-1.63.0-dev-aarch64-pc-windows-gnullvm.tar.xz" "build/cache/${rustdate}/" | ||
fi | ||
|
||
if [[ $MINGW_PACKAGE_PREFIX == *-clang-aarch64 ]]; then | ||
# We have to do the following because rust doesn't count x86_64-w64-mingw32 as a target triple | ||
OSTYPE="$CARCH-pc-windows-gnullvm" | ||
|
||
# Otherwise it uses gcc during bootstrap, even when we build for clang | ||
export CARGO_TARGET_${CARCH^^}_PC_WINDOWS_GNULLVM_LINKER="${CC}" | ||
|
||
# Otherwise it uses gcc during bootstrap, even when we build for clang | ||
export CARGO_TARGET_${CARCH^^}_PC_WINDOWS_GNU_LINKER="${CC}" | ||
else | ||
# We have to do the following because rust doesn't count x86_64-w64-mingw32 as a target triple | ||
OSTYPE="$CARCH-pc-windows-gnu" | ||
|
||
# Otherwise it uses gcc during bootstrap, even when we build for clang | ||
export CARGO_TARGET_${CARCH^^}_PC_WINDOWS_GNU_LINKER="${CC}" | ||
fi | ||
|
||
local -a _rust_conf=() | ||
if [ "${_bootstrapping}" = "no" ]; then | ||
|
@@ -105,6 +140,7 @@ build() { | |
# - add --disable-docs and --disable-compiler-docs | ||
# - compile only rustc by removing --enable-extended | ||
# - run makepkg-mingw with --nocheck | ||
# - remove --stage 2 | ||
|
||
MSYS2_ARG_CONV_EXCL="--prefix;--sysconfdir;--localstatedir" \ | ||
../${_realname}c-${pkgver}-src/configure \ | ||
|
@@ -118,16 +154,16 @@ build() { | |
--release-description="Rev${pkgrel}, Built by MSYS2 project" \ | ||
--enable-ninja \ | ||
--enable-extended \ | ||
--enable-vendor \ | ||
--disable-llvm-static-stdcpp \ | ||
--disable-codegen-tests \ | ||
--llvm-root=${MINGW_PREFIX} \ | ||
--python=${MINGW_PREFIX}/bin/python \ | ||
${_rust_conf} | ||
|
||
DEP_NGHTTP_ROOT=${MINGW_PREFIX} \ | ||
DEP_OPENSSL_ROOT=${MINGW_PREFIX} \ | ||
DEP_Z_ROOT=${MINGW_PREFIX} \ | ||
${MINGW_PREFIX}/bin/python ../${_realname}c-${pkgver}-src/x.py build --verbose --stage 2 | ||
# Building out of tree is not officially supported so we have to workaround some things like vendored deps | ||
cp -r ../${_realname}c-${pkgver}-src/.cargo . | ||
sed -i "s|directory = \"vendor\"|directory = \"../${_realname}c-${pkgver}-src/vendor\"|" .cargo/config.toml | ||
|
||
# create the install at a temporary directory | ||
DEP_NGHTTP_ROOT=${MINGW_PREFIX} \ | ||
|