Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions mingw-w64-rust/0013-update-psm.patch

This file was deleted.

55 changes: 0 additions & 55 deletions mingw-w64-rust/0014-update-cc.patch

This file was deleted.

54 changes: 18 additions & 36 deletions mingw-w64-rust/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ if [[ $MINGW_PACKAGE_PREFIX == *-clang-* ]]; then
fi

rust_dist_server=https://static.rust-lang.org/dist
#rust_dist_server=https://dev-static.rust-lang.org/dist/2025-01-07
#rust_dist_server=https://dev-static.rust-lang.org/dist/2025-02-17

_realname=rust
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
$([[ ${CARCH} == i686 ]] || echo "${MINGW_PACKAGE_PREFIX}-rust-wasm")
"${MINGW_PACKAGE_PREFIX}-rust-src")
pkgver=1.84.1
$([[ ${CARCH} == i686 ]] || echo \
"${MINGW_PACKAGE_PREFIX}-rust-wasm" \
"${MINGW_PACKAGE_PREFIX}-rust-src"))
pkgver=1.85.0
pkgrel=1
pkgdesc="Systems programming language focused on safety, speed and concurrency (mingw-w64)"
arch=('any')
Expand All @@ -43,26 +44,17 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
"${MINGW_PACKAGE_PREFIX}-zstd"
"${MINGW_PACKAGE_PREFIX}-zlib")
source=("${rust_dist_server}/${_realname}c-${pkgver}-src.tar.gz"{,.asc}
"cc-1.2.0.tar.gz::https://crates.io/api/v1/crates/cc/1.2.0/download"
"psm-0.1.24.tar.gz::https://crates.io/api/v1/crates/psm/0.1.24/download"
"config.toml"
"0001-rustc-llvm-fix-libs.patch"
"0004-compiler-Use-wasm-ld-for-wasm-targets.patch"
"0008-disable-self-contained-for-gnu-targets.patch"
# remove after 1.85.0 update
"0013-update-psm.patch"
"0014-update-cc.patch")
"0008-disable-self-contained-for-gnu-targets.patch")
noextract=(${_realname}c-${pkgver}-src.tar.gz)
sha256sums=('5e2fb5d49628a549f7671b2ccf9855ab379fd442831a7c2af16e0cdcc31bb375'
sha256sums=('2f4f3142ffb7c8402139cfa0796e24baaac8b9fd3f96b2deec3b94b4045c6a8a'
'SKIP'
'1aeb932158bd710538c73702db6945cb68a8fb08c519e6e12706b94263b36db8'
'200b9ff220857e53e184257720a14553b2f4aa02577d2ed9842d45d4b9654810'
'9ae64f78af216795bfa31acb8f9a8c2e9ed0e66f61f6565a8b89b58a8dab93b8'
'13b35c27aeaddb7a4105c26f9386d19650806b86ea4da546c29767402ca4cfa0'
'7cb1773c288ffb1c1e751edc49b1890c84bf9c362742bc5225d19d474edb73a0'
'56882f1a0f1404c10c7726d6cc37444f2b343e72b969badfcb43760f80db0f32'
'98bc3f2bd7371a5b8d14fd7b03bf05574e206d1d9e52bcfbe66d71398504da3c'
'602481687fa580eb426c619f673128702c800e91d4f476fcbaf48b86a7a1b963'
'482bf5599150faba207dfb389e8d1c4a6a6b2b7574e1ec0c2239563b7e2b0c35')
'98bc3f2bd7371a5b8d14fd7b03bf05574e206d1d9e52bcfbe66d71398504da3c')
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>
Expand Down Expand Up @@ -90,33 +82,23 @@ apply_patch_with_msg() {
}
# =========================================== #

# Make sure the duplication in rust-wasm is found
COMPRESSZST+=(--long)

