blob: 15a5576b8e742c685bbaea50ebc54fd2c121eea8 (
plain)
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
|
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Contributor: Shiz <hi@shiz.me>
# Contributor: Jeizsm <jeizsm@gmail.com>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=rust
pkgver=1.26.0
# TODO: bump to 6 as soon as we add llvm6
_llvmver=5
_bootver=1.25.0
pkgrel=0
pkgdesc="The Rust Programming Language"
url="http://www.rust-lang.org"
arch="x86_64"
license="Apache-2.0 BSD ISC MIT"
# gcc is needed at runtime just for linking. Someday rustc might invoke
# the linker directly, and then we'll only need binutils.
# See: https://github.com/rust-lang/rust/issues/11937
depends="$pkgname-stdlib=$pkgver-r$pkgrel gcc llvm-libunwind-dev musl-dev"
# * Rust is self-hosted, so you need rustc (and cargo) to build rustc...
# The last revision of this abuild that does not depend on itself (uses
# prebuilt rustc and cargo) is 8cb3112594f10a8cee5b5412c28a846acb63167f.
# * libffi-dev is needed just because we compile llvm with LLVM_ENABLE_FFI.
makedepends="
rust>=$_bootver
cargo
cmake
file
libffi-dev
llvm$_llvmver-dev
llvm$_llvmver-test-utils
python2
tar
zlib-dev
"
# This is needed for -src that contains some testing binaries.
options="!archcheck"
subpackages="$pkgname-dbg $pkgname-stdlib
$pkgname-gdb::noarch $pkgname-lldb::noarch $pkgname-doc"
source="https://static.rust-lang.org/dist/rustc-$pkgver-src.tar.gz
musl-fix-static-linking.patch
musl-fix-linux_musl_base.patch
llvm-with-ffi.patch
static-pie.patch
need-rpath.patch
minimize-rpath.patch
alpine-move-py-scripts-to-share.patch
alpine-change-rpath-to-rustlib.patch
alpine-target.patch
install-template-shebang.patch
check-rustc
"
builddir="$srcdir/rustc-$pkgver-src"
_rlibdir="usr/lib/rustlib/$CTARGET/lib"
_sharedir="usr/share/rust"
ldpath="/$_rlibdir"
prepare() {
default_prepare
cd "$builddir"
# Remove bundled dependencies.
rm -Rf src/llvm/
# Save untouched sources for packaging in -src subpackage.
cp -a "$builddir"/src "$srcdir"/rust-src
}
build() {
cd "$builddir"
# jemalloc is disabled, because it increases size of statically linked
# binaries produced by rustc (stripped hello_world 186 kiB vs. 358 kiB)
# for only tiny performance boost (even negative in some tests).
./configure \
--build="$CBUILD" \
--host="$CTARGET" \
--target="$CTARGET" \
--prefix="/usr" \
--release-channel="stable" \
--enable-local-rust \
--local-rust-root="/usr" \
--llvm-root="/usr/lib/llvm$_llvmver" \
--musl-root="/usr" \
--disable-docs \
--enable-llvm-link-shared \
--enable-option-checking \
--enable-locked-deps \
--enable-vendor \
--disable-jemalloc
RUST_BACKTRACE=1 \
RUSTC_CRT_STATIC="false" \
./x.py build -v
}
check() {
"$srcdir"/check-rustc "$builddir/build/$CTARGET/stage2/bin/rustc"
# XXX: There's some problem with these tests, we will figure it out later.
# cd "$builddir"
# make check \
# LD_LIBRARY_PATH="$_stage0dir/lib" \
# RUST_BACKTRACE=1 \
# RUST_CRT_STATIC="false" \
# VERBOSE=1
}
package() {
cd "$builddir"
RUST_BACKTRACE=1 \
RUSTC_CRT_STATIC="false" \
./x.py dist -v
local component; for component in rustc rust-std; do
tar -xf "build/dist/$component-$pkgver-$CTARGET.tar.gz"
./"$component-$pkgver-$CTARGET"/install.sh --destdir="$pkgdir" --prefix=/usr --disable-ldconfig
done
cd "$pkgdir"
# These libraries are identical to those under rustlib/. Since we have
# linked rustc/rustdoc against those under rustlib/, we can remove
# them. Read change-rpath-to-rustlib.patch for more info.
rm -r usr/lib/*.so
# These objects are for static linking with musl on non-musl systems.
rm $_rlibdir/crt*.o
# Shared objects should have executable flag.
chmod +x $_rlibdir/*.so
# Python scripts are noarch, so move them to /usr/share.
# Requires move-py-scripts-to-share.patch to be applied.
_mv usr/lib/rustlib/etc/*.py $_sharedir/etc/
rmdir -p usr/lib/rustlib/etc 2>/dev/null || true
# Remove some clutter.
cd usr/lib/rustlib
rm components install.log manifest-* rust-installer-version uninstall.sh
}
stdlib() {
pkgdesc="Standard library for Rust (static rlibs)"
_mv "$pkgdir"/$_rlibdir/*.rlib "$subpkgdir"/$_rlibdir/
}
gdb() {
pkgdesc="GDB pretty printers for Rust"
depends="$pkgname gdb"
mkdir -p "$subpkgdir"
cd "$subpkgdir"
_mv "$pkgdir"/usr/bin/rust-gdb usr/bin/
_mv "$pkgdir"/$_sharedir/etc/gdb_*.py $_sharedir/etc/
}
lldb() {
pkgdesc="LLDB pretty printers for Rust"
depends="$pkgname lldb py2-lldb"
mkdir -p "$subpkgdir"
cd "$subpkgdir"
_mv "$pkgdir"/usr/bin/rust-lldb usr/bin/
_mv "$pkgdir"/$_sharedir/etc/lldb_*.py $_sharedir/etc/
}
#src() {
# pkgdesc="$pkgdesc (source code)"
# depends="$pkgname"
# license="$license OFL-1.1 GPL-3.0-or-later GPL-3.0-with-GCC-exception CC-BY-SA-3.0 LGPL-3.0"
#
# mkdir -p "$subpkgdir"/usr/src
# mv "$srcdir"/rust-src "$subpkgdir"/usr/src/rust
#}
_mv() {
local dest; for dest; do true; done # get last argument
mkdir -p "$dest"
mv $@
}
sha512sums="6b0eac18eef1093dad4cbb57fccbc22a2e0b11459c11600c66eef539fa1972bbae2d89751e2d46a32a46a4572fd0d3264b1083bd13d9749b694e00cd4b3d8acc rustc-1.26.0-src.tar.gz
d26b0c87e2dce9f2aca561a47ed1ca987c4e1b272ab8b19c39433b63d4be03ca244ba97adc50e743fe50eb0b2f8109cd68a2f05e41d7411c58ef77ef253ca789 musl-fix-static-linking.patch
ed209fa8e44764fce9e38f46006910d632b81708be5d84d281aa40cf4f78fb9f8ccb0dcac55cb4e5a5855a4e52fc322b72772006c5d5d1d4545cf2668e60f381 musl-fix-linux_musl_base.patch
e40d41a6dc5d400d6672f1836cd5b9e00391f7beb52e872d87db76bc95a606ce6aaae737a0256a1e5fba77c83bb223818d214dbe87028d47be65fb43c101595c llvm-with-ffi.patch
a8ae797e487cb7722b2c88a641ae850d65997d296b1f9672d0ec23caff99846c6f2eaa27eb449fec31c51c3d490aee2900e722c3435fab95ed55a22fda583168 static-pie.patch
7bf81f58935e56ab673ce85e0c81b94cfb78a5bfbb8c220683a4cf71d75dfdf3861300abf3867c46594d2db894d00e5c8f65983a2b9bfe8966582adfa7d149e3 need-rpath.patch
d352614e7c774e181decae210140e789de7fc090327ff371981ad28a11ce51c8c01b27c1101a24bb84d75ed2f706f67868f7dbc52196d4ccdf4ebd2d6d6b6b5e minimize-rpath.patch
0c0aa7eeddeb578c320a94696a4437fbf083ef4d6f8049512de82548285f37ec4460b5d04f087dc303a5f62a09b5d13b7f0c4fbbdb0b321147ae030e7282ac07 alpine-move-py-scripts-to-share.patch
61aa415d754e9e01236481a1f3c9d5242f2d633e6f11b998e9ffcc07bf5c182d87c0c973dab6f10e4bb3ab4b4a4857bf9ed8dd664c49a65f6175d27db2774db1 alpine-change-rpath-to-rustlib.patch
b3be85bf54d03ba5a685c8e01246e047a169fedb1745182286fdb1ae8cb23e6723318276ef36ee0c54bf7e6d2bc86a46c479fb6c822b8b548d35fa094dde05d2 alpine-target.patch
7d59258d4462eba0207739a5c0c8baf1f19d9a396e5547bb4d59d700eb94d50ba6add2e523f3e94e29e993821018594625ea4ac86304fb58f7f8c82622a26ab0 install-template-shebang.patch
79549055dea81379c890b495c82456ab497a9179ec6702c59e11d0748bc668f47fc3d6a69c27a0545bb87c01318631dffc69260bf2d4badc75f53cbf7fad7528 check-rustc"
|