db-move: moved seahorse from [testing] to [extra] (x86_64)
[arch-packages.git] / rust / trunk / PKGBUILD
blobfb10da7c66d6cde4ee77e39ee8d014af6f905459
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>
7 pkgbase=rust
8 pkgname=(
9   rust
10   lib32-rust-libs
11   rust-musl
12   rust-wasm
13   rust-src
15 epoch=1
16 pkgver=1.69.0
17 pkgrel=3
18 pkgdesc="Systems programming language focused on safety, speed and concurrency"
19 url=https://www.rust-lang.org/
20 arch=(x86_64)
21 license=(
22   Apache
23   MIT
25 options=(
26   !debug
27   !emptydirs
28   !lto
29   !strip
31 depends=(
32   curl
33   gcc
34   gcc-libs
35   libssh2
36   llvm-libs
38 makedepends=(
39   cmake
40   lib32-gcc-libs
41   libffi
42   lld
43   llvm
44   musl
45   ninja
46   perl
47   python
48   rust
49   wasi-libc
51 checkdepends=(
52   gdb
53   procps-ng
55 source=(
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'
63         'SKIP'
64         'd1a029499dd221b24124b193f7d42e9cb766d4bb9c4faa61a4b60007550693c98f1d1ab6793dd16b9f5a229bc70f805d6cd5eca6e744b34c0fd2413701bc58b6'
65         '9752dc3b5fc2248c8bec4efbb3d927088d48d9416229d545a05180374549a0dda6e9d6d9a8d0a3b03437f2e3c54f9c153aab3281d46411f4c81559033b8fb04a'
66         'a92b1eb9bc4101e055f89d9810c99e6e6472b3bb27bb01f8ea8a4b35f7e25512858e1555c2807eb7e8175df22c2e7937753d6787013920f9c76587e71f8df2f4'
67         '9f3f911088a22101f8966dc16a1ecc65da5facaad5c169d9464e721aa452dd45968d359a5b35ae74ff23bd98d44c60cb04c0b8bc89e10fb99549c1670371c902')
68 validpgpkeys=(
69   108F66205EAEB0AAA8DD5E1C85AB96E6FA1BE5FE  # Rust Language (Tag and Release Signing Key) <rust-key@rust-lang.org>
70   474E22316ABF4785A88C6E8EA2C794A986419D8A  # Tom Stellard <tstellar@redhat.com>
73 prepare() {
74   cd rustc-$pkgver-src
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
84   # Use our wasm-ld
85   patch -Np1 -i ../0003-compiler-Use-wasm-ld-for-wasm-targets.patch
87   cat >config.toml <<END
88 changelog-seen = 2
89 profile = "user"
91 [llvm]
92 link-shared = true
94 [build]
95 target = [
96   "x86_64-unknown-linux-gnu",
97   "i686-unknown-linux-gnu",
98   "x86_64-unknown-linux-musl",
99   "wasm32-unknown-unknown",
100   "wasm32-wasi",
102 cargo = "/usr/bin/cargo"
103 rustc = "/usr/bin/rustc"
104 rustfmt = "/usr/bin/rustfmt"
105 locked-deps = true
106 vendor = true
107 tools = [
108   "cargo",
109   "clippy",
110   "rustdoc",
111   "rustfmt",
112   "rust-analyzer",
113   "analysis",
114   "src",
115   "rust-demangler",
117 sanitizers = true
118 profiler = true
120 # Generating docs fails with the wasm32-* targets
121 docs = false
123 [install]
124 prefix = "/usr"
126 [rust]
127 debuginfo-level-std = 2
128 channel = "stable"
129 description = "Arch Linux $pkgbase $epoch:$pkgver-$pkgrel"
130 rpath = false
131 backtrace-on-ice = true
132 remap-debuginfo = true
133 jemalloc = 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
144 [dist]
145 compression-formats = ["gz"]
147 [target.x86_64-unknown-linux-gnu]
148 cc = "/usr/bin/gcc"
149 cxx = "/usr/bin/g++"
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]
155 cc = "/usr/bin/gcc"
156 cxx = "/usr/bin/g++"
157 ar = "/usr/bin/gcc-ar"
158 ranlib = "/usr/bin/gcc-ranlib"
160 [target.x86_64-unknown-linux-musl]
161 sanitizers = false
162 musl-root = "/usr/lib/musl"
164 [target.wasm32-unknown-unknown]
165 sanitizers = false
166 profiler = false
168 [target.wasm32-wasi]
169 sanitizers = false
170 profiler = false
171 wasi-root = "/usr/share/wasi-sysroot"
175 _pick() {
176   local p="$1" f d; shift
177   for f; do
178     d="$srcdir/$p/$f"
179     mkdir -p "$(dirname "$d")"
180     mv "$f" "$d"
181     rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
182   done
185 build() {
186   cd rustc-$pkgver-src
188   export RUST_BACKTRACE=1
190   DESTDIR="$srcdir/dest-rust" python ./x.py install -j "$(nproc)"
192   cd ../dest-rust
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-*
198   # built separately
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
203   mkdir -p usr/lib32
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
219 package_rust() {
220   optdepends=(
221     'gdb: rust-gdb script'
222     'lldb: rust-lldb script'
223   )
224   provides=(
225     cargo
226     rustfmt
227   )
228   conflicts=(
229     cargo
230     'rust-docs<1:1.56.1-3'
231     rustfmt
232   )
233   replaces=(
234     cargo
235     cargo-tree
236     'rust-docs<1:1.56.1-3'
237     rustfmt
238   )
240   cp -a dest-rust/* "$pkgdir"
243 package_lib32-rust-libs() {
244   pkgdesc="32-bit target and libraries for Rust"
245   depends=(
246     lib32-gcc-libs
247     rust
248   )
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"
261   depends=(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"
271   depends=(
272     lld
273     rust
274   )
276   cp -a dest-wasm/* "$pkgdir"
278   mkdir -p "$pkgdir/usr/share/licenses"
279   ln -s rust "$pkgdir/usr/share/licenses/$pkgname"
282 package_rust-src() {
283   pkgdesc="Source code for the Rust standard library"
284   depends=(rust)
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: