1 # Maintainer: Johannes Löthberg <johannes@kyriasis.com>
2 # Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
3 # Contributor: Alexander F Rødseth <xyproto@archlinux.org>
4 # Contributor: Daniel Micay <danielmicay@gmail.com>
5 # Contributor: userwithuid <userwithuid@gmail.com>
18 pkgdesc="Systems programming language focused on safety, speed and concurrency"
19 url=https://www.rust-lang.org/
56 "https://static.rust-lang.org/dist/rustc-$pkgver-src.tar.gz"{,.asc}
57 0001-cargo-Change-libexec-dir.patch
58 0001-bootstrap-Change-libexec-dir.patch
59 0002-compiler-Change-LLVM-targets.patch
60 0003-compiler-Use-wasm-ld-for-wasm-targets.patch
62 b2sums=('1440ad3e7e52d1e31752c8a44f9e626b9c2b0388f7285ddbdf1d0f7802724e707daffe19c6ba4aec62c3dba0e60ec2426ebecf69268b1e20a0c89860964a64f3'
64 'd1a029499dd221b24124b193f7d42e9cb766d4bb9c4faa61a4b60007550693c98f1d1ab6793dd16b9f5a229bc70f805d6cd5eca6e744b34c0fd2413701bc58b6'
65 '9752dc3b5fc2248c8bec4efbb3d927088d48d9416229d545a05180374549a0dda6e9d6d9a8d0a3b03437f2e3c54f9c153aab3281d46411f4c81559033b8fb04a'
66 'a92b1eb9bc4101e055f89d9810c99e6e6472b3bb27bb01f8ea8a4b35f7e25512858e1555c2807eb7e8175df22c2e7937753d6787013920f9c76587e71f8df2f4'
67 '9f3f911088a22101f8966dc16a1ecc65da5facaad5c169d9464e721aa452dd45968d359a5b35ae74ff23bd98d44c60cb04c0b8bc89e10fb99549c1670371c902')
69 108F66205EAEB0AAA8DD5E1C85AB96E6FA1BE5FE # Rust Language (Tag and Release Signing Key) <rust-key@rust-lang.org>
70 474E22316ABF4785A88C6E8EA2C794A986419D8A # Tom Stellard <tstellar@redhat.com>
76 # Patch bootstrap and cargo so credential helpers
77 # are in /usr/lib instead of /usr/libexec
78 patch -d src/tools/cargo -Np1 < ../0001-cargo-Change-libexec-dir.patch
79 patch -Np1 -i ../0001-bootstrap-Change-libexec-dir.patch
81 # Use our *-pc-linux-gnu targets, making LTO with clang simpler
82 patch -Np1 -i ../0002-compiler-Change-LLVM-targets.patch
85 patch -Np1 -i ../0003-compiler-Use-wasm-ld-for-wasm-targets.patch
87 cat >config.toml <<END
96 "x86_64-unknown-linux-gnu",
97 "i686-unknown-linux-gnu",
98 "x86_64-unknown-linux-musl",
99 "wasm32-unknown-unknown",
102 cargo = "/usr/bin/cargo"
103 rustc = "/usr/bin/rustc"
104 rustfmt = "/usr/bin/rustfmt"
120 # Generating docs fails with the wasm32-* targets
127 debuginfo-level-std = 2
129 description = "Arch Linux $pkgbase $epoch:$pkgver-$pkgrel"
131 backtrace-on-ice = true
132 remap-debuginfo = true
135 # LLVM crashes when passing an object through ThinLTO twice. This is triggered
136 # when using rust code in cross-language LTO if libstd was built using ThinLTO.
137 # http://blog.llvm.org/2019/09/closing-gap-cross-language-lto-between.html
138 # https://github.com/rust-lang/rust/issues/54872
139 codegen-units-std = 1
141 # musl target produces warnings
142 deny-warnings = false
145 compression-formats = ["gz"]
147 [target.x86_64-unknown-linux-gnu]
150 ar = "/usr/bin/gcc-ar"
151 ranlib = "/usr/bin/gcc-ranlib"
152 llvm-config = "/usr/bin/llvm-config"
154 [target.i686-unknown-linux-gnu]
157 ar = "/usr/bin/gcc-ar"
158 ranlib = "/usr/bin/gcc-ranlib"
160 [target.x86_64-unknown-linux-musl]
162 musl-root = "/usr/lib/musl"
164 [target.wasm32-unknown-unknown]
171 wasi-root = "/usr/share/wasi-sysroot"
176 local p="$1" f d; shift
179 mkdir -p "$(dirname "$d")"
181 rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
188 export RUST_BACKTRACE=1
190 DESTDIR="$srcdir/dest-rust" python ./x.py install -j "$(nproc)"
194 # delete unnecessary files, e.g. files only used for the uninstall script
195 rm usr/lib/rustlib/{components,install.log,rust-installer-version,uninstall.sh}
196 rm usr/lib/rustlib/manifest-*
199 rm usr/bin/rust-analyzer
201 # rustbuild always installs copies of the shared libraries to /usr/lib,
202 # overwrite them with symlinks to the per-architecture versions
204 ln -srft usr/lib usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/*.so
205 ln -srft usr/lib32 usr/lib/rustlib/i686-unknown-linux-gnu/lib/*.so
207 mkdir -p usr/share/bash-completion
208 mv etc/bash_completion.d usr/share/bash-completion/completions
210 mkdir -p usr/share/licenses/rust
211 mv -t usr/share/licenses/rust usr/share/doc/rust/{COPYRIGHT,LICENSE*}
213 _pick dest-i686 usr/lib/rustlib/i686-unknown-linux-gnu usr/lib32
214 _pick dest-musl usr/lib/rustlib/x86_64-unknown-linux-musl
215 _pick dest-wasm usr/lib/rustlib/wasm32-*
216 _pick dest-src usr/lib/rustlib/src
221 'gdb: rust-gdb script'
222 'lldb: rust-lldb script'
230 'rust-docs<1:1.56.1-3'
236 'rust-docs<1:1.56.1-3'
240 cp -a dest-rust/* "$pkgdir"
243 package_lib32-rust-libs() {
244 pkgdesc="32-bit target and libraries for Rust"
249 provides=(lib32-rust)
250 conflicts=(lib32-rust)
251 replaces=(lib32-rust)
253 cp -a dest-i686/* "$pkgdir"
255 mkdir -p "$pkgdir/usr/share/licenses"
256 ln -s rust "$pkgdir/usr/share/licenses/$pkgname"
259 package_rust-musl() {
260 pkgdesc="Musl target for Rust"
263 cp -a dest-musl/* "$pkgdir"
265 mkdir -p "$pkgdir/usr/share/licenses"
266 ln -s rust "$pkgdir/usr/share/licenses/$pkgname"
269 package_rust-wasm() {
270 pkgdesc="WebAssembly targets for Rust"
276 cp -a dest-wasm/* "$pkgdir"
278 mkdir -p "$pkgdir/usr/share/licenses"
279 ln -s rust "$pkgdir/usr/share/licenses/$pkgname"
283 pkgdesc="Source code for the Rust standard library"
286 cp -a dest-src/* "$pkgdir"
288 mkdir -p "$pkgdir/usr/share/licenses"
289 ln -s rust "$pkgdir/usr/share/licenses/$pkgname"
292 # vim:set ts=2 sw=2 et: