]> git.pld-linux.org Git - packages/rust.git/blame - rust.spec
- up to 1.21.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
5ee06aa0
JR
21%define bootstrap_rust 1.20.0
22%define bootstrap_cargo 0.21.0
23%define bootstrap_date 2017-08-31
e361528e
ER
24
25Summary: The Rust Programming Language
e8f16183 26Summary(pl.UTF-8): Język programowania Rust
e361528e 27Name: rust
5ee06aa0 28Version: 1.21.0
33916618 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
5ee06aa0 34# Source0-md5: bc494706b764276613064aad52922f53
8a073211 35Source1: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-x86_64-unknown-linux-gnu.tar.gz
5ee06aa0 36# Source1-md5: 5b63778b4877bcfd431b56c485f4876b
8a073211 37Source2: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-i686-unknown-linux-gnu.tar.gz
5ee06aa0
JR
38# Source2-md5: 5e8c3a6a7b94e6a32f85230111a684a3
39Patch0: rust-1.21.0-44203-exclude-compiler-rt-test.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}
5ee06aa0 161%patch0 -p1
b5eceb5e 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
5ee06aa0
JR
192# The configure macro will modify some autoconf-related files, which upsets
193# cargo when it tries to verify checksums in those files. If we just truncate
194# that file list, cargo won't have anything to complain about.
195find src/vendor -name .cargo-checksum.json \
196 -exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+'
e361528e 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 207 --disable-rpath \
5ee06aa0
JR
208 --disable-debuginfo-lines \
209 --disable-debuginfo-only-std \
e361528e 210 --enable-debuginfo \
e8f16183
JB
211 --enable-llvm-link-shared \
212 --enable-local-rust --local-rust-root=%{local_rust_root} \
d6d4cb2b 213 --enable-vendor \
e8f16183 214 --llvm-root=%{_prefix} \
e361528e
ER
215 --release-channel=%{channel}
216
d6d4cb2b 217./x.py dist
e361528e 218
8a073211
JR
219%{?with_tests:./x.py test}
220
e361528e
ER
221%install
222rm -rf $RPM_BUILD_ROOT
e361528e 223
d1b96fd8 224DESTDIR=$RPM_BUILD_ROOT ./x.py dist --install
e361528e 225
18a1004b
JR
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
d1b96fd8 233# The shared libraries should be executable for debuginfo extraction.
e361528e
ER
234find $RPM_BUILD_ROOT%{_libdir}/ -type f -name '*.so' -exec chmod -v +x '{}' '+'
235
d1b96fd8
JR
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.
18a1004b 239(cd "$RPM_BUILD_ROOT%{rustlibdir}/%{rust_triple}/lib" &&
d1b96fd8
JR
240 find ../../../../%{_lib} -maxdepth 1 -name '*.so' \
241 -exec ln -v -f -s -t . '{}' '+')
242
243# Remove installer artifacts (manifests, uninstall scripts, etc.)
18a1004b 244find $RPM_BUILD_ROOT%{rustlibdir}/ -maxdepth 1 -type f -exec rm -v '{}' '+'
e361528e
ER
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)
e8f16183
JB
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
e361528e
ER
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}
e8f16183 261%{__mv} $RPM_BUILD_ROOT%{rustlibdir}/etc $RPM_BUILD_ROOT%{_datadir}/%{name}
e361528e
ER
262
263%clean
264rm -rf $RPM_BUILD_ROOT
265
266%post -p /sbin/ldconfig
267%postun -p /sbin/ldconfig
268
269%files
270%defattr(644,root,root,755)
e8f16183 271%doc COPYRIGHT LICENSE-APACHE LICENSE-MIT README.md src/libbacktrace/LICENSE-libbacktrace src/rt/hoedown/LICENSE-hoedown
e361528e
ER
272%attr(755,root,root) %{_bindir}/rustc
273%attr(755,root,root) %{_bindir}/rustdoc
e8f16183
JB
274%attr(755,root,root) %{_libdir}/libarena-*.so
275%attr(755,root,root) %{_libdir}/libflate-*.so
276%attr(755,root,root) %{_libdir}/libfmt_macros-*.so
277%attr(755,root,root) %{_libdir}/libgetopts-*.so
278%attr(755,root,root) %{_libdir}/libgraphviz-*.so
279%attr(755,root,root) %{_libdir}/libproc_macro-*.so
280%attr(755,root,root) %{_libdir}/libproc_macro_plugin-*.so
281%attr(755,root,root) %{_libdir}/librustc*-*.so
282%attr(755,root,root) %{_libdir}/librustdoc-*.so
283%attr(755,root,root) %{_libdir}/libserialize-*.so
284%attr(755,root,root) %{_libdir}/libstd-*.so
285%attr(755,root,root) %{_libdir}/libsyntax-*.so
286%attr(755,root,root) %{_libdir}/libsyntax_ext-*.so
287%attr(755,root,root) %{_libdir}/libsyntax_pos-*.so
288%attr(755,root,root) %{_libdir}/libterm-*.so
289%attr(755,root,root) %{_libdir}/libtest-*.so
e361528e
ER
290%{_mandir}/man1/rustc.1*
291%{_mandir}/man1/rustdoc.1*
18a1004b
JR
292%dir %{rustlibdir}
293%dir %{rustlibdir}/%{rust_triple}
294%dir %{rustlibdir}/%{rust_triple}/lib
295%attr(755,root,root) %{rustlibdir}/%{rust_triple}/lib/*.so
296%{rustlibdir}/%{rust_triple}/lib/*.rlib
e361528e 297
d1b96fd8
JR
298%files debugger-common
299%defattr(644,root,root,755)
300%dir %{_datadir}/%{name}
301%dir %{_datadir}/%{name}/etc
302%{_datadir}/%{name}/etc/debugger_*.py*
303
304%files lldb
305%defattr(644,root,root,755)
306%attr(755,root,root) %{_bindir}/rust-lldb
307%{_datadir}/%{name}/etc/lldb_*.py*
308
e361528e
ER
309%files gdb
310%defattr(644,root,root,755)
311%attr(755,root,root) %{_bindir}/rust-gdb
d1b96fd8 312%{_datadir}/%{name}/etc/gdb_*.py*
e361528e
ER
313
314%files doc
315%defattr(644,root,root,755)
316%dir %{_docdir}/%{name}
d1b96fd8 317%doc %{_docdir}/%{name}/html
This page took 0.093179 seconds and 4 git commands to generate.