]> git.pld-linux.org Git - packages/rust.git/blame - rust.spec
- remove obsolete patch
[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
e361528e 39URL: https://www.rust-lang.org/
e8f16183
JB
40# for src/compiler-rt
41BuildRequires: cmake >= 3.4.3
e361528e 42BuildRequires: curl
d1b96fd8 43BuildRequires: libstdc++-devel
e361528e 44BuildRequires: llvm-devel
d1b96fd8 45BuildRequires: ncurses-devel
e8f16183 46BuildRequires: python >= 1:2.7
e361528e
ER
47BuildRequires: zlib-devel
48%if %{without bootstrap}
d6d4cb2b 49BuildRequires: %{name} >= %{bootstrap_rust}
d1b96fd8 50BuildRequires: cargo >= %{bootstrap_cargo}
ff5a5e0b 51BuildConflicts: %{name} > %{version}
e361528e
ER
52%endif
53# make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs
54BuildRequires: procps
e361528e
ER
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
d36946a0 62ExclusiveArch: %{x8664} %{ix86}
e361528e 63
8a073211 64%define rust_triple %{_target_cpu}-unknown-linux-gnu
e361528e
ER
65
66%if %{without bootstrap}
8a073211 67%define local_rust_root %{_prefix}
e361528e 68%else
8a073211
JR
69%define bootstrap_root rust-%{bootstrap_rust}-%{rust_triple}
70%define local_rust_root %{_builddir}/%{rustc_package}/%{bootstrap_root}
e361528e
ER
71%endif
72
18a1004b
JR
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
19f98749 80# once_call/once_callable non-function libstdc++ symbols
8a073211 81%define skip_post_check_so 'librustc_llvm-.*\.so.*'
19f98749 82
e361528e 83# ALL Rust libraries are private, because they don't keep an ABI.
8a073211
JR
84%define _noautoreqfiles lib.*-[[:xdigit:]]{8}[.]so.*
85%define _noautoprovfiles lib.*-[[:xdigit:]]{8}[.]so.*
e361528e
ER
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
e8f16183
JB
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
d1b96fd8
JR
99%package debugger-common
100Summary: Common debugger pretty printers for Rust
e8f16183 101Summary(pl.UTF-8): Narzędzia wypisujące struktury Rusa wspólne dla różnych debuggerów
d1b96fd8
JR
102Group: Development/Debuggers
103BuildArch: noarch
104
105%description debugger-common
e8f16183
JB
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.
d1b96fd8 111
e361528e
ER
112%package gdb
113Summary: GDB pretty printers for Rust
e8f16183 114Summary(pl.UTF-8): Ładne wypisywanie struktur Rusta w GDB
d1b96fd8
JR
115Group: Development/Debuggers
116Requires: %{name}-debugger-common = %{version}-%{release}
e361528e 117Requires: gdb
e361528e 118BuildArch: noarch
e361528e
ER
119
120%description gdb
121This package includes the rust-gdb script, which allows easier
122debugging of Rust programs.
123
e8f16183
JB
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
d1b96fd8
JR
128%package lldb
129Summary: LLDB pretty printers for Rust
e8f16183 130Summary(pl.UTF-8): Ładne wypisywanie struktur Rusta w LLDB
d1b96fd8
JR
131Group: Development/Debuggers
132Requires: %{name}-debugger-common = %{version}-%{release}
133Requires: lldb
d1b96fd8
JR
134BuildArch: noarch
135
136%description lldb
137This package includes the rust-lldb script, which allows easier
138debugging of Rust programs.
139
e8f16183
JB
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
e361528e
ER
144%package doc
145Summary: Documentation for Rust
e8f16183 146Summary(pl.UTF-8): Dokumentacja do Rusta
d1b96fd8
JR
147Group: Documentation
148BuildArch: noarch
e361528e
ER
149
150%description doc
151This package includes HTML documentation for the Rust programming
152language and its standard library.
153
e8f16183
JB
154%description doc -l pl.UTF-8
155Ten pakiet zawiera dokumentację w formacie HTML do języka
156programowania Rust i jego biblioteki standardowej.
157
e361528e
ER
158%prep
159%setup -q -n %{rustc_package}
b5eceb5e 160
e361528e
ER
161%if %{with bootstrap}
162%ifarch %{x8664}
163tar xf %{SOURCE1}
164%endif
165%ifarch %{ix86}
166tar xf %{SOURCE2}
167%endif
d6d4cb2b
JR
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
e361528e
ER
174test -f %{local_rust_root}/bin/rustc
175%endif
176
177# unbundle
e8f16183
JB
178%{__rm} -r src/jemalloc/
179%{__rm} -r src/llvm/
e361528e
ER
180
181# extract bundled licenses for packaging
182cp -p src/rt/hoedown/LICENSE src/rt/hoedown/LICENSE-hoedown
183sed -e '/*\//q' src/libbacktrace/backtrace.h \
184 >src/libbacktrace/LICENSE-libbacktrace
185
186# rust-gdb has hardcoded SYSROOT/lib -- let's make it noarch
187sed -i -e 's#DIRECTORY=".*"#DIRECTORY="%{_datadir}/%{name}/etc"#' \
188 src/etc/rust-gdb
189
190# These tests assume that alloc_jemalloc is present
191sed -i -e '1i // ignore-test jemalloc is disabled' \
192 src/test/compile-fail/allocator-dylib-is-system.rs \
193 src/test/compile-fail/allocator-rust-dylib-is-jemalloc.rs \
194 src/test/run-pass/allocator-default.rs
195
e361528e
ER
196%build
197%configure \
e8f16183
JB
198 --build=%{rust_triple} \
199 --host=%{rust_triple} \
200 --target=%{rust_triple} \
18a1004b 201 --libdir=%{common_libdir} \
e8f16183 202 --disable-codegen-tests \
e361528e 203 --disable-jemalloc \
e8f16183 204 --disable-option-checking \
e361528e
ER
205 --disable-rpath \
206 --enable-debuginfo \
e8f16183
JB
207 --enable-llvm-link-shared \
208 --enable-local-rust --local-rust-root=%{local_rust_root} \
d6d4cb2b 209 --enable-vendor \
e8f16183 210 --llvm-root=%{_prefix} \
e361528e
ER
211 --release-channel=%{channel}
212
d6d4cb2b 213./x.py dist
e361528e 214
8a073211
JR
215%{?with_tests:./x.py test}
216
e361528e
ER
217%install
218rm -rf $RPM_BUILD_ROOT
e361528e 219
d1b96fd8 220DESTDIR=$RPM_BUILD_ROOT ./x.py dist --install
e361528e 221
18a1004b
JR
222# Make sure the shared libraries are in the proper libdir
223%if "%{_libdir}" != "%{common_libdir}"
224mkdir -p %{buildroot}%{_libdir}
225find $RPM_BUILD_ROOT%{common_libdir} -maxdepth 1 -type f -name '*.so' \
226 -exec mv -v -t $RPM_BUILD_ROOT%{_libdir} '{}' '+'
227%endif
228
d1b96fd8 229# The shared libraries should be executable for debuginfo extraction.
e361528e
ER
230find $RPM_BUILD_ROOT%{_libdir}/ -type f -name '*.so' -exec chmod -v +x '{}' '+'
231
d1b96fd8
JR
232# The libdir libraries are identical to those under rustlib/. It's easier on
233# library loading if we keep them in libdir, but we do need them in rustlib/
234# to support dynamic linking for compiler plugins, so we'll symlink.
18a1004b 235(cd "$RPM_BUILD_ROOT%{rustlibdir}/%{rust_triple}/lib" &&
d1b96fd8
JR
236 find ../../../../%{_lib} -maxdepth 1 -name '*.so' \
237 -exec ln -v -f -s -t . '{}' '+')
238
239# Remove installer artifacts (manifests, uninstall scripts, etc.)
18a1004b 240find $RPM_BUILD_ROOT%{rustlibdir}/ -maxdepth 1 -type f -exec rm -v '{}' '+'
e361528e
ER
241
242# FIXME: __os_install_post will strip the rlibs
243# -- should we find a way to preserve debuginfo?
244
245# Remove unwanted documentation files (we already package them)
e8f16183
JB
246%{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/README.md
247%{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/COPYRIGHT
248%{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/LICENSE-APACHE
249%{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/LICENSE-MIT
e361528e
ER
250
251# Sanitize the HTML documentation
252find $RPM_BUILD_ROOT%{_docdir}/%{name}/html -empty -delete
253find $RPM_BUILD_ROOT%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+'
254
255# Move rust-gdb's python scripts so they're noarch
256install -d $RPM_BUILD_ROOT%{_datadir}/%{name}
e8f16183 257%{__mv} $RPM_BUILD_ROOT%{rustlibdir}/etc $RPM_BUILD_ROOT%{_datadir}/%{name}
e361528e
ER
258
259%clean
260rm -rf $RPM_BUILD_ROOT
261
262%post -p /sbin/ldconfig
263%postun -p /sbin/ldconfig
264
265%files
266%defattr(644,root,root,755)
e8f16183 267%doc COPYRIGHT LICENSE-APACHE LICENSE-MIT README.md src/libbacktrace/LICENSE-libbacktrace src/rt/hoedown/LICENSE-hoedown
e361528e
ER
268%attr(755,root,root) %{_bindir}/rustc
269%attr(755,root,root) %{_bindir}/rustdoc
e8f16183
JB
270%attr(755,root,root) %{_libdir}/libarena-*.so
271%attr(755,root,root) %{_libdir}/libflate-*.so
272%attr(755,root,root) %{_libdir}/libfmt_macros-*.so
273%attr(755,root,root) %{_libdir}/libgetopts-*.so
274%attr(755,root,root) %{_libdir}/libgraphviz-*.so
275%attr(755,root,root) %{_libdir}/libproc_macro-*.so
276%attr(755,root,root) %{_libdir}/libproc_macro_plugin-*.so
277%attr(755,root,root) %{_libdir}/librustc*-*.so
278%attr(755,root,root) %{_libdir}/librustdoc-*.so
279%attr(755,root,root) %{_libdir}/libserialize-*.so
280%attr(755,root,root) %{_libdir}/libstd-*.so
281%attr(755,root,root) %{_libdir}/libsyntax-*.so
282%attr(755,root,root) %{_libdir}/libsyntax_ext-*.so
283%attr(755,root,root) %{_libdir}/libsyntax_pos-*.so
284%attr(755,root,root) %{_libdir}/libterm-*.so
285%attr(755,root,root) %{_libdir}/libtest-*.so
e361528e
ER
286%{_mandir}/man1/rustc.1*
287%{_mandir}/man1/rustdoc.1*
18a1004b
JR
288%dir %{rustlibdir}
289%dir %{rustlibdir}/%{rust_triple}
290%dir %{rustlibdir}/%{rust_triple}/lib
291%attr(755,root,root) %{rustlibdir}/%{rust_triple}/lib/*.so
292%{rustlibdir}/%{rust_triple}/lib/*.rlib
e361528e 293
d1b96fd8
JR
294%files debugger-common
295%defattr(644,root,root,755)
296%dir %{_datadir}/%{name}
297%dir %{_datadir}/%{name}/etc
298%{_datadir}/%{name}/etc/debugger_*.py*
299
300%files lldb
301%defattr(644,root,root,755)
302%attr(755,root,root) %{_bindir}/rust-lldb
303%{_datadir}/%{name}/etc/lldb_*.py*
304
e361528e
ER
305%files gdb
306%defattr(644,root,root,755)
307%attr(755,root,root) %{_bindir}/rust-gdb
d1b96fd8 308%{_datadir}/%{name}/etc/gdb_*.py*
e361528e
ER
309
310%files doc
311%defattr(644,root,root,755)
312%dir %{_docdir}/%{name}
d1b96fd8 313%doc %{_docdir}/%{name}/html
This page took 0.175358 seconds and 4 git commands to generate.