Second attempt at AArch64 Rust
Co-Authored-By: jeremyd2019 <github@jdrake.com> Co-Authored-By: Martin Storsjö <martin@martin.st>
This commit is contained in:
321
mingw-w64-rust/0009-build-gnullvm-targets-natively.patch
Normal file
321
mingw-w64-rust/0009-build-gnullvm-targets-natively.patch
Normal file
File diff suppressed because one or more lines are too long
@@ -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) <rust-key@rust-lang.org>
|
||||
'474E22316ABF4785A88C6E8EA2C794A986419D8A' # Tom Stellard <tstellar@redhat.com>
|
||||
'B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <hans@chromium.org>
|
||||
|
||||
# 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,10 +85,14 @@ 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() {
|
||||
@@ -81,7 +100,7 @@ build() {
|
||||
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
|
||||
|
||||
# Otherwise it uses gcc during bootstrap, even when we build for clang
|
||||
export CARGO_TARGET_${CARCH^^}_PC_WINDOWS_GNU_LINKER="${CC}"
|
||||
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}"
|
||||
|
||||
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} \
|
||||
|
||||
Reference in New Issue
Block a user