prepare() {
plain "Extracting ${_realname}c-${pkgver}-src.tar.gz"
tar -xzf ${_realname}c-${pkgver}-src.tar.gz || true

# use latest version of psm to fix arm64 build
rm -r ${_realname}c-${pkgver}-src/vendor/psm-0.1.23
mv psm-0.1.24 ${_realname}c-${pkgver}-src/vendor/psm-0.1.24
# use more fresh version of cc to fix `wasm32v1-none` build
mv cc-1.2.0 ${_realname}c-${pkgver}-src/vendor/cc-1.2.0

# 0008-disable-self-contained-for-gnu-targets.patch allows self-contained for non-windows-gnu targets
cd ${_realname}c-${pkgver}-src
apply_patch_with_msg \
0001-rustc-llvm-fix-libs.patch \
0008-disable-self-contained-for-gnu-targets.patch

apply_patch_with_msg \
0013-update-psm.patch

if [[ ${CARCH} != i686 ]]; then
apply_patch_with_msg \
0004-compiler-Use-wasm-ld-for-wasm-targets.patch
fi

# update cc dependency for library and bootstrap to fix compilation for `wasm32v1-none` target
apply_patch_with_msg \
0014-update-cc.patch
}

build() {
Expand Down Expand Up @@ -179,11 +161,6 @@ build() {
sed -i '/target = \[/a\ "wasm32-unknown-unknown", "wasm32v1-none", "wasm32-wasip1", "wasm32-wasip1-threads", "wasm32-wasip2",' config.toml
fi

# Enable CFGuard for gnullvm
if [[ $MINGW_PACKAGE_PREFIX == *-clang-* ]]; then
sed -i "s/^#control-flow-guard/control-flow-guard/g" config.toml
fi

local -a _rust_build=()
_rust_build+=("--stage" "2")
#_rust_build+=("--verbose")
Expand Down Expand Up @@ -244,12 +221,17 @@ package_rust-wasm() {
depends=("${MINGW_PACKAGE_PREFIX}-lld"
"${MINGW_PACKAGE_PREFIX}-rust"
"${MINGW_PACKAGE_PREFIX}-wasm-component-ld")
# object files provided for wasm32-* targets can't be stripped with MSYS2 toolchain
# strip wasm object files manually due to binutils' lack of support
options=('!strip')

cd "${_realname}c-${pkgver}-src/build-${MSYSTEM}"

cp -a dest-wasm/* "${pkgdir}"

pushd "${pkgdir}${MINGW_PREFIX}"/lib/rustlib
llvm-strip --strip-debug wasm32*/lib/*.rlib
popd

install -Dm644 ../LICENSE-{APACHE,MIT} -t "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}-wasm"
}

Expand Down
9 changes: 5 additions & 4 deletions mingw-w64-rust/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
profile = "dist"

# see src/bootstrap/src/utils/change_tracker.rs
change-id = 133207
change-id = 134650

[build]
#cargo = "$MINGW_PREFIX/bin/cargo.exe"
Expand Down Expand Up @@ -51,9 +51,9 @@ llvm-tools = false
codegen-tests = false
deny-warnings = false
backtrace-on-ice = true
# FIXME: CFG can be enabled only for MSVC and LLVM targets as for
# https://github.com/rust-lang/rust/pull/74103 and https://github.com/rust-lang/rust/pull/132965
#control-flow-guard = true
# FIXME: Control Flow Guard works only on gnullvm targets, in other cases it's ignored
# https://github.com/rust-lang/rust/pull/132965
control-flow-guard = true

[dist]
compression-formats = ["gz"]
Expand All @@ -66,6 +66,7 @@ cxx = "$MINGW_PREFIX/bin/c++.exe"
ar = "$MINGW_PREFIX/bin/ar.exe"
ranlib = "$MINGW_PREFIX/bin/ranlib.exe"
llvm-config = "$MINGW_PREFIX/bin/llvm-config.exe"
crt-static = true

[target.wasm32-unknown-unknown]
cc = "$MINGW_PREFIX/bin/clang.exe"
Expand Down