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/
53 "https://static.rust-lang.org/dist/rustc-$pkgver-src.tar.gz"{,.asc}
54 0001-cargo-Change-libexec-dir.patch
55 0001-bootstrap-Change-libexec-dir.patch
56 0002-compiler-Change-LLVM-targets.patch
57 0003-compiler-Use-wasm-ld-for-wasm-targets.patch
59 b2sums=('acc31c33a4b9ed7af2866007b995a8be074fc87d31ee20540b4caa926277e5f7982c8cecd16f25d6e4fa4986f1181a30f5c0260ec6b9cf6260c742b2a94c1581'
61 'dce1c2340b172753b9d56dcc9d401e4cd9c66d64721c97e256974c18f17b0489e65e3732ef4e15538ea6e07c34f1269775a51c0c7c72e63a62f41ff258ce9ec2'
62 '01dee52ef899c0545cde37b5e1ba3ecfd5def3785145ed9f440df12945885311b63ff974294c1efed65b25b01bdb5cea37d7830e8d9775daefec8c1bcd3e159b'
63 '66c5cf262c4b865cdcc238d88aad4aa46e0861de0b4e20b5e86f7f1c312f7a40df0f9477fbc494949a99f51e9eb93537c072270e9bd20dfa79eb5cbe0d850e0f'
64 '9f3f911088a22101f8966dc16a1ecc65da5facaad5c169d9464e721aa452dd45968d359a5b35ae74ff23bd98d44c60cb04c0b8bc89e10fb99549c1670371c902')
65 validpgpkeys=(108F66205EAEB0AAA8DD5E1C85AB96E6FA1BE5FE # Rust Language (Tag and Release Signing Key) <rust-key@rust-lang.org>
66 474E22316ABF4785A88C6E8EA2C794A986419D8A) # Tom Stellard <tstellar@redhat.com>
71 # Patch bootstrap and cargo so credential helpers
72 # are in /usr/lib instead of /usr/libexec
73 patch -d src/tools/cargo -Np1 < ../0001-cargo-Change-libexec-dir.patch
74 patch -Np1 -i ../0001-bootstrap-Change-libexec-dir.patch
76 # Use our *-pc-linux-gnu targets, making LTO with clang simpler
77 patch -Np1 -i ../0002-compiler-Change-LLVM-targets.patch
80 patch -Np1 -i ../0003-compiler-Use-wasm-ld-for-wasm-targets.patch
82 cat >config.toml <<END
91 "x86_64-unknown-linux-gnu",
92 "i686-unknown-linux-gnu",
93 "x86_64-unknown-linux-musl",
94 "wasm32-unknown-unknown",
97 cargo = "/usr/bin/cargo"
98 rustc = "/usr/bin/rustc"
99 rustfmt = "/usr/bin/rustfmt"
114 # Generating docs fails with the wasm32-* targets
121 debuginfo-level-std = 2
123 description = "Arch Linux $pkgbase $epoch:$pkgver-$pkgrel"
125 backtrace-on-ice = true
126 remap-debuginfo = true
129 # LLVM crashes when passing an object through ThinLTO twice. This is triggered
130 # when using rust code in cross-language LTO if libstd was built using ThinLTO.
131 # http://blog.llvm.org/2019/09/closing-gap-cross-language-lto-between.html
132 # https://github.com/rust-lang/rust/issues/54872
133 codegen-units-std = 1
135 # musl target produces warnings
136 deny-warnings = false
139 compression-formats = ["gz"]
141 [target.x86_64-unknown-linux-gnu]
144 ar = "/usr/bin/gcc-ar"
145 ranlib = "/usr/bin/gcc-ranlib"
146 llvm-config = "/usr/bin/llvm-config"
148 [target.i686-unknown-linux-gnu]
151 ar = "/usr/bin/gcc-ar"
152 ranlib = "/usr/bin/gcc-ranlib"
154 [target.x86_64-unknown-linux-musl]
156 musl-root = "/usr/lib/musl"
158 [target.wasm32-unknown-unknown]
165 wasi-root = "/usr/share/wasi-sysroot"
170 local p="$1" f d; shift
173 mkdir -p "$(dirname "$d")"
175 rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
182 export RUST_BACKTRACE=1
184 DESTDIR="$srcdir/dest-rust" python ./x.py install -j "$(nproc)"
188 # delete unnecessary files, e.g. files only used for the uninstall script
189 rm usr/lib/rustlib/{components,install.log,rust-installer-version,uninstall.sh}
190 rm usr/lib/rustlib/manifest-*
192 # rustbuild always installs copies of the shared libraries to /usr/lib,
193 # overwrite them with symlinks to the per-architecture versions
195 ln -srft usr/lib usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/*.so
196 ln -srft usr/lib32 usr/lib/rustlib/i686-unknown-linux-gnu/lib/*.so
198 mkdir -p usr/share/bash-completion
199 mv etc/bash_completion.d usr/share/bash-completion/completions
201 mkdir -p usr/share/licenses/rust
202 mv -t usr/share/licenses/rust usr/share/doc/rust/{COPYRIGHT,LICENSE*}
204 _pick dest-i686 usr/lib/rustlib/i686-unknown-linux-gnu usr/lib32
205 _pick dest-musl usr/lib/rustlib/x86_64-unknown-linux-musl
206 _pick dest-wasm usr/lib/rustlib/wasm32-*
207 _pick dest-src usr/lib/rustlib/src
212 'gdb: rust-gdb script'
213 'lldb: rust-lldb script'
221 'rust-docs<1:1.56.1-3'
227 'rust-docs<1:1.56.1-3'
231 cp -a dest-rust/* "$pkgdir"
234 package_lib32-rust-libs() {
235 pkgdesc="32-bit target and libraries for Rust"
240 provides=(lib32-rust)
241 conflicts=(lib32-rust)
242 replaces=(lib32-rust)
244 cp -a dest-i686/* "$pkgdir"
246 mkdir -p "$pkgdir/usr/share/licenses"
247 ln -s rust "$pkgdir/usr/share/licenses/$pkgname"
250 package_rust-musl() {
251 pkgdesc="Musl target for Rust"
254 cp -a dest-musl/* "$pkgdir"
256 mkdir -p "$pkgdir/usr/share/licenses"
257 ln -s rust "$pkgdir/usr/share/licenses/$pkgname"
260 package_rust-wasm() {
261 pkgdesc="WebAssembly targets for Rust"
267 cp -a dest-wasm/* "$pkgdir"
269 mkdir -p "$pkgdir/usr/share/licenses"
270 ln -s rust "$pkgdir/usr/share/licenses/$pkgname"
274 pkgdesc="Source code for the Rust standard library"
277 cp -a dest-src/* "$pkgdir"
279 mkdir -p "$pkgdir/usr/share/licenses"
280 ln -s rust "$pkgdir/usr/share/licenses/$pkgname"
283 # vim:set ts=2 sw=2 et: