]> git.pld-linux.org Git - packages/rust.git/blame - rust.spec
new, version 1.12.0
[packages/rust.git] / rust.spec
CommitLineData
e361528e
ER
1# TODO
2# - consider a rust-std package containing .../rustlib/$target
3# This might allow multilib cross-compilation to work naturally.
4
5# The channel can be stable, beta, or nightly
6%define channel stable
7
8#
9# Conditional build:
10%bcond_with bootstrap
11%bcond_without tests # build without tests
12
13%if "%{channel}" == "stable"
14%define rustc_package rustc-%{version}
15%else
16%define rustc_package rustc-%{channel}
17%endif
18
19# To bootstrap from scratch, set the channel and date from src/stage0.txt
20# e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24
21# or nightly wants some beta-YYYY-MM-DD
22%define bootstrap_channel 1.11.0
23%define bootstrap_date 2016-08-16
24%define bootstrap_base https://static.rust-lang.org/dist/%{bootstrap_date}/rustc-%{bootstrap_channel}
25
26Summary: The Rust Programming Language
27Name: rust
28Version: 1.12.0
29Release: 0.1
30License: (ASL 2.0 or MIT) and (BSD and ISC and MIT)
31# ^ written as: (rust itself) and (bundled libraries)
32Group: Development/Languages
33Source0: https://static.rust-lang.org/dist/%{rustc_package}-src.tar.gz
34%if %{with bootstrap}
35Source1: %{bootstrap_base}-x86_64-unknown-linux-gnu.tar.gz
36Source2: %{bootstrap_base}-i686-unknown-linux-gnu.tar.gz
37%endif
38URL: https://www.rust-lang.org/
39BuildRequires: cmake
40BuildRequires: curl
41BuildRequires: gcc
42BuildRequires: libstdc++-devel
43BuildRequires: llvm-devel
44BuildRequires: python
45BuildRequires: zlib-devel
46%if %{without bootstrap}
47BuildRequires: %{name} < %{version}-%{release}
48BuildRequires: %{name} >= %{bootstrap_channel}
49%endif
50# make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs
51BuildRequires: procps
52# TODO: work on unbundling these!
53Provides: bundled(hoedown) = 3.0.5
54Provides: bundled(jquery) = 2.1.4
55Provides: bundled(libbacktrace) = 6.1.0
56Provides: bundled(miniz) = 1.14
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
60Requires: gcc
61BuildRoot: %{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
64ExclusiveArch: %{x8664} %{ix86} %{arm}
65
66%define rust_triple %{_target_cpu}-unknown-linux-gnu
67
68%if %{without bootstrap}
69%define local_rust_root %{_prefix}
70%else
71%define bootstrap_root rustc-%{bootstrap_channel}-%{rust_triple}
72%define local_rust_root %{_builddir}/%{rustc_package}/%{bootstrap_root}/rustc
73%endif
74
75# ALL Rust libraries are private, because they don't keep an ABI.
76%global _privatelibs lib.*-[[:xdigit:]]{8}[.]so.*
77%global __provides_exclude ^(%{_privatelibs})$
78%global __requires_exclude ^(%{_privatelibs})$
79
80%description
81Rust is a systems programming language that runs blazingly fast,
82prevents segfaults, and guarantees thread safety.
83
84This package includes the Rust compiler, standard library, and
85documentation generator.
86
87%package gdb
88Summary: GDB pretty printers for Rust
89Requires: gdb
90%if "%{_rpmversion}" >= "5"
91BuildArch: noarch
92%endif
93
94%description gdb
95This package includes the rust-gdb script, which allows easier
96debugging of Rust programs.
97
98%package doc
99Summary: Documentation for Rust
100# NOT BuildArch: noarch
101# Note, while docs are mostly noarch, some things do vary by target_arch.
102# Koji will fail the build in rpmdiff if two architectures build a noarch
103# subpackage differently, so instead we have to keep its arch.
104
105%description doc
106This package includes HTML documentation for the Rust programming
107language and its standard library.
108
109%prep
110%setup -q -n %{rustc_package}
111%if %{with bootstrap}
112%ifarch %{x8664}
113tar xf %{SOURCE1}
114%endif
115%ifarch %{ix86}
116tar xf %{SOURCE2}
117%endif
118test -f %{local_rust_root}/bin/rustc
119%endif
120
121# unbundle
122rm -r src/jemalloc/
123rm -r src/llvm/
124
125# extract bundled licenses for packaging
126cp -p src/rt/hoedown/LICENSE src/rt/hoedown/LICENSE-hoedown
127sed -e '/*\//q' src/libbacktrace/backtrace.h \
128 >src/libbacktrace/LICENSE-libbacktrace
129
130# rust-gdb has hardcoded SYSROOT/lib -- let's make it noarch
131sed -i -e 's#DIRECTORY=".*"#DIRECTORY="%{_datadir}/%{name}/etc"#' \
132 src/etc/rust-gdb
133
134# These tests assume that alloc_jemalloc is present
135sed -i -e '1i // ignore-test jemalloc is disabled' \
136 src/test/compile-fail/allocator-dylib-is-system.rs \
137 src/test/compile-fail/allocator-rust-dylib-is-jemalloc.rs \
138 src/test/run-pass/allocator-default.rs
139
140# Fedora's LLVM doesn't support any mips targets -- see "llc -version".
141# Fixed properly by Rust PR36344, which should be released in 1.13.
142sed -i -e '/target=mips/,+1s/^/# unsupported /' \
143 src/test/run-make/atomic-lock-free/Makefile
144
145%if %{without bootstrap}
146# The hardcoded stage0 "lib" is inappropriate when using Fedora's own rustc
147sed -i -e '/^HLIB_RELATIVE/s/lib$/$$(CFG_LIBDIR_RELATIVE)/' mk/main.mk
148%endif
149
150%build
151%configure \
152 --disable-option-checking \
153 --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \
154 --enable-local-rust --local-rust-root=%{local_rust_root} \
155 --llvm-root=%{_prefix} --disable-codegen-tests \
156 --disable-jemalloc \
157 --disable-rpath \
158 --enable-debuginfo \
159 --release-channel=%{channel}
160
161%{__make} VERBOSE=1
162
163%if %{with tests}
164# Note, many of the tests execute in parallel threads,
165# so it's better not to use a parallel make here.
166%{__make} -j1 check-lite VERBOSE=1 -k
167%endif
168
169
170%install
171rm -rf $RPM_BUILD_ROOT
172%{__make} install \
173 VERBOSE=1 \
174 DESTDIR=$RPM_BUILD_ROOT
175
176# Remove installer artifacts (manifests, uninstall scripts, etc.)
177find $RPM_BUILD_ROOT%{_libdir}/rustlib/ -maxdepth 1 -type f -exec rm -v '{}' '+'
178
179# We don't want to ship the target shared libraries for lack of any Rust ABI.
180find $RPM_BUILD_ROOT%{_libdir}/rustlib/ -type f -name '*.so' -exec rm -v '{}' '+'
181
182# The remaining shared libraries should be executable for debuginfo extraction.
183find $RPM_BUILD_ROOT%{_libdir}/ -type f -name '*.so' -exec chmod -v +x '{}' '+'
184
185# They also don't need the .rustc metadata anymore, so they won't support linking.
186# (but direct section removal breaks dynamic symbols -- leave it for now...)
187#find $RPM_BUILD_ROOT/%{_libdir}/ -type f -name '*.so' -exec objcopy -R .rustc '{}' ';'
188
189# FIXME: __os_install_post will strip the rlibs
190# -- should we find a way to preserve debuginfo?
191
192# Remove unwanted documentation files (we already package them)
193rm $RPM_BUILD_ROOT%{_docdir}/%{name}/README.md
194rm $RPM_BUILD_ROOT%{_docdir}/%{name}/COPYRIGHT
195rm $RPM_BUILD_ROOT%{_docdir}/%{name}/LICENSE-APACHE
196rm $RPM_BUILD_ROOT%{_docdir}/%{name}/LICENSE-MIT
197
198# Sanitize the HTML documentation
199find $RPM_BUILD_ROOT%{_docdir}/%{name}/html -empty -delete
200find $RPM_BUILD_ROOT%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+'
201
202# Move rust-gdb's python scripts so they're noarch
203install -d $RPM_BUILD_ROOT%{_datadir}/%{name}
204mv -v $RPM_BUILD_ROOT%{_libdir}/rustlib%{_sysconfdir} $RPM_BUILD_ROOT%{_datadir}/%{name}/
205
206%clean
207rm -rf $RPM_BUILD_ROOT
208
209%post -p /sbin/ldconfig
210%postun -p /sbin/ldconfig
211
212%files
213%defattr(644,root,root,755)
214%doc COPYRIGHT LICENSE-APACHE LICENSE-MIT
215%doc src/libbacktrace/LICENSE-libbacktrace
216%doc src/rt/hoedown/LICENSE-hoedown
217%doc README.md
218%attr(755,root,root) %{_bindir}/rustc
219%attr(755,root,root) %{_bindir}/rustdoc
220%{_mandir}/man1/rustc.1*
221%{_mandir}/man1/rustdoc.1*
222%{_libdir}/lib*
223%dir %{_libdir}/rustlib
224%{_libdir}/rustlib/%{rust_triple}
225
226%files gdb
227%defattr(644,root,root,755)
228%attr(755,root,root) %{_bindir}/rust-gdb
229%{_datadir}/%{name}
230
231%files doc
232%defattr(644,root,root,755)
233%dir %{_docdir}/%{name}
234%doc %{_docdir}/%{name}/html/FiraSans-LICENSE.txt
235%doc %{_docdir}/%{name}/html/Heuristica-LICENSE.txt
236%doc %{_docdir}/%{name}/html/LICENSE-APACHE.txt
237%doc %{_docdir}/%{name}/html/LICENSE-MIT.txt
238%doc %{_docdir}/%{name}/html/SourceCodePro-LICENSE.txt
239%doc %{_docdir}/%{name}/html/SourceSerifPro-LICENSE.txt
240%doc %{_docdir}/%{name}/html/
This page took 0.115612 seconds and 4 git commands to generate.