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