]> git.pld-linux.org Git - packages/rust.git/blob - rust.spec
- pl, cleanup, verbose libs in system libdir
[packages/rust.git] / rust.spec
1 # TODO
2 # - consider a rust-std package containing .../rustlib/$target
3 #   This might allow multilib cross-compilation to work naturally.
4 #
5 # Conditional build:
6 %bcond_with     bootstrap       # bootstrap using precompiled binaries
7 %bcond_with     tests           # build without tests
8
9 # The channel can be stable, beta, or nightly
10 %define         channel         stable
11
12 %if "%{channel}" == "stable"
13 %define         rustc_package   rustc-%{version}-src
14 %else
15 %define         rustc_package   rustc-%{channel}-src
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
21 %define         bootstrap_rust  1.17.0
22 %define         bootstrap_cargo 0.18.0
23 %define         bootstrap_date  2017-04-27
24
25 Summary:        The Rust Programming Language
26 Summary(pl.UTF-8):      Język programowania Rust
27 Name:           rust
28 Version:        1.18.0
29 Release:        2
30 # Licenses: (rust itself) and (bundled libraries)
31 License:        (Apache v2.0 or MIT) and (BSD and ISC and MIT)
32 Group:          Development/Languages
33 Source0:        https://static.rust-lang.org/dist/%{rustc_package}.tar.gz
34 # Source0-md5:  c37c0cd9d500f6a9d1f2f44401351f88
35 Source1:        https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-x86_64-unknown-linux-gnu.tar.gz
36 # Source1-md5:  98e8f479515969123b4c203191104a54
37 Source2:        https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-i686-unknown-linux-gnu.tar.gz
38 # Source2-md5:  2d5de850c32aa8d40c8c21abacf749f8
39 Patch0:         rust-1.16.0-configure-no-override.patch
40 URL:            https://www.rust-lang.org/
41 # for src/compiler-rt
42 BuildRequires:  cmake >= 3.4.3
43 BuildRequires:  curl
44 BuildRequires:  libstdc++-devel
45 BuildRequires:  llvm-devel
46 BuildRequires:  ncurses-devel
47 BuildRequires:  python >= 1:2.7
48 BuildRequires:  zlib-devel
49 %if %{without bootstrap}
50 BuildRequires:  %{name} >= %{bootstrap_rust}
51 BuildRequires:  cargo >= %{bootstrap_cargo}
52 BuildConflicts: %{name} > %{version}
53 %endif
54 # make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs
55 BuildRequires:  procps
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
59 Requires:       gcc
60 BuildRoot:      %{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
63 ExclusiveArch:  %{x8664} %{ix86}
64
65 %define         rust_triple     %{_target_cpu}-unknown-linux-gnu
66
67 %if %{without bootstrap}
68 %define         local_rust_root %{_prefix}
69 %else
70 %define         bootstrap_root  rust-%{bootstrap_rust}-%{rust_triple}
71 %define         local_rust_root %{_builddir}/%{rustc_package}/%{bootstrap_root}
72 %endif
73
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
81 # once_call/once_callable non-function libstdc++ symbols
82 %define         skip_post_check_so      'librustc_llvm-.*\.so.*'
83
84 # ALL Rust libraries are private, because they don't keep an ABI.
85 %define         _noautoreqfiles         lib.*-[[:xdigit:]]{8}[.]so.*
86 %define         _noautoprovfiles        lib.*-[[:xdigit:]]{8}[.]so.*
87
88 %description
89 Rust is a systems programming language that runs blazingly fast,
90 prevents segfaults, and guarantees thread safety.
91
92 This package includes the Rust compiler, standard library, and
93 documentation generator.
94
95 %description -l pl.UTF-8
96 Rust to systemowy język programowania działający bardzo szybko,
97 zapobiegający naruszeniom ochrony pamięci i gwarantujący
98 bezpieczną wielowątkowość.
99
100 %package debugger-common
101 Summary:        Common debugger pretty printers for Rust
102 Summary(pl.UTF-8):      Narzędzia wypisujące struktury Rusa wspólne dla różnych debuggerów
103 Group:          Development/Debuggers
104 BuildArch:      noarch
105
106 %description debugger-common
107 This package includes the common functionality for rust-gdb and
108 rust-lldb.
109
110 %description debugger-common -l pl.UTF-8
111 Ten pakiet zawiera wspólny kod dla pakietów rust-gdb i rust-lldb.
112
113 %package gdb
114 Summary:        GDB pretty printers for Rust
115 Summary(pl.UTF-8):      Ładne wypisywanie struktur Rusta w GDB
116 Group:          Development/Debuggers
117 Requires:       %{name}-debugger-common = %{version}-%{release}
118 Requires:       gdb
119 BuildArch:      noarch
120
121 %description gdb
122 This package includes the rust-gdb script, which allows easier
123 debugging of Rust programs.
124
125 %description gdb -l pl.UTF-8
126 Ten pakiet zawiera skrypt rust-gdb, pozwalający na łatwiejsze
127 odpluskwianie programów w języku Rust.
128
129 %package lldb
130 Summary:        LLDB pretty printers for Rust
131 Summary(pl.UTF-8):      Ładne wypisywanie struktur Rusta w LLDB
132 Group:          Development/Debuggers
133 Requires:       %{name}-debugger-common = %{version}-%{release}
134 Requires:       lldb
135 BuildArch:      noarch
136
137 %description lldb
138 This package includes the rust-lldb script, which allows easier
139 debugging of Rust programs.
140
141 %description lldb -l pl.UTF-8
142 Ten pakiet zawiera skrypt rust-lldb, pozwalający na łatwiejsze
143 odpluskwianie programów w języku Rust.
144
145 %package doc
146 Summary:        Documentation for Rust
147 Summary(pl.UTF-8):      Dokumentacja do Rusta
148 Group:          Documentation
149 BuildArch:      noarch
150
151 %description doc
152 This package includes HTML documentation for the Rust programming
153 language and its standard library.
154
155 %description doc -l pl.UTF-8
156 Ten pakiet zawiera dokumentację w formacie HTML do języka
157 programowania Rust i jego biblioteki standardowej.
158
159 %prep
160 %setup -q -n %{rustc_package}
161 %patch0 -p1
162
163 %if %{with bootstrap}
164 %ifarch %{x8664}
165 tar xf %{SOURCE1}
166 %endif
167 %ifarch %{ix86}
168 tar xf %{SOURCE2}
169 %endif
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
175 test -f %{local_rust_root}/bin/cargo
176 test -f %{local_rust_root}/bin/rustc
177 %endif
178
179 # unbundle
180 %{__rm} -r src/jemalloc/
181 %{__rm} -r src/llvm/
182
183 # extract bundled licenses for packaging
184 cp -p src/rt/hoedown/LICENSE src/rt/hoedown/LICENSE-hoedown
185 sed -e '/*\//q' src/libbacktrace/backtrace.h \
186         >src/libbacktrace/LICENSE-libbacktrace
187
188 # rust-gdb has hardcoded SYSROOT/lib -- let's make it noarch
189 sed -i -e 's#DIRECTORY=".*"#DIRECTORY="%{_datadir}/%{name}/etc"#' \
190         src/etc/rust-gdb
191
192 # These tests assume that alloc_jemalloc is present
193 sed -i -e '1i // ignore-test jemalloc is disabled' \
194         src/test/compile-fail/allocator-dylib-is-system.rs \
195         src/test/compile-fail/allocator-rust-dylib-is-jemalloc.rs \
196         src/test/run-pass/allocator-default.rs
197
198 %build
199 %configure \
200         --build=%{rust_triple} \
201         --host=%{rust_triple} \
202         --target=%{rust_triple} \
203         --libdir=%{common_libdir} \
204         --disable-codegen-tests \
205         --disable-jemalloc \
206         --disable-option-checking \
207         --disable-rpath \
208         --enable-debuginfo \
209         --enable-llvm-link-shared \
210         --enable-local-rust --local-rust-root=%{local_rust_root} \
211         --enable-vendor \
212         --llvm-root=%{_prefix} \
213         --release-channel=%{channel}
214
215 ./x.py dist
216
217 %{?with_tests:./x.py test}
218
219 %install
220 rm -rf $RPM_BUILD_ROOT
221
222 DESTDIR=$RPM_BUILD_ROOT ./x.py dist --install
223
224 # Make sure the shared libraries are in the proper libdir
225 %if "%{_libdir}" != "%{common_libdir}"
226 mkdir -p %{buildroot}%{_libdir}
227 find $RPM_BUILD_ROOT%{common_libdir} -maxdepth 1 -type f -name '*.so' \
228         -exec mv -v -t $RPM_BUILD_ROOT%{_libdir} '{}' '+'
229 %endif
230
231 # The shared libraries should be executable for debuginfo extraction.
232 find $RPM_BUILD_ROOT%{_libdir}/ -type f -name '*.so' -exec chmod -v +x '{}' '+'
233
234 # The libdir libraries are identical to those under rustlib/.  It's easier on
235 # library loading if we keep them in libdir, but we do need them in rustlib/
236 # to support dynamic linking for compiler plugins, so we'll symlink.
237 (cd "$RPM_BUILD_ROOT%{rustlibdir}/%{rust_triple}/lib" &&
238         find ../../../../%{_lib} -maxdepth 1 -name '*.so' \
239         -exec ln -v -f -s -t . '{}' '+')
240
241 # Remove installer artifacts (manifests, uninstall scripts, etc.)
242 find $RPM_BUILD_ROOT%{rustlibdir}/ -maxdepth 1 -type f -exec rm -v '{}' '+'
243
244 # FIXME: __os_install_post will strip the rlibs
245 # -- should we find a way to preserve debuginfo?
246
247 # Remove unwanted documentation files (we already package them)
248 %{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/README.md
249 %{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/COPYRIGHT
250 %{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/LICENSE-APACHE
251 %{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}/LICENSE-MIT
252
253 # Sanitize the HTML documentation
254 find $RPM_BUILD_ROOT%{_docdir}/%{name}/html -empty -delete
255 find $RPM_BUILD_ROOT%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+'
256
257 # Move rust-gdb's python scripts so they're noarch
258 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}
259 %{__mv} $RPM_BUILD_ROOT%{rustlibdir}/etc $RPM_BUILD_ROOT%{_datadir}/%{name}
260
261 %clean
262 rm -rf $RPM_BUILD_ROOT
263
264 %post   -p /sbin/ldconfig
265 %postun -p /sbin/ldconfig
266
267 %files
268 %defattr(644,root,root,755)
269 %doc COPYRIGHT LICENSE-APACHE LICENSE-MIT README.md src/libbacktrace/LICENSE-libbacktrace src/rt/hoedown/LICENSE-hoedown
270 %attr(755,root,root) %{_bindir}/rustc
271 %attr(755,root,root) %{_bindir}/rustdoc
272 %attr(755,root,root) %{_libdir}/libarena-*.so
273 %attr(755,root,root) %{_libdir}/libflate-*.so
274 %attr(755,root,root) %{_libdir}/libfmt_macros-*.so
275 %attr(755,root,root) %{_libdir}/libgetopts-*.so
276 %attr(755,root,root) %{_libdir}/libgraphviz-*.so
277 %attr(755,root,root) %{_libdir}/libproc_macro-*.so
278 %attr(755,root,root) %{_libdir}/libproc_macro_plugin-*.so
279 %attr(755,root,root) %{_libdir}/librustc*-*.so
280 %attr(755,root,root) %{_libdir}/librustdoc-*.so
281 %attr(755,root,root) %{_libdir}/libserialize-*.so
282 %attr(755,root,root) %{_libdir}/libstd-*.so
283 %attr(755,root,root) %{_libdir}/libsyntax-*.so
284 %attr(755,root,root) %{_libdir}/libsyntax_ext-*.so
285 %attr(755,root,root) %{_libdir}/libsyntax_pos-*.so
286 %attr(755,root,root) %{_libdir}/libterm-*.so
287 %attr(755,root,root) %{_libdir}/libtest-*.so
288 %{_mandir}/man1/rustc.1*
289 %{_mandir}/man1/rustdoc.1*
290 %dir %{rustlibdir}
291 %dir %{rustlibdir}/%{rust_triple}
292 %dir %{rustlibdir}/%{rust_triple}/lib
293 %attr(755,root,root) %{rustlibdir}/%{rust_triple}/lib/*.so
294 %{rustlibdir}/%{rust_triple}/lib/*.rlib
295
296 %files debugger-common
297 %defattr(644,root,root,755)
298 %dir %{_datadir}/%{name}
299 %dir %{_datadir}/%{name}/etc
300 %{_datadir}/%{name}/etc/debugger_*.py*
301
302 %files lldb
303 %defattr(644,root,root,755)
304 %attr(755,root,root) %{_bindir}/rust-lldb
305 %{_datadir}/%{name}/etc/lldb_*.py*
306
307 %files gdb
308 %defattr(644,root,root,755)
309 %attr(755,root,root) %{_bindir}/rust-gdb
310 %{_datadir}/%{name}/etc/gdb_*.py*
311
312 %files doc
313 %defattr(644,root,root,755)
314 %dir %{_docdir}/%{name}
315 %doc %{_docdir}/%{name}/html
This page took 0.110152 seconds and 4 git commands to generate.