]> git.pld-linux.org Git - packages/rust.git/blob - rust.spec
- we don't have separate python-lldb, all is in lldb [ackage
[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
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 Name:           rust
27 Version:        1.18.0
28 Release:        2
29 # Licenses: (rust itself) and (bundled libraries)
30 License:        (ASL 2.0 or MIT) and (BSD and ISC and MIT)
31 Group:          Development/Languages
32 Source0:        https://static.rust-lang.org/dist/%{rustc_package}.tar.gz
33 # Source0-md5:  c37c0cd9d500f6a9d1f2f44401351f88
34 Source1:        https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-x86_64-unknown-linux-gnu.tar.gz
35 # Source1-md5:  98e8f479515969123b4c203191104a54
36 Source2:        https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-i686-unknown-linux-gnu.tar.gz
37 # Source2-md5:  2d5de850c32aa8d40c8c21abacf749f8
38 Patch0:         rust-1.16.0-configure-no-override.patch
39 URL:            https://www.rust-lang.org/
40 BuildRequires:  cmake
41 BuildRequires:  curl
42 BuildRequires:  gcc
43 BuildRequires:  libstdc++-devel
44 BuildRequires:  libstdc++-devel
45 BuildRequires:  llvm-devel
46 BuildRequires:  ncurses-devel
47 BuildRequires:  python
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 %package debugger-common
96 Summary:        Common debugger pretty printers for Rust
97 Group:          Development/Debuggers
98 BuildArch:      noarch
99
100 %description debugger-common
101 This package includes the common functionality for %{name}-gdb and
102 %{name}-lldb.
103
104 %package gdb
105 Summary:        GDB pretty printers for Rust
106 Group:          Development/Debuggers
107 Requires:       %{name}-debugger-common = %{version}-%{release}
108 Requires:       gdb
109 BuildArch:      noarch
110
111 %description gdb
112 This package includes the rust-gdb script, which allows easier
113 debugging of Rust programs.
114
115 %package lldb
116 Summary:        LLDB pretty printers for Rust
117 Group:          Development/Debuggers
118 Requires:       %{name}-debugger-common = %{version}-%{release}
119 Requires:       lldb
120 BuildArch:      noarch
121
122 %description lldb
123 This package includes the rust-lldb script, which allows easier
124 debugging of Rust programs.
125
126 %package doc
127 Summary:        Documentation for Rust
128 Group:          Documentation
129 BuildArch:      noarch
130
131 %description doc
132 This package includes HTML documentation for the Rust programming
133 language and its standard library.
134
135 %prep
136 %setup -q -n %{rustc_package}
137 %patch0 -p1
138
139 %if %{with bootstrap}
140 %ifarch %{x8664}
141 tar xf %{SOURCE1}
142 %endif
143 %ifarch %{ix86}
144 tar xf %{SOURCE2}
145 %endif
146 %{__mv} %{bootstrap_root} %{bootstrap_root}-root
147 %{bootstrap_root}-root/install.sh \
148         --components=cargo,rustc,rust-std-%{rust_triple} \
149         --prefix=%{local_rust_root} \
150         --disable-ldconfig
151 test -f %{local_rust_root}/bin/cargo
152 test -f %{local_rust_root}/bin/rustc
153 %endif
154
155 # unbundle
156 rm -r src/jemalloc/
157 rm -r src/llvm/
158
159 # extract bundled licenses for packaging
160 cp -p src/rt/hoedown/LICENSE src/rt/hoedown/LICENSE-hoedown
161 sed -e '/*\//q' src/libbacktrace/backtrace.h \
162         >src/libbacktrace/LICENSE-libbacktrace
163
164 # rust-gdb has hardcoded SYSROOT/lib -- let's make it noarch
165 sed -i -e 's#DIRECTORY=".*"#DIRECTORY="%{_datadir}/%{name}/etc"#' \
166         src/etc/rust-gdb
167
168 # These tests assume that alloc_jemalloc is present
169 sed -i -e '1i // ignore-test jemalloc is disabled' \
170         src/test/compile-fail/allocator-dylib-is-system.rs \
171         src/test/compile-fail/allocator-rust-dylib-is-jemalloc.rs \
172         src/test/run-pass/allocator-default.rs
173
174 %build
175 %configure \
176         --libdir=%{common_libdir} \
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         --enable-llvm-link-shared \
182         --disable-jemalloc \
183         --disable-rpath \
184         --enable-debuginfo \
185         --enable-vendor \
186         --release-channel=%{channel}
187
188 ./x.py dist
189
190 %{?with_tests:./x.py test}
191
192 %install
193 rm -rf $RPM_BUILD_ROOT
194
195 DESTDIR=$RPM_BUILD_ROOT ./x.py dist --install
196
197 # Make sure the shared libraries are in the proper libdir
198 %if "%{_libdir}" != "%{common_libdir}"
199 mkdir -p %{buildroot}%{_libdir}
200 find $RPM_BUILD_ROOT%{common_libdir} -maxdepth 1 -type f -name '*.so' \
201         -exec mv -v -t $RPM_BUILD_ROOT%{_libdir} '{}' '+'
202 %endif
203
204 # The shared libraries should be executable for debuginfo extraction.
205 find $RPM_BUILD_ROOT%{_libdir}/ -type f -name '*.so' -exec chmod -v +x '{}' '+'
206
207 # The libdir libraries are identical to those under rustlib/.  It's easier on
208 # library loading if we keep them in libdir, but we do need them in rustlib/
209 # to support dynamic linking for compiler plugins, so we'll symlink.
210 (cd "$RPM_BUILD_ROOT%{rustlibdir}/%{rust_triple}/lib" &&
211         find ../../../../%{_lib} -maxdepth 1 -name '*.so' \
212         -exec ln -v -f -s -t . '{}' '+')
213
214 # Remove installer artifacts (manifests, uninstall scripts, etc.)
215 find $RPM_BUILD_ROOT%{rustlibdir}/ -maxdepth 1 -type f -exec rm -v '{}' '+'
216
217 # FIXME: __os_install_post will strip the rlibs
218 # -- should we find a way to preserve debuginfo?
219
220 # Remove unwanted documentation files (we already package them)
221 rm $RPM_BUILD_ROOT%{_docdir}/%{name}/README.md
222 rm $RPM_BUILD_ROOT%{_docdir}/%{name}/COPYRIGHT
223 rm $RPM_BUILD_ROOT%{_docdir}/%{name}/LICENSE-APACHE
224 rm $RPM_BUILD_ROOT%{_docdir}/%{name}/LICENSE-MIT
225
226 # Sanitize the HTML documentation
227 find $RPM_BUILD_ROOT%{_docdir}/%{name}/html -empty -delete
228 find $RPM_BUILD_ROOT%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+'
229
230 # Move rust-gdb's python scripts so they're noarch
231 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}
232 mv -v $RPM_BUILD_ROOT%{rustlibdir}/%{_sysconfdir} $RPM_BUILD_ROOT%{_datadir}/%{name}/
233
234 %clean
235 rm -rf $RPM_BUILD_ROOT
236
237 %post   -p /sbin/ldconfig
238 %postun -p /sbin/ldconfig
239
240 %files
241 %defattr(644,root,root,755)
242 %doc COPYRIGHT LICENSE-APACHE LICENSE-MIT
243 %doc src/libbacktrace/LICENSE-libbacktrace
244 %doc src/rt/hoedown/LICENSE-hoedown
245 %doc README.md
246 %attr(755,root,root) %{_bindir}/rustc
247 %attr(755,root,root) %{_bindir}/rustdoc
248 %attr(755,root,root) %{_libdir}/lib*.so
249 %{_mandir}/man1/rustc.1*
250 %{_mandir}/man1/rustdoc.1*
251 %dir %{rustlibdir}
252 %dir %{rustlibdir}/%{rust_triple}
253 %dir %{rustlibdir}/%{rust_triple}/lib
254 %attr(755,root,root) %{rustlibdir}/%{rust_triple}/lib/*.so
255 %{rustlibdir}/%{rust_triple}/lib/*.rlib
256
257 %files debugger-common
258 %defattr(644,root,root,755)
259 %dir %{_datadir}/%{name}
260 %dir %{_datadir}/%{name}/etc
261 %{_datadir}/%{name}/etc/debugger_*.py*
262
263 %files lldb
264 %defattr(644,root,root,755)
265 %attr(755,root,root) %{_bindir}/rust-lldb
266 %{_datadir}/%{name}/etc/lldb_*.py*
267
268 %files gdb
269 %defattr(644,root,root,755)
270 %attr(755,root,root) %{_bindir}/rust-gdb
271 %{_datadir}/%{name}/etc/gdb_*.py*
272
273 %files doc
274 %defattr(644,root,root,755)
275 %dir %{_docdir}/%{name}
276 %doc %{_docdir}/%{name}/html
This page took 0.052371 seconds and 4 git commands to generate.