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