]> git.pld-linux.org Git - packages/rust.git/blame - rust.spec
- don't lie to ourselves that we support arm
[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:
8a073211 6%bcond_with bootstrap
e361528e
ER
7%bcond_without tests # build without tests
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
26Name: rust
d6d4cb2b 27Version: 1.18.0
e361528e 28Release: 0.1
d1b96fd8 29# Licenses: (rust itself) and (bundled libraries)
e361528e 30License: (ASL 2.0 or MIT) and (BSD and ISC and MIT)
e361528e 31Group: Development/Languages
d6d4cb2b
JR
32Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.gz
33# Source0-md5: c37c0cd9d500f6a9d1f2f44401351f88
8a073211 34Source1: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-x86_64-unknown-linux-gnu.tar.gz
d6d4cb2b 35# Source1-md5: 98e8f479515969123b4c203191104a54
8a073211 36Source2: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-i686-unknown-linux-gnu.tar.gz
d6d4cb2b 37# Source2-md5: 2d5de850c32aa8d40c8c21abacf749f8
e361528e
ER
38URL: https://www.rust-lang.org/
39BuildRequires: cmake
40BuildRequires: curl
41BuildRequires: gcc
42BuildRequires: libstdc++-devel
d1b96fd8 43BuildRequires: libstdc++-devel
e361528e 44BuildRequires: llvm-devel
d1b96fd8 45BuildRequires: ncurses-devel
e361528e
ER
46BuildRequires: python
47BuildRequires: zlib-devel
48%if %{without bootstrap}
49BuildRequires: %{name} < %{version}-%{release}
d6d4cb2b 50BuildRequires: %{name} >= %{bootstrap_rust}
d1b96fd8 51BuildRequires: cargo >= %{bootstrap_cargo}
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
19f98749 73# once_call/once_callable non-function libstdc++ symbols
8a073211 74%define skip_post_check_so 'librustc_llvm-.*\.so.*'
19f98749 75
e361528e 76# ALL Rust libraries are private, because they don't keep an ABI.
8a073211
JR
77%define _noautoreqfiles lib.*-[[:xdigit:]]{8}[.]so.*
78%define _noautoprovfiles lib.*-[[:xdigit:]]{8}[.]so.*
e361528e
ER
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
d1b96fd8
JR
87%package debugger-common
88Summary: Common debugger pretty printers for Rust
89Group: Development/Debuggers
90BuildArch: noarch
91
92%description debugger-common
93This package includes the common functionality for %{name}-gdb and
94%{name}-lldb.
95
e361528e
ER
96%package gdb
97Summary: GDB pretty printers for Rust
d1b96fd8
JR
98Group: Development/Debuggers
99Requires: %{name}-debugger-common = %{version}-%{release}
e361528e 100Requires: gdb
e361528e 101BuildArch: noarch
e361528e
ER
102
103%description gdb
104This package includes the rust-gdb script, which allows easier
105debugging of Rust programs.
106
d1b96fd8
JR
107%package lldb
108Summary: LLDB pretty printers for Rust
109Group: Development/Debuggers
110Requires: %{name}-debugger-common = %{version}-%{release}
111Requires: lldb
112Requires: python-lldb
113BuildArch: noarch
114
115%description lldb
116This package includes the rust-lldb script, which allows easier
117debugging of Rust programs.
118
e361528e
ER
119%package doc
120Summary: Documentation for Rust
d1b96fd8
JR
121Group: Documentation
122BuildArch: noarch
e361528e
ER
123
124%description doc
125This package includes HTML documentation for the Rust programming
126language and its standard library.
127
128%prep
129%setup -q -n %{rustc_package}
130%if %{with bootstrap}
131%ifarch %{x8664}
132tar xf %{SOURCE1}
133%endif
134%ifarch %{ix86}
135tar xf %{SOURCE2}
136%endif
d6d4cb2b
JR
137%{__mv} %{bootstrap_root} %{bootstrap_root}-root
138%{bootstrap_root}-root/install.sh \
139 --components=cargo,rustc,rust-std-%{rust_triple} \
140 --prefix=%{local_rust_root} \
141 --disable-ldconfig
142test -f %{local_rust_root}/bin/cargo
e361528e
ER
143test -f %{local_rust_root}/bin/rustc
144%endif
145
146# unbundle
147rm -r src/jemalloc/
148rm -r src/llvm/
149
150# extract bundled licenses for packaging
151cp -p src/rt/hoedown/LICENSE src/rt/hoedown/LICENSE-hoedown
152sed -e '/*\//q' src/libbacktrace/backtrace.h \
153 >src/libbacktrace/LICENSE-libbacktrace
154
155# rust-gdb has hardcoded SYSROOT/lib -- let's make it noarch
156sed -i -e 's#DIRECTORY=".*"#DIRECTORY="%{_datadir}/%{name}/etc"#' \
157 src/etc/rust-gdb
158
159# These tests assume that alloc_jemalloc is present
160sed -i -e '1i // ignore-test jemalloc is disabled' \
161 src/test/compile-fail/allocator-dylib-is-system.rs \
162 src/test/compile-fail/allocator-rust-dylib-is-jemalloc.rs \
163 src/test/run-pass/allocator-default.rs
164
165# Fedora's LLVM doesn't support any mips targets -- see "llc -version".
166# Fixed properly by Rust PR36344, which should be released in 1.13.
167sed -i -e '/target=mips/,+1s/^/# unsupported /' \
168 src/test/run-make/atomic-lock-free/Makefile
169
170%if %{without bootstrap}
171# The hardcoded stage0 "lib" is inappropriate when using Fedora's own rustc
172sed -i -e '/^HLIB_RELATIVE/s/lib$/$$(CFG_LIBDIR_RELATIVE)/' mk/main.mk
173%endif
174
175%build
176%configure \
177 --disable-option-checking \
178 --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \
179 --enable-local-rust --local-rust-root=%{local_rust_root} \
180 --llvm-root=%{_prefix} --disable-codegen-tests \
181 --disable-jemalloc \
182 --disable-rpath \
183 --enable-debuginfo \
d6d4cb2b 184 --enable-vendor \
e361528e
ER
185 --release-channel=%{channel}
186
d6d4cb2b 187./x.py dist
e361528e 188
8a073211
JR
189%{?with_tests:./x.py test}
190
e361528e
ER
191%install
192rm -rf $RPM_BUILD_ROOT
e361528e 193
d1b96fd8 194DESTDIR=$RPM_BUILD_ROOT ./x.py dist --install
e361528e 195
d1b96fd8 196# The shared libraries should be executable for debuginfo extraction.
e361528e
ER
197find $RPM_BUILD_ROOT%{_libdir}/ -type f -name '*.so' -exec chmod -v +x '{}' '+'
198
d1b96fd8
JR
199# The libdir libraries are identical to those under rustlib/. It's easier on
200# library loading if we keep them in libdir, but we do need them in rustlib/
201# to support dynamic linking for compiler plugins, so we'll symlink.
202(cd "$RPM_BUILD_ROOT%{_libdir}/rustlib/%{rust_triple}/lib" &&
203 find ../../../../%{_lib} -maxdepth 1 -name '*.so' \
204 -exec ln -v -f -s -t . '{}' '+')
205
206# Remove installer artifacts (manifests, uninstall scripts, etc.)
207find $RPM_BUILD_ROOT%{_libdir}/rustlib/ -maxdepth 1 -type f -exec rm -v '{}' '+'
e361528e
ER
208
209# FIXME: __os_install_post will strip the rlibs
210# -- should we find a way to preserve debuginfo?
211
212# Remove unwanted documentation files (we already package them)
213rm $RPM_BUILD_ROOT%{_docdir}/%{name}/README.md
214rm $RPM_BUILD_ROOT%{_docdir}/%{name}/COPYRIGHT
215rm $RPM_BUILD_ROOT%{_docdir}/%{name}/LICENSE-APACHE
216rm $RPM_BUILD_ROOT%{_docdir}/%{name}/LICENSE-MIT
217
218# Sanitize the HTML documentation
219find $RPM_BUILD_ROOT%{_docdir}/%{name}/html -empty -delete
220find $RPM_BUILD_ROOT%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+'
221
222# Move rust-gdb's python scripts so they're noarch
223install -d $RPM_BUILD_ROOT%{_datadir}/%{name}
224mv -v $RPM_BUILD_ROOT%{_libdir}/rustlib%{_sysconfdir} $RPM_BUILD_ROOT%{_datadir}/%{name}/
225
226%clean
227rm -rf $RPM_BUILD_ROOT
228
229%post -p /sbin/ldconfig
230%postun -p /sbin/ldconfig
231
232%files
233%defattr(644,root,root,755)
234%doc COPYRIGHT LICENSE-APACHE LICENSE-MIT
235%doc src/libbacktrace/LICENSE-libbacktrace
236%doc src/rt/hoedown/LICENSE-hoedown
237%doc README.md
238%attr(755,root,root) %{_bindir}/rustc
239%attr(755,root,root) %{_bindir}/rustdoc
240%{_mandir}/man1/rustc.1*
241%{_mandir}/man1/rustdoc.1*
242%{_libdir}/lib*
243%dir %{_libdir}/rustlib
244%{_libdir}/rustlib/%{rust_triple}
245
d1b96fd8
JR
246%files debugger-common
247%defattr(644,root,root,755)
248%dir %{_datadir}/%{name}
249%dir %{_datadir}/%{name}/etc
250%{_datadir}/%{name}/etc/debugger_*.py*
251
252%files lldb
253%defattr(644,root,root,755)
254%attr(755,root,root) %{_bindir}/rust-lldb
255%{_datadir}/%{name}/etc/lldb_*.py*
256
e361528e
ER
257%files gdb
258%defattr(644,root,root,755)
259%attr(755,root,root) %{_bindir}/rust-gdb
d1b96fd8 260%{_datadir}/%{name}/etc/gdb_*.py*
e361528e
ER
261
262%files doc
263%defattr(644,root,root,755)
264%dir %{_docdir}/%{name}
d1b96fd8 265%doc %{_docdir}/%{name}/html
This page took 0.353779 seconds and 4 git commands to generate.