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