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