Skip to content

Commit

Permalink
rust: migrate CLANG{32,64} envs to gnullvm targets
Browse files Browse the repository at this point in the history
  • Loading branch information
mati865 committed Sep 11, 2024
1 parent eef3b3c commit e02d411
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 174 deletions.
14 changes: 14 additions & 0 deletions mingw-w64-rust/0002-use-system-libs-for-crossed-builds.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff -urN rustc-1.81.0-src.orig/compiler/rustc_llvm/build.rs rustc-1.81.0-src/compiler/rustc_llvm/build.rs
--- rustc-1.81.0-src.orig/compiler/rustc_llvm/build.rs 2024-09-10 19:43:19.681781500 +0200
+++ rustc-1.81.0-src/compiler/rustc_llvm/build.rs 2024-09-10 20:39:11.965208700 +0200
@@ -220,9 +220,7 @@
let mut cmd = Command::new(&llvm_config);
cmd.arg(llvm_link_arg).arg("--libs");

- if !is_crossed {
- cmd.arg("--system-libs");
- }
+ cmd.arg("--system-libs");

// We need libkstat for getHostCPUName on SPARC builds.
// See also: https://github.com/llvm/llvm-project/issues/64186
167 changes: 0 additions & 167 deletions mingw-w64-rust/0007-clang-subsystem.patch

This file was deleted.

16 changes: 9 additions & 7 deletions mingw-w64-rust/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Contributor: Philippe Renon <philippe_renon@yahoo.fr>

_bootstrapping=yes
if [[ $MINGW_PACKAGE_PREFIX == *-clang-aarch64 ]]; then
if [[ $MINGW_PACKAGE_PREFIX == *-clang-* ]]; then
_bootstrapping=no
fi

Expand All @@ -20,7 +20,7 @@ pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
$([[ ${CARCH} == i686 ]] || echo "${MINGW_PACKAGE_PREFIX}-rust-wasm")
"${MINGW_PACKAGE_PREFIX}-rust-src")
pkgver=1.81.0
pkgrel=2
pkgrel=3
pkgdesc="Systems programming language focused on safety, speed and concurrency (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64' 'clang32')
Expand Down Expand Up @@ -48,9 +48,10 @@ source=("${rust_dist_server}/${_realname}c-${pkgver}-src.tar.gz"{,.asc}
"${embed_manifest_url}"
"config.toml"
"0001-rustc-llvm-fix-libs.patch"
# remove the next time rust is rebuilt
"0002-use-system-libs-for-crossed-builds.patch"
"0004-compiler-Use-wasm-ld-for-wasm-targets.patch"
"0005-win32-config.patch"
"0007-clang-subsystem.patch"
"0008-disable-self-contained-for-gnu-targets.patch"
"0011-disable-uac-for-installer.patch"
"0012-vendor-embed-manifest.patch"
Expand All @@ -62,9 +63,9 @@ sha256sums=('872448febdff32e50c3c90a7e15f9bb2db131d13c588fe9071b0ed88837ccfa7'
'24ef6d949c0b5b1940c1d6a7aad78d86012152fb8845a1644bc939350d7b75e2'
'3254e26a03cbbe23ab77add05a3de8717b9711428330280dc3ee7a2c924d8c3c'
'7cb1773c288ffb1c1e751edc49b1890c84bf9c362742bc5225d19d474edb73a0'
'4ba4e63e7dfc78a215a0a5b1878d3e60988e9644c14e5581a09f3356dcb4ae6e'
'56882f1a0f1404c10c7726d6cc37444f2b343e72b969badfcb43760f80db0f32'
'7d1c4e49524b835a8eadc961b39f5594b12a522a1e24368999be2c7e85399e4e'
'87955818066f02e4a39c36a789caf45c524cf4a41f04ee1b0cc685bd5205e63e'
'98bc3f2bd7371a5b8d14fd7b03bf05574e206d1d9e52bcfbe66d71398504da3c'
'761d73328d9695a7a2bd2a10be8225f4a56801fee54cbb51c0841b7f16e2bde6'
'23fc45f4e718770375be1c5196f035075de16d25e8f895100a3d1d2492995f86'
Expand Down Expand Up @@ -113,8 +114,9 @@ prepare() {

if [[ $MINGW_PACKAGE_PREFIX == *-clang-i686 || $MINGW_PACKAGE_PREFIX == *-clang-x86_64 ]]; then
apply_patch_with_msg \
0007-clang-subsystem.patch
0002-use-system-libs-for-crossed-builds.patch
fi

if [[ $MINGW_PACKAGE_PREFIX == *-clang-* ]]; then
apply_patch_with_msg \
0011-disable-uac-for-installer.patch
Expand Down Expand Up @@ -154,7 +156,7 @@ build() {
"build/cache/${_stage0date}/"
fi

if [[ $MINGW_PACKAGE_PREFIX == *-clang-aarch64 ]]; then
if [[ $MINGW_PACKAGE_PREFIX == *-clang-* ]]; 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"

Expand Down Expand Up @@ -210,7 +212,7 @@ build() {

# Add target wasm32-*
if [[ ${CARCH} != i686 ]]; then
sed -i '/target = \[/a\ "wasm32-unknown-unknown", "wasm32-wasip1", "wasm32-wasip1-threads", "wasm32-wasip2", "x86_64-pc-windows-gnullvm",' "${srcdir}/${_realname}c-${pkgver}-src/config.toml"
sed -i '/target = \[/a\ "wasm32-unknown-unknown", "wasm32-wasip1", "wasm32-wasip1-threads", "wasm32-wasip2",' "${srcdir}/${_realname}c-${pkgver}-src/config.toml"
fi

# Building out of tree is not officially supported so we have to workaround some things like vendored deps
Expand Down

0 comments on commit e02d411

Please sign in to comment.