[new package] rust 1.89.0 (#5571)

- use Jeremy's build as a stage0 compiler
- based on MinGW package but with many things removed (e.g. wasm targets, src component, PGO...)
This commit is contained in:
Maksim Bondarenkov 2025-08-18 17:16:25 +07:00 committed by GitHub
parent 0acc25af2c
commit 8562f8c54b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 182 additions and 0 deletions

120
rust/PKGBUILD Normal file
View File

@ -0,0 +1,120 @@
# Maintainer: Maksim Bondarenkov <maksapple2306@gmail.com>
_bootstrapping=no
rust_dist_server=https://static.rust-lang.org/dist
#rust_dist_server=https://dev-static.rust-lang.org/dist/2025-08-04
pkgname=rust
pkgver=1.89.0
pkgrel=1
pkgdesc="Systems programming language focused on safety, speed and concurrency"
arch=('x86_64')
url="https://www.rust-lang.org/"
msys2_repository_url="https://github.com/rust-lang/rust"
msys2_references=(
'anitya: 7635'
'archlinux: rust'
"cpe: cpe:/a:rust-lang:rust"
'gentoo: dev-lang/rust'
)
license=('spdx:Apache-2.0 AND MIT')
makedepends=('gcc'
'llvm'
'python'
'libgit2-devel'
'pcre2-devel'
'libssh2-devel'
'openssl-devel'
'pkgconf'
'libsqlite-devel'
'liblzma-devel'
'libzstd-devel'
'zlib-devel'
'libcurl-devel'
# TODO: rebuild with our Rust
#$([[ "$_bootstrapping" == "no" ]] && echo 'rust')
)
source=("${rust_dist_server}/${pkgname}c-${pkgver}-src.tar.gz"{,.asc}
"bootstrap.toml")
noextract=(${pkgname}c-${pkgver}-src.tar.gz)
sha256sums=('2576f9f440dd99b0151bd28f59aa0ac6102d5c4f3ed4ef8a810c8dd05057250d'
'SKIP'
'66de9b211c5b5e4d211909ba127a57ed3fbf6b78dbaff266cbbb9e025ce72a3d')
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>
# temporarily download stage0
if [[ ${_bootstrapping} == "no" ]]; then
_stage0_source="https://github.com/jeremyd2019/cygwin-rust-bootstrap/releases/download/rust-1.89.0-msys2"
source+=("${_stage0_source}/rust-1.89.0-x86_64-pc-cygwin.tar.xz")
sha256sums+=('448203e01a5bbe18e7f813dd5c029808ae4799330ef50d0791c94eb5a0220891')
fi
prepare() {
# workaround strange symlinking error during a build
export MSYS=winsymlinks:nativestrict
plain "Extracting ${pkgname}c-${pkgver}-src.tar.gz"
tar -xzf ${pkgname}c-${pkgver}-src.tar.gz || true
# copy binaries and library into a single location
if [[ ${_bootstrapping} == "no" ]]; then
mkdir -p stage0/{bin,lib}
cp -r rust-1.89.0-x86_64-pc-cygwin/{rustc,cargo,rustfmt-preview}/bin/* stage0/bin
cp -r rust-1.89.0-x86_64-pc-cygwin/{rustc,rust-std-x86_64-pc-cygwin}/lib/* stage0/lib
fi
}
build() {
export RUST_BACKTRACE=1
# force some system libraries
export LIBSQLITE3_SYS_USE_PKG_CONFIG=1
export LIBSSH2_SYS_USE_PKG_CONFIG=1
cd "${pkgname}c-${pkgver}-src"
# substitute the values in bootstrap.toml
#export USR="/usr"
export PKGREL="${pkgrel}"
export SRCDIR="${srcdir}"
envsubst < ../bootstrap.toml > bootstrap.toml
if [ "${_bootstrapping}" = "no" ]; then
sed -i '/^\[build\]/,/^$/ s|^#||g' bootstrap.toml
fi
if check_option "debug" "y"; then
sed -i 's/^#debug/debug/g' bootstrap.toml
fi
DESTDIR="$PWD/dest-rust" python x.py install --stage 2
}
check() {
cd "${pkgname}c-${pkgver}-src"
python x.py test --stage 2 --exclude src/test/debuginfo
}
package_rust() {
depends=('gcc'
'zlib'
'libzstd'
'libsqlite'
'libssh2'
'libgit2'
'libopenssl'
'libcurl'
'llvm')
optdepends=("gdb: for rust-gdb script"
"lldb: for rust-lldb script")
cd "${pkgname}c-${pkgver}-src"
cp -a dest-rust/* "${pkgdir}"
# delete unnecessary files, e.g. components and manifest files only used for the uninstall script
cd "${pkgdir}/usr/lib/rustlib"
rm components install.log manifest-* rust-installer-version uninstall.sh
install -d "${pkgdir}/usr/share/bash-completion/completions"
mv "${pkgdir}/etc/bash_completion.d/cargo" \
"${pkgdir}/usr/share/bash-completion/completions/cargo"
}

62
rust/bootstrap.toml Normal file
View File

@ -0,0 +1,62 @@
# see src/bootstrap/defaults/
profile = "dist"
# see src/bootstrap/src/utils/change_tracker.rs
change-id = 142379
[llvm]
link-shared = true
[build]
#cargo = "$SRCDIR/stage0/bin/cargo"
#rustc = "$SRCDIR/stage0/bin/rustc"
#rustfmt = "$SRCDIR/stage0/bin/rustfmt"
description = "Rev$PKGREL, Built by MSYS2 project"
submodules = false
build = "x86_64-pc-cygwin"
host = ["x86_64-pc-cygwin"]
target = ["x86_64-pc-cygwin"]
python = "/usr/bin/python"
locked-deps = true
vendor = true
tools = [
"cargo",
"clippy",
"rustdoc",
"rustfmt",
]
# Do not generate docs for cygwin
docs = false
[install]
prefix = "/usr"
sysconfdir = "/etc"
[rust]
#debug = true
codegen-units = 1
codegen-units-std = 1
#debuginfo-level-std = 2
channel = "stable"
rpath = false
frame-pointers = true
llvm-bitcode-linker = false
lld = false
llvm-tools = false
codegen-tests = false
deny-warnings = false
backtrace-on-ice = true
remap-debuginfo = false
[dist]
compression-formats = ["gz"]
compression-profile = "fast"
[target.x86_64-pc-cygwin]
cc = "/usr/bin/gcc"
cxx = "/usr/bin/g++"
ar = "/usr/bin/ar"
ranlib = "/usr/bin/ranlib"
linker = "/usr/bin/x86_64-pc-cygwin-gcc"
llvm-config = "/usr/bin/llvm-config"