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