]>
Commit | Line | Data |
---|---|---|
e361528e ER |
1 | # TODO |
2 | # - consider a rust-std package containing .../rustlib/$target | |
3 | # This might allow multilib cross-compilation to work naturally. | |
e361528e ER |
4 | # |
5 | # Conditional build: | |
e8f16183 | 6 | %bcond_with bootstrap # bootstrap using precompiled binaries |
5b9d67b0 JB |
7 | %bcond_without full_debuginfo # full debuginfo vs only std debuginfo (full takes gigabytes of memory to build) |
8 | %bcond_without system_llvm # system LLVM | |
cace5bf9 | 9 | %bcond_with tests # build without tests |
e361528e | 10 | |
8a073211 JR |
11 | # The channel can be stable, beta, or nightly |
12 | %define channel stable | |
13 | ||
e361528e | 14 | %if "%{channel}" == "stable" |
8a073211 | 15 | %define rustc_package rustc-%{version}-src |
e361528e | 16 | %else |
8a073211 | 17 | %define rustc_package rustc-%{channel}-src |
e361528e ER |
18 | %endif |
19 | ||
20 | # To bootstrap from scratch, set the channel and date from src/stage0.txt | |
21 | # e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24 | |
22 | # or nightly wants some beta-YYYY-MM-DD | |
9ee62e7d JP |
23 | %define bootstrap_rust 1.24.0 |
24 | %define bootstrap_cargo 0.25.0 | |
25 | %define bootstrap_date 2018-02-15 | |
e361528e ER |
26 | |
27 | Summary: The Rust Programming Language | |
e8f16183 | 28 | Summary(pl.UTF-8): Język programowania Rust |
e361528e | 29 | Name: rust |
9ee62e7d | 30 | Version: 1.25.0 |
8f4c23f4 | 31 | Release: 2 |
d1b96fd8 | 32 | # Licenses: (rust itself) and (bundled libraries) |
e8f16183 | 33 | License: (Apache v2.0 or MIT) and (BSD and ISC and MIT) |
e361528e | 34 | Group: Development/Languages |
d6d4cb2b | 35 | Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.gz |
9ee62e7d | 36 | # Source0-md5: d8d4d30c8d0b905f978bee3fdd618db5 |
8a073211 | 37 | Source1: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-x86_64-unknown-linux-gnu.tar.gz |
9ee62e7d | 38 | # Source1-md5: 61be17f80e1811211450e5b733624232 |
8a073211 | 39 | Source2: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-i686-unknown-linux-gnu.tar.gz |
9ee62e7d | 40 | # Source2-md5: 5568788cd5d96173a89bd0e82a2aa356 |
e361528e | 41 | URL: https://www.rust-lang.org/ |
e8f16183 JB |
42 | # for src/compiler-rt |
43 | BuildRequires: cmake >= 3.4.3 | |
e361528e | 44 | BuildRequires: curl |
d1b96fd8 | 45 | BuildRequires: libstdc++-devel |
5b9d67b0 | 46 | %{?with_system_llvm:BuildRequires: llvm-devel} |
d1b96fd8 | 47 | BuildRequires: ncurses-devel |
e8f16183 | 48 | BuildRequires: python >= 1:2.7 |
e361528e ER |
49 | BuildRequires: zlib-devel |
50 | %if %{without bootstrap} | |
d6d4cb2b | 51 | BuildRequires: %{name} >= %{bootstrap_rust} |
d1b96fd8 | 52 | BuildRequires: cargo >= %{bootstrap_cargo} |
ff5a5e0b | 53 | BuildConflicts: %{name} > %{version} |
e361528e ER |
54 | %endif |
55 | # make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs | |
56 | BuildRequires: procps | |
e361528e ER |
57 | # The C compiler is needed at runtime just for linking. Someday rustc might |
58 | # invoke the linker directly, and then we'll only need binutils. | |
59 | # https://github.com/rust-lang/rust/issues/11937 | |
60 | Requires: gcc | |
61 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
62 | # Only x86_64 and i686 are Tier 1 platforms at this time. | |
63 | # https://doc.rust-lang.org/stable/book/getting-started.html#tier-1 | |
d36946a0 | 64 | ExclusiveArch: %{x8664} %{ix86} |
e361528e | 65 | |
8a073211 | 66 | %define rust_triple %{_target_cpu}-unknown-linux-gnu |
e361528e ER |
67 | |
68 | %if %{without bootstrap} | |
8a073211 | 69 | %define local_rust_root %{_prefix} |
e361528e | 70 | %else |
8a073211 JR |
71 | %define bootstrap_root rust-%{bootstrap_rust}-%{rust_triple} |
72 | %define local_rust_root %{_builddir}/%{rustc_package}/%{bootstrap_root} | |
e361528e ER |
73 | %endif |
74 | ||
18a1004b JR |
75 | # We're going to override --libdir when configuring to get rustlib into a |
76 | # common path, but we'll fix the shared libraries during install. | |
5b9d67b0 | 77 | # Without this ugly hack, rust would not be able to build itself |
18a1004b JR |
78 | # for non-bootstrap build, lib64 is just too complicated for it. |
79 | %define common_libdir %{_prefix}/lib | |
80 | %define rustlibdir %{common_libdir}/rustlib | |
81 | ||
19f98749 | 82 | # once_call/once_callable non-function libstdc++ symbols |
8f4c23f4 | 83 | %define skip_post_check_so 'librustc.*llvm.*\.so.*' |
19f98749 | 84 | |
e361528e | 85 | # ALL Rust libraries are private, because they don't keep an ABI. |
8a073211 JR |
86 | %define _noautoreqfiles lib.*-[[:xdigit:]]{8}[.]so.* |
87 | %define _noautoprovfiles lib.*-[[:xdigit:]]{8}[.]so.* | |
e361528e ER |
88 | |
89 | %description | |
90 | Rust is a systems programming language that runs blazingly fast, | |
91 | prevents segfaults, and guarantees thread safety. | |
92 | ||
93 | This package includes the Rust compiler, standard library, and | |
94 | documentation generator. | |
95 | ||
e8f16183 JB |
96 | %description -l pl.UTF-8 |
97 | Rust to systemowy język programowania działający bardzo szybko, | |
98 | zapobiegający naruszeniom ochrony pamięci i gwarantujący | |
99 | bezpieczną wielowątkowość. | |
100 | ||
d1b96fd8 JR |
101 | %package debugger-common |
102 | Summary: Common debugger pretty printers for Rust | |
e8f16183 | 103 | Summary(pl.UTF-8): Narzędzia wypisujące struktury Rusa wspólne dla różnych debuggerów |
d1b96fd8 JR |
104 | Group: Development/Debuggers |
105 | BuildArch: noarch | |
106 | ||
107 | %description debugger-common | |
e8f16183 JB |
108 | This package includes the common functionality for rust-gdb and |
109 | rust-lldb. | |
110 | ||
111 | %description debugger-common -l pl.UTF-8 | |
112 | Ten pakiet zawiera wspólny kod dla pakietów rust-gdb i rust-lldb. | |
d1b96fd8 | 113 | |
e361528e ER |
114 | %package gdb |
115 | Summary: GDB pretty printers for Rust | |
e8f16183 | 116 | Summary(pl.UTF-8): Ładne wypisywanie struktur Rusta w GDB |
d1b96fd8 JR |
117 | Group: Development/Debuggers |
118 | Requires: %{name}-debugger-common = %{version}-%{release} | |
e361528e | 119 | Requires: gdb |
e361528e | 120 | BuildArch: noarch |
e361528e ER |
121 | |
122 | %description gdb | |
123 | This package includes the rust-gdb script, which allows easier | |
124 | debugging of Rust programs. | |
125 | ||
e8f16183 JB |
126 | %description gdb -l pl.UTF-8 |
127 | Ten pakiet zawiera skrypt rust-gdb, pozwalający na łatwiejsze | |
128 | odpluskwianie programów w języku Rust. | |
129 | ||
d1b96fd8 JR |
130 | %package lldb |
131 | Summary: LLDB pretty printers for Rust | |
e8f16183 | 132 | Summary(pl.UTF-8): Ładne wypisywanie struktur Rusta w LLDB |
d1b96fd8 JR |
133 | Group: Development/Debuggers |
134 | Requires: %{name}-debugger-common = %{version}-%{release} | |
135 | Requires: lldb | |
d1b96fd8 JR |
136 | BuildArch: noarch |
137 | ||
138 | %description lldb | |
139 | This package includes the rust-lldb script, which allows easier | |
140 | debugging of Rust programs. | |
141 | ||
e8f16183 JB |
142 | %description lldb -l pl.UTF-8 |
143 | Ten pakiet zawiera skrypt rust-lldb, pozwalający na łatwiejsze | |
144 | odpluskwianie programów w języku Rust. | |
145 | ||
e361528e ER |
146 | %package doc |
147 | Summary: Documentation for Rust | |
e8f16183 | 148 | Summary(pl.UTF-8): Dokumentacja do Rusta |
d1b96fd8 JR |
149 | Group: Documentation |
150 | BuildArch: noarch | |
e361528e ER |
151 | |
152 | %description doc | |
153 | This package includes HTML documentation for the Rust programming | |
154 | language and its standard library. | |
155 | ||
e8f16183 JB |
156 | %description doc -l pl.UTF-8 |
157 | Ten pakiet zawiera dokumentację w formacie HTML do języka | |
158 | programowania Rust i jego biblioteki standardowej. | |
159 | ||
e361528e ER |
160 | %prep |
161 | %setup -q -n %{rustc_package} | |
b5eceb5e | 162 | |
e361528e ER |
163 | %if %{with bootstrap} |
164 | %ifarch %{x8664} | |
165 | tar xf %{SOURCE1} | |
166 | %endif | |
167 | %ifarch %{ix86} | |
168 | tar xf %{SOURCE2} | |
169 | %endif | |
d6d4cb2b JR |
170 | %{__mv} %{bootstrap_root} %{bootstrap_root}-root |
171 | %{bootstrap_root}-root/install.sh \ | |
172 | --components=cargo,rustc,rust-std-%{rust_triple} \ | |
173 | --prefix=%{local_rust_root} \ | |
174 | --disable-ldconfig | |
175 | test -f %{local_rust_root}/bin/cargo | |
e361528e ER |
176 | test -f %{local_rust_root}/bin/rustc |
177 | %endif | |
178 | ||
179 | # unbundle | |
d4b51567 | 180 | # We're disabling jemalloc, but rust-src still wants it. |
5b9d67b0 JB |
181 | #%{__rm} -r src/jemalloc |
182 | %{?with_system_llvm:%{__rm} -r src/llvm} | |
e361528e ER |
183 | |
184 | # extract bundled licenses for packaging | |
185 | cp -p src/rt/hoedown/LICENSE src/rt/hoedown/LICENSE-hoedown | |
186 | sed -e '/*\//q' src/libbacktrace/backtrace.h \ | |
187 | >src/libbacktrace/LICENSE-libbacktrace | |
188 | ||
189 | # rust-gdb has hardcoded SYSROOT/lib -- let's make it noarch | |
190 | sed -i -e 's#DIRECTORY=".*"#DIRECTORY="%{_datadir}/%{name}/etc"#' \ | |
191 | src/etc/rust-gdb | |
192 | ||
5ee06aa0 JR |
193 | # The configure macro will modify some autoconf-related files, which upsets |
194 | # cargo when it tries to verify checksums in those files. If we just truncate | |
195 | # that file list, cargo won't have anything to complain about. | |
196 | find src/vendor -name .cargo-checksum.json \ | |
197 | -exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+' | |
e361528e | 198 | |
e361528e ER |
199 | %build |
200 | %configure \ | |
e8f16183 JB |
201 | --build=%{rust_triple} \ |
202 | --host=%{rust_triple} \ | |
203 | --target=%{rust_triple} \ | |
18a1004b | 204 | --libdir=%{common_libdir} \ |
e8f16183 | 205 | --disable-codegen-tests \ |
e361528e | 206 | --disable-jemalloc \ |
e8f16183 | 207 | --disable-option-checking \ |
e361528e | 208 | --disable-rpath \ |
5ee06aa0 | 209 | --disable-debuginfo-lines \ |
5b9d67b0 | 210 | %if %{with full_debuginfo} |
5ee06aa0 | 211 | --disable-debuginfo-only-std \ |
e361528e | 212 | --enable-debuginfo \ |
5b9d67b0 JB |
213 | %else |
214 | --enable-debuginfo-only-std \ | |
215 | --disable-debuginfo \ | |
216 | %endif | |
e8f16183 | 217 | --enable-llvm-link-shared \ |
830375b8 | 218 | --local-rust-root=%{local_rust_root} \ |
d6d4cb2b | 219 | --enable-vendor \ |
e8f16183 | 220 | --llvm-root=%{_prefix} \ |
e361528e ER |
221 | --release-channel=%{channel} |
222 | ||
5b9d67b0 | 223 | RUST_BACKTRACE=full \ |
d6d4cb2b | 224 | ./x.py dist |
e361528e | 225 | |
8a073211 JR |
226 | %{?with_tests:./x.py test} |
227 | ||
e361528e ER |
228 | %install |
229 | rm -rf $RPM_BUILD_ROOT | |
e361528e | 230 | |
4f353dba JR |
231 | DESTDIR=$RPM_BUILD_ROOT ./x.py install |
232 | DESTDIR=$RPM_BUILD_ROOT ./x.py install src | |
e361528e | 233 | |
18a1004b JR |
234 | # Make sure the shared libraries are in the proper libdir |
235 | %if "%{_libdir}" != "%{common_libdir}" | |
236 | mkdir -p %{buildroot}%{_libdir} | |
237 | find $RPM_BUILD_ROOT%{common_libdir} -maxdepth 1 -type f -name '*.so' \ | |
238 | -exec mv -v -t $RPM_BUILD_ROOT%{_libdir} '{}' '+' | |
239 | %endif | |
240 | ||
d1b96fd8 | 241 | # The shared libraries should be executable for debuginfo extraction. |
e361528e ER |
242 | find $RPM_BUILD_ROOT%{_libdir}/ -type f -name '*.so' -exec chmod -v +x '{}' '+' |
243 | ||
d1b96fd8 JR |
244 | # The libdir libraries are identical to those under rustlib/. It's easier on |
245 | # library loading if we keep them in libdir, but we do need them in rustlib/ | |
246 | # to support dynamic linking for compiler plugins, so we'll symlink. | |
18a1004b | 247 | (cd "$RPM_BUILD_ROOT%{rustlibdir}/%{rust_triple}/lib" && |
d1b96fd8 JR |
248 | find ../../../../%{_lib} -maxdepth 1 -name '*.so' \ |
249 | -exec ln -v -f -s -t . '{}' '+') | |
250 | ||
251 | # Remove installer artifacts (manifests, uninstall scripts, etc.) | |
18a1004b | 252 | find $RPM_BUILD_ROOT%{rustlibdir}/ -maxdepth 1 -type f -exec rm -v '{}' '+' |
e361528e ER |
253 | |
254 | # FIXME: __os_install_post will strip the rlibs | |
255 | # -- should we find a way to preserve debuginfo? | |
256 | ||
257 | # Remove unwanted documentation files (we already package them) | |
e8f16183 JB |
258 | %{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/README.md |
259 | %{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/COPYRIGHT | |
260 | %{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/LICENSE-APACHE | |
261 | %{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/LICENSE-MIT | |
e361528e ER |
262 | |
263 | # Sanitize the HTML documentation | |
264 | find $RPM_BUILD_ROOT%{_docdir}/%{name}/html -empty -delete | |
265 | find $RPM_BUILD_ROOT%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+' | |
266 | ||
267 | # Move rust-gdb's python scripts so they're noarch | |
268 | install -d $RPM_BUILD_ROOT%{_datadir}/%{name} | |
e8f16183 | 269 | %{__mv} $RPM_BUILD_ROOT%{rustlibdir}/etc $RPM_BUILD_ROOT%{_datadir}/%{name} |
e361528e | 270 | |
4f353dba JR |
271 | # We don't need stdlib source |
272 | %{__rm} -r $RPM_BUILD_ROOT%{rustlibdir}/src | |
273 | ||
e361528e ER |
274 | %clean |
275 | rm -rf $RPM_BUILD_ROOT | |
276 | ||
277 | %post -p /sbin/ldconfig | |
278 | %postun -p /sbin/ldconfig | |
279 | ||
280 | %files | |
281 | %defattr(644,root,root,755) | |
e8f16183 | 282 | %doc COPYRIGHT LICENSE-APACHE LICENSE-MIT README.md src/libbacktrace/LICENSE-libbacktrace src/rt/hoedown/LICENSE-hoedown |
e361528e ER |
283 | %attr(755,root,root) %{_bindir}/rustc |
284 | %attr(755,root,root) %{_bindir}/rustdoc | |
e8f16183 | 285 | %attr(755,root,root) %{_libdir}/libarena-*.so |
e8f16183 | 286 | %attr(755,root,root) %{_libdir}/libfmt_macros-*.so |
e8f16183 JB |
287 | %attr(755,root,root) %{_libdir}/libgraphviz-*.so |
288 | %attr(755,root,root) %{_libdir}/libproc_macro-*.so | |
e8f16183 | 289 | %attr(755,root,root) %{_libdir}/librustc*-*.so |
e8f16183 JB |
290 | %attr(755,root,root) %{_libdir}/libserialize-*.so |
291 | %attr(755,root,root) %{_libdir}/libstd-*.so | |
292 | %attr(755,root,root) %{_libdir}/libsyntax-*.so | |
293 | %attr(755,root,root) %{_libdir}/libsyntax_ext-*.so | |
294 | %attr(755,root,root) %{_libdir}/libsyntax_pos-*.so | |
295 | %attr(755,root,root) %{_libdir}/libterm-*.so | |
296 | %attr(755,root,root) %{_libdir}/libtest-*.so | |
e361528e ER |
297 | %{_mandir}/man1/rustc.1* |
298 | %{_mandir}/man1/rustdoc.1* | |
18a1004b JR |
299 | %dir %{rustlibdir} |
300 | %dir %{rustlibdir}/%{rust_triple} | |
9ee62e7d JP |
301 | %dir %{rustlibdir}/%{rust_triple}/codegen-backends |
302 | %attr(755,root,root) %{rustlibdir}/%{rust_triple}/codegen-backends/*.so | |
18a1004b JR |
303 | %dir %{rustlibdir}/%{rust_triple}/lib |
304 | %attr(755,root,root) %{rustlibdir}/%{rust_triple}/lib/*.so | |
305 | %{rustlibdir}/%{rust_triple}/lib/*.rlib | |
e361528e | 306 | |
d1b96fd8 JR |
307 | %files debugger-common |
308 | %defattr(644,root,root,755) | |
309 | %dir %{_datadir}/%{name} | |
310 | %dir %{_datadir}/%{name}/etc | |
311 | %{_datadir}/%{name}/etc/debugger_*.py* | |
312 | ||
313 | %files lldb | |
314 | %defattr(644,root,root,755) | |
315 | %attr(755,root,root) %{_bindir}/rust-lldb | |
316 | %{_datadir}/%{name}/etc/lldb_*.py* | |
317 | ||
e361528e ER |
318 | %files gdb |
319 | %defattr(644,root,root,755) | |
320 | %attr(755,root,root) %{_bindir}/rust-gdb | |
d1b96fd8 | 321 | %{_datadir}/%{name}/etc/gdb_*.py* |
e361528e ER |
322 | |
323 | %files doc | |
324 | %defattr(644,root,root,755) | |
325 | %dir %{_docdir}/%{name} | |
d1b96fd8 | 326 | %doc %{_docdir}/%{name}/html |