1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
# Maintainer: pingplug < aur at pingplug dot me >
_pkgname=rust
pkgname=mingw-w64-rust-bin
_prefix=opt/rust
pkgver=1.85.0
pkgrel=1
pkgdesc="Systems programming language focused on safety, speed and concurrency (official build, mingw-w64)"
arch=('x86_64')
url="https://www.rust-lang.org"
license=("Apache-2.0 OR MIT")
depends=('gcc-libs'
'curl'
'mingw-w64-crt'
'libgit2'
'mingw-w64-gcc')
optdepends=('mingw-w64-wine: for cargo test support')
provides=("mingw-w64-rust=${pkgver}")
conflicts=('mingw-w64-rust')
options=('!strip' 'staticlibs' '!buildflags')
source=("https://static.rust-lang.org/dist/cargo-${pkgver}-x86_64-unknown-linux-gnu.tar.xz"{,.asc}
"https://static.rust-lang.org/dist/rustc-${pkgver}-x86_64-unknown-linux-gnu.tar.xz"{,.asc}
"https://static.rust-lang.org/dist/rust-std-${pkgver}-x86_64-unknown-linux-gnu.tar.xz"{,.asc}
"https://static.rust-lang.org/dist/rust-std-${pkgver}-i686-pc-windows-gnu.tar.xz"{,.asc}
"https://static.rust-lang.org/dist/rust-std-${pkgver}-x86_64-pc-windows-gnu.tar.xz"{,.asc})
b2sums=('d29e59c97e1ba6fc0a1b88fdd958fd1ab88338326a5f46b5f78993a1bd7ecb94d96d80e6a7ed540806de8901079d85b38a7b8cefe81112550646cb4b666050d6'
'SKIP'
'e4882c13cf9fa26c481d62e40815388b56b5976a7796d5bf1a7d4fe481a2c11f55aab3cc1c1eb0a71a6e5d6a2551895814427891d60ae5e31445b79fdc2139e0'
'SKIP'
'1c88b5c2c839f1d8a5d8fa4f269e21e0f7b45534663b0a7e5c53fb018d1cc6a9db6641dfbc75ac0cb451254d0f9d9bf22bd91ae6e6ca392baa2c0e0e9bed75ec'
'SKIP'
'a37832545767c30336569ea30499d772624ae6800d21bf703c527fff58ba9a4ec5391af4a2f8fb29c879d598b6d09f3ac7f0b0f65d4d4b149600e5fa085431c7'
'SKIP'
'1281b6ae25a85c091755da7066be8bb3630ac0785217d2671dca276b2a24f7968911a801da133a01362196d966be908502c034bb7c35d03499d068520d834595'
'SKIP')
validpgpkeys=('108F66205EAEB0AAA8DD5E1C85AB96E6FA1BE5FE') # Rust Language (Tag and Release Signing Key) <rust-key@rust-lang.org>
backup=("opt/${_pkgname}/cargo/config")
prepare() {
cd ${srcdir}
mkdir -p "rust-${pkgver}-x86_64-unknown-linux-gnu"
cp "cargo-${pkgver}-x86_64-unknown-linux-gnu/install.sh" "rust-${pkgver}-x86_64-unknown-linux-gnu"
mv "cargo-${pkgver}-x86_64-unknown-linux-gnu/cargo" "rust-${pkgver}-x86_64-unknown-linux-gnu"
cat "cargo-${pkgver}-x86_64-unknown-linux-gnu/components" >> "rust-${pkgver}-x86_64-unknown-linux-gnu/components"
mv "rustc-${pkgver}-x86_64-unknown-linux-gnu/rustc" "rust-${pkgver}-x86_64-unknown-linux-gnu"
cat "rustc-${pkgver}-x86_64-unknown-linux-gnu/components" >> "rust-${pkgver}-x86_64-unknown-linux-gnu/components"
mv "rust-std-${pkgver}-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu" "rust-${pkgver}-x86_64-unknown-linux-gnu"
cat "rust-std-${pkgver}-x86_64-unknown-linux-gnu/components" >> "rust-${pkgver}-x86_64-unknown-linux-gnu/components"
mv "rust-std-${pkgver}-i686-pc-windows-gnu/rust-std-i686-pc-windows-gnu" "rust-${pkgver}-x86_64-unknown-linux-gnu"
cat "rust-std-${pkgver}-i686-pc-windows-gnu/components" >> "rust-${pkgver}-x86_64-unknown-linux-gnu/components"
mv "rust-std-${pkgver}-x86_64-pc-windows-gnu/rust-std-x86_64-pc-windows-gnu" "rust-${pkgver}-x86_64-unknown-linux-gnu"
cat "rust-std-${pkgver}-x86_64-pc-windows-gnu/components" >> "rust-${pkgver}-x86_64-unknown-linux-gnu/components"
}
package() {
cd "${srcdir}/rust-${pkgver}-x86_64-unknown-linux-gnu"
# rustc, cargo, and libs.
./install.sh \
--disable-ldconfig \
--destdir="${pkgdir}" \
--components=rustc,cargo,rust-std-x86_64-unknown-linux-gnu,rust-std-i686-pc-windows-gnu,rust-std-x86_64-pc-windows-gnu \
--prefix=/opt/${_pkgname}
# license
install -dm755 "${pkgdir}/usr/share/licenses/${pkgname}/"{rustc,cargo}
mv "${pkgdir}"/${_prefix}/share/doc/cargo/LICENSE-* "${pkgdir}/usr/share/licenses/${pkgname}/cargo/"
mv "${pkgdir}"/${_prefix}/share/doc/rust/{LICENSE-*,COPYRIGHT} "${pkgdir}/usr/share/licenses/${pkgname}/rustc/"
# remove unused files
rm -r "${pkgdir}/${_prefix}/share"
rm "${pkgdir}/${_prefix}/lib/rustlib/"{manifest-*,install.log,uninstall.sh,components,rust-installer-version}
# link shared libraries
install -dm755 "${pkgdir}/usr/i686-w64-mingw32/bin" && pushd "${pkgdir}/usr/i686-w64-mingw32/bin"
ln -sf "../../../${_prefix}/lib/rustlib/i686-pc-windows-gnu/lib/"*.dll .
popd
install -dm755 "${pkgdir}/usr/x86_64-w64-mingw32/bin" && pushd "${pkgdir}/usr/x86_64-w64-mingw32/bin"
ln -sf "../../../${_prefix}/lib/rustlib/x86_64-pc-windows-gnu/lib/"*.dll .
popd
# strip
strip --strip-all "${pkgdir}/${_prefix}/bin/"{cargo,rustc,rustdoc}
strip --strip-all "${pkgdir}/${_prefix}/lib/rustlib/x86_64-unknown-linux-gnu/bin/"{rust-lld,wasm-component-ld}
strip --strip-all "${pkgdir}/${_prefix}/libexec/"*
strip --strip-unneeded "${pkgdir}/${_prefix}/lib/librustc_driver"*.so
strip --strip-unneeded "${pkgdir}/${_prefix}/lib/libLLVM.so"*
strip --strip-unneeded "${pkgdir}/${_prefix}/lib/rustlib/x86_64-unknown-linux-gnu/lib/"*.so
i686-w64-mingw32-strip --strip-unneeded "${pkgdir}/${_prefix}/lib/rustlib/i686-pc-windows-gnu/lib/"*.dll
x86_64-w64-mingw32-strip --strip-unneeded "${pkgdir}/${_prefix}/lib/rustlib/x86_64-pc-windows-gnu/lib/"*.dll
# config
install -dm777 "${pkgdir}/${_prefix}/cargo"
cat << EOF >> "${pkgdir}/${_prefix}/cargo/config"
[target.i686-pc-windows-gnu]
linker = "/usr/bin/i686-w64-mingw32-gcc"
EOF
if pacman -T "mingw-w64-wine" ; then
cat << EOF >> "${pkgdir}/${_prefix}/cargo/config"
runner = "/usr/bin/i686-w64-mingw32-wine"
EOF
fi
cat << EOF >> "${pkgdir}/${_prefix}/cargo/config"
rustflags = [
]
EOF
cat << EOF >> "${pkgdir}/${_prefix}/cargo/config"
[target.x86_64-pc-windows-gnu]
linker = "/usr/bin/x86_64-w64-mingw32-gcc"
EOF
if pacman -T "mingw-w64-wine" ; then
cat << EOF >> "${pkgdir}/${_prefix}/cargo/config"
runner = "/usr/bin/x86_64-w64-mingw32-wine"
EOF
fi
cat << EOF >> "${pkgdir}/${_prefix}/cargo/config"
rustflags = [
]
EOF
}
# vim:set ts=2 sw=2 et:
|