sbcl 2.1.11 rebuild
[arch-packages.git] / rust / repos / extra-x86_64 / PKGBUILD
blobf05d522af37d5d97a86e34ce661ae0a9e88464e0
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=(rust lib32-rust-libs rust-musl rust-wasm rust-src)
9 epoch=1
10 pkgver=1.57.0
11 pkgrel=1
12 pkgdesc="Systems programming language focused on safety, speed and concurrency"
13 url=https://www.rust-lang.org/
14 arch=(x86_64)
15 license=(MIT Apache)
16 options=(!emptydirs !strip)
17 _llvm_ver=13.0.0
18 depends=(gcc-libs llvm-libs curl libssh2 gcc)
19 makedepends=(rust "llvm=$_llvm_ver" libffi lib32-gcc-libs perl python cmake musl
20              ninja wasi-libc lld)
21 checkdepends=(procps-ng gdb)
22 source=(
23   "https://static.rust-lang.org/dist/rustc-$pkgver-src.tar.gz"{,.asc}
24   "https://github.com/llvm/llvm-project/releases/download/llvmorg-$_llvm_ver/compiler-rt-$_llvm_ver.src.tar.xz"{,.sig}
25   0001-cargo-Change-libexec-dir.patch
26   0001-bootstrap-Change-libexec-dir.patch
27   0002-compiler-Change-LLVM-targets.patch
28   0003-compiler-Use-wasm-ld-for-wasm-targets.patch
30 sha256sums=('3546f9c3b91b1f8b8efd26c94d6b50312c08210397b4072ed2748e2bd4445c1a'
31             'SKIP'
32             '4c3602d76c7868a96b30c36165c4b7643e2a20173fced7e071b4baeb2d74db3f'
33             'SKIP'
34             '0f8cfbe0387dd62909fe9cb9523223ae1c2319494e2caf5fa4d0592198631b3e'
35             'a2a8a7c6a5732f79cc92f81d3c8380589c4e2b9a996fb565bbefe42f66b62597'
36             '977da945985dce4484ace8794cbc91241b1f3c27311c1a8b201231db6e1d19e5'
37             'fcf3c4442ba6a9e59415652ce8514428b2e37b80c5fe7d07fb44259ad37abafb')
38 validpgpkeys=(108F66205EAEB0AAA8DD5E1C85AB96E6FA1BE5FE  # Rust Language (Tag and Release Signing Key) <rust-key@rust-lang.org>
39               474E22316ABF4785A88C6E8EA2C794A986419D8A  # Tom Stellard <tstellar@redhat.com>
40               B6C8F98282B944E3B0D5C2530FC3042E345AD05D) # Hans Wennborg <hans@chromium.org>
42 prepare() {
43   cd rustc-$pkgver-src
45   # Patch bootstrap and cargo so credential helpers
46   # are in /usr/lib instead of /usr/libexec
47   patch -d src/tools/cargo -Np1 < ../0001-cargo-Change-libexec-dir.patch
48   patch -Np1 -i ../0001-bootstrap-Change-libexec-dir.patch
50   # Use our *-pc-linux-gnu targets, making LTO with clang simpler
51   patch -Np1 -i ../0002-compiler-Change-LLVM-targets.patch
53   # Use our wasm-ld
54   patch -Np1 -i ../0003-compiler-Use-wasm-ld-for-wasm-targets.patch
56   cat >config.toml <<END
57 changelog-seen = 2
58 profile = "user"
60 [llvm]
61 link-shared = true
63 [build]
64 target = [
65   "x86_64-unknown-linux-gnu",
66   "i686-unknown-linux-gnu",
67   "x86_64-unknown-linux-musl",
68   "wasm32-unknown-unknown",
69   "wasm32-wasi",
71 cargo = "/usr/bin/cargo"
72 rustc = "/usr/bin/rustc"
73 rustfmt = "/usr/bin/rustfmt"
74 locked-deps = true
75 vendor = true
76 tools = ["cargo", "rls", "clippy", "rustfmt", "analysis", "src", "rust-demangler"]
77 sanitizers = true
78 profiler = true
80 # Generating docs fails with the wasm32-* targets
81 docs = false
83 [install]
84 prefix = "/usr"
86 [rust]
87 debuginfo-level-std = 2
88 channel = "stable"
89 description = "Arch Linux $pkgbase $epoch:$pkgver-$pkgrel"
90 rpath = false
91 backtrace-on-ice = true
92 remap-debuginfo = true
93 jemalloc = true
95 # LLVM crashes when passing an object through ThinLTO twice.  This is triggered
96 # when using rust code in cross-language LTO if libstd was built using ThinLTO.
97 # http://blog.llvm.org/2019/09/closing-gap-cross-language-lto-between.html
98 # https://github.com/rust-lang/rust/issues/54872
99 codegen-units-std = 1
101 [dist]
102 compression-formats = ["gz"]
104 [target.x86_64-unknown-linux-gnu]
105 llvm-config = "/usr/bin/llvm-config"
107 [target.x86_64-unknown-linux-musl]
108 sanitizers = false
109 musl-root = "/usr/lib/musl"
111 [target.wasm32-unknown-unknown]
112 sanitizers = false
113 profiler = false
115 [target.wasm32-wasi]
116 sanitizers = false
117 profiler = false
118 wasi-root = "/usr/share/wasi-sysroot"
122 _pick() {
123   local p="$1" f d; shift
124   for f; do
125     d="$srcdir/$p/$f"
126     mkdir -p "$(dirname "$d")"
127     mv "$f" "$d"
128     rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
129   done
132 build() {
133   cd rustc-$pkgver-src
135   export RUST_BACKTRACE=1
136   export RUST_COMPILER_RT_ROOT="$srcdir/compiler-rt-$_llvm_ver.src"
137   [[ -d $RUST_COMPILER_RT_ROOT ]]
139   DESTDIR="$srcdir/dest-rust" python ./x.py install -j "$(nproc)"
141   cd ../dest-rust
143   # delete unnecessary files, e.g. files only used for the uninstall script
144   rm usr/lib/rustlib/{components,install.log,rust-installer-version,uninstall.sh}
145   rm usr/lib/rustlib/manifest-*
147   # rustbuild always installs copies of the shared libraries to /usr/lib,
148   # overwrite them with symlinks to the per-architecture versions
149   mkdir -p usr/lib32
150   ln -srft usr/lib   usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/*.so
151   ln -srft usr/lib32 usr/lib/rustlib/i686-unknown-linux-gnu/lib/*.so
153   mkdir -p usr/share/bash-completion
154   mv etc/bash_completion.d usr/share/bash-completion/completions
156   mkdir -p usr/share/licenses/rust
157   mv -t usr/share/licenses/rust usr/share/doc/rust/{COPYRIGHT,LICENSE*}
159   _pick dest-i686 usr/lib/rustlib/i686-unknown-linux-gnu usr/lib32
160   _pick dest-musl usr/lib/rustlib/x86_64-unknown-linux-musl
161   _pick dest-wasm usr/lib/rustlib/wasm32-*
162   _pick dest-src  usr/lib/rustlib/src
165 package_rust() {
166   optdepends=('lldb: rust-lldb script'
167               'gdb: rust-gdb script')
168   provides=(cargo rustfmt)
169   conflicts=(cargo rustfmt 'rust-docs<1:1.56.1-3')
170   replaces=(cargo rustfmt cargo-tree 'rust-docs<1:1.56.1-3')
172   cp -a dest-rust/* "$pkgdir"
175 package_lib32-rust-libs() {
176   pkgdesc="32-bit target and libraries for Rust"
177   depends=(rust lib32-gcc-libs)
178   provides=(lib32-rust)
179   conflicts=(lib32-rust)
180   replaces=(lib32-rust)
182   cp -a dest-i686/* "$pkgdir"
184   mkdir -p "$pkgdir/usr/share/licenses"
185   ln -s rust "$pkgdir/usr/share/licenses/$pkgname"
188 package_rust-musl() {
189   pkgdesc="Musl target for Rust"
190   depends=(rust)
192   cp -a dest-musl/* "$pkgdir"
194   mkdir -p "$pkgdir/usr/share/licenses"
195   ln -s rust "$pkgdir/usr/share/licenses/$pkgname"
198 package_rust-wasm() {
199   pkgdesc="WebAssembly targets for Rust"
200   depends=(rust lld)
202   cp -a dest-wasm/* "$pkgdir"
204   mkdir -p "$pkgdir/usr/share/licenses"
205   ln -s rust "$pkgdir/usr/share/licenses/$pkgname"
208 package_rust-src() {
209   pkgdesc="Source code for the Rust standard library"
210   depends=(rust)
212   cp -a dest-src/* "$pkgdir"
214   mkdir -p "$pkgdir/usr/share/licenses"
215   ln -s rust "$pkgdir/usr/share/licenses/$pkgname"
218 # vim:set ts=2 sw=2 et: