X-Git-Url: http://git.pld-linux.org/?p=packages%2Frust.git;a=blobdiff_plain;f=rust.spec;h=491197f7fcce74030b0088039831b6db2943d3ce;hp=2b69a83087d69f6fd724b1b86c73c160f92a0836;hb=4f433f7;hpb=e8f16183581a7817ec39d6f518e6a7e48aeec833 diff --git a/rust.spec b/rust.spec index 2b69a83..491197f 100644 --- a/rust.spec +++ b/rust.spec @@ -1,9 +1,14 @@ # TODO # - consider a rust-std package containing .../rustlib/$target # This might allow multilib cross-compilation to work naturally. +# - package additional tools # # Conditional build: %bcond_with bootstrap # bootstrap using precompiled binaries +%bcond_with full_debuginfo # full debuginfo vs only std debuginfo (full takes gigabytes of memory to build) +%bcond_without system_llvm # system LLVM +%bcond_without rustc # rustc building +%bcond_without cargo # cargo building %bcond_with tests # build without tests # The channel can be stable, beta, or nightly @@ -18,32 +23,39 @@ # To bootstrap from scratch, set the channel and date from src/stage0.txt # e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24 # or nightly wants some beta-YYYY-MM-DD -%define bootstrap_rust 1.17.0 -%define bootstrap_cargo 0.18.0 -%define bootstrap_date 2017-04-27 +%define bootstrap_rust 1.43.1 +%define bootstrap_cargo 1.43.1 +%define bootstrap_date 2020-05-07 +%ifarch x32 +%undefine with_cargo +%undefine with_rustc +%endif Summary: The Rust Programming Language Summary(pl.UTF-8): Język programowania Rust Name: rust -Version: 1.18.0 -Release: 2 +Version: 1.44.1 +Release: 1 # Licenses: (rust itself) and (bundled libraries) License: (Apache v2.0 or MIT) and (BSD and ISC and MIT) Group: Development/Languages -Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.gz -# Source0-md5: c37c0cd9d500f6a9d1f2f44401351f88 -Source1: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-x86_64-unknown-linux-gnu.tar.gz -# Source1-md5: 98e8f479515969123b4c203191104a54 -Source2: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-i686-unknown-linux-gnu.tar.gz -# Source2-md5: 2d5de850c32aa8d40c8c21abacf749f8 -Patch0: rust-1.16.0-configure-no-override.patch +Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz +# Source0-md5: 0cc3b079ddb1eb9a17f9e7e52efcebc5 +Source1: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-x86_64-unknown-linux-gnu.tar.xz +# Source1-md5: 62b0974a4bad5aeabd50c7a7fa74518c +Source2: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-i686-unknown-linux-gnu.tar.xz +# Source2-md5: 758d55172c8dddb1ec71913b5f532bb2 +Source3: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-std-%{bootstrap_rust}-x86_64-unknown-linux-gnux32.tar.xz +# Source3-md5: 4b07c6922a0965791cf8eb28fee9e89d +Source4: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-aarch64-unknown-linux-gnu.tar.xz +# Source4-md5: 3a9d54ab96f96664b2f6077cccb4e70b URL: https://www.rust-lang.org/ # for src/compiler-rt BuildRequires: cmake >= 3.4.3 BuildRequires: curl BuildRequires: libstdc++-devel -BuildRequires: llvm-devel -BuildRequires: ncurses-devel +%{?with_system_llvm:BuildRequires: llvm-devel >= 7.0} +BuildRequires: openssl-devel >= 1.0.1 BuildRequires: python >= 1:2.7 BuildRequires: zlib-devel %if %{without bootstrap} @@ -57,34 +69,49 @@ BuildRequires: procps # invoke the linker directly, and then we'll only need binutils. # https://github.com/rust-lang/rust/issues/11937 Requires: gcc -BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) # Only x86_64 and i686 are Tier 1 platforms at this time. -# https://doc.rust-lang.org/stable/book/getting-started.html#tier-1 -ExclusiveArch: %{x8664} %{ix86} +# x32 is Tier 2, only rust-std is available (no rustc or cargo). +# https://doc.rust-lang.org/nightly/rustc/platform-support.html +ExclusiveArch: %{x8664} %{ix86} x32 aarch64 +BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) -%define rust_triple %{_target_cpu}-unknown-linux-gnu +%ifarch x32 +%define rust_triple x86_64-unknown-linux-gnux32 +%define rust_bootstrap_triple x86_64-unknown-linux-gnu +%else +%define rust_triple %{_target_cpu}-unknown-linux-gnu +%define rust_bootstrap_triple %{_target_cpu}-unknown-linux-gnu +%endif %if %{without bootstrap} %define local_rust_root %{_prefix} %else -%define bootstrap_root rust-%{bootstrap_rust}-%{rust_triple} +%define bootstrap_root rust-%{bootstrap_rust}-%{rust_bootstrap_triple} %define local_rust_root %{_builddir}/%{rustc_package}/%{bootstrap_root} %endif # We're going to override --libdir when configuring to get rustlib into a # common path, but we'll fix the shared libraries during install. -# Without this ugly hack, rust would not be able to buld itself +# Without this ugly hack, rust would not be able to build itself # for non-bootstrap build, lib64 is just too complicated for it. %define common_libdir %{_prefix}/lib %define rustlibdir %{common_libdir}/rustlib # once_call/once_callable non-function libstdc++ symbols -%define skip_post_check_so 'librustc_llvm-.*\.so.*' +%define skip_post_check_so 'librustc.*llvm.*\.so.*' # ALL Rust libraries are private, because they don't keep an ABI. %define _noautoreqfiles lib.*-[[:xdigit:]]{8}[.]so.* %define _noautoprovfiles lib.*-[[:xdigit:]]{8}[.]so.* +%define x_py { \ + x_py() { \ + local cmd="$1"; \ + shift; \ + %{?__jobs:CARGO_BUILD_JOBS=%__jobs }./x.py "$cmd" %{?__jobs:-j %__jobs} "$@"; \ + }; x_py } + + %description Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety. @@ -156,9 +183,48 @@ language and its standard library. Ten pakiet zawiera dokumentację w formacie HTML do języka programowania Rust i jego biblioteki standardowej. +%package -n cargo +Summary: Rust's package manager and build tool +Summary(pl.UTF-8): Zarządca pakietów i narzędzie do budowania +Group: Development/Tools +Requires: %{name} + +%description -n cargo +Cargo is a tool that allows Rust projects to declare their various +dependencies and ensure that you'll always get a repeatable build. + +%description -n cargo -l pl.UTF-8 +Cargo to narzędzie pozwalające projektom w języku Rust deklarować ich +zależności i zapewniające powtarzalność procesu budowania. + +%package -n bash-completion-cargo +Summary: Bash completion for cargo command +Summary(pl.UTF-8): Bashowe dopełnianie parametrów polecenia cargo +Group: Applications/Shells +Requires: %{name} = %{version}-%{release} +Requires: bash-completion + +%description -n bash-completion-cargo +Bash completion for cargo command. + +%description -n bash-completion-cargo -l pl.UTF-8 +Bashowe dopełnianie parametrów polecenia cargo. + +%package -n zsh-completion-cargo +Summary: Zsh completion for cargo command +Summary(pl.UTF-8): Dopełnianie parametrów polecenia cargo w powłoce Zsh +Group: Applications/Shells +Requires: %{name} = %{version}-%{release} +Requires: zsh + +%description -n zsh-completion-cargo +Zsh completion for cargo command. + +%description -n zsh-completion-cargo -l pl.UTF-8 +Dopełnianie parametrów polecenia cargo w powłoce Zsh. + %prep %setup -q -n %{rustc_package} -%patch0 -p1 %if %{with bootstrap} %ifarch %{x8664} @@ -167,33 +233,49 @@ tar xf %{SOURCE1} %ifarch %{ix86} tar xf %{SOURCE2} %endif +%ifarch x32 +tar xf %{SOURCE1} +cd %{bootstrap_root} +tar xf %{SOURCE3} +%{__mv} rust-std-%{bootstrap_rust}-%{rust_triple} rust-std-%{rust_triple} +cd .. +%endif +%ifarch aarch64 +tar xf %{SOURCE4} +%endif %{__mv} %{bootstrap_root} %{bootstrap_root}-root %{bootstrap_root}-root/install.sh \ - --components=cargo,rustc,rust-std-%{rust_triple} \ + --components=cargo,rustc,rust-std-%{rust_bootstrap_triple} \ --prefix=%{local_rust_root} \ --disable-ldconfig test -f %{local_rust_root}/bin/cargo test -f %{local_rust_root}/bin/rustc +%ifarch x32 +%{bootstrap_root}-root/rust-std-%{rust_triple}/install.sh \ + --components=rust-std-%{rust_triple} \ + --prefix=%{local_rust_root} \ + --disable-ldconfig +%endif %endif # unbundle -%{__rm} -r src/jemalloc/ -%{__rm} -r src/llvm/ +# We're disabling jemalloc, but rust-src still wants it. +#%{__rm} -r src/jemalloc +%{?with_system_llvm:%{__rm} -r src/llvm-project} # extract bundled licenses for packaging -cp -p src/rt/hoedown/LICENSE src/rt/hoedown/LICENSE-hoedown -sed -e '/*\//q' src/libbacktrace/backtrace.h \ - >src/libbacktrace/LICENSE-libbacktrace +sed -e '/*\//q' vendor/backtrace-sys/src/libbacktrace/backtrace.h \ + >vendor/backtrace-sys/src/libbacktrace/LICENSE-libbacktrace # rust-gdb has hardcoded SYSROOT/lib -- let's make it noarch sed -i -e 's#DIRECTORY=".*"#DIRECTORY="%{_datadir}/%{name}/etc"#' \ src/etc/rust-gdb -# These tests assume that alloc_jemalloc is present -sed -i -e '1i // ignore-test jemalloc is disabled' \ - src/test/compile-fail/allocator-dylib-is-system.rs \ - src/test/compile-fail/allocator-rust-dylib-is-jemalloc.rs \ - src/test/run-pass/allocator-default.rs +# The configure macro will modify some autoconf-related files, which upsets +# cargo when it tries to verify checksums in those files. If we just truncate +# that file list, cargo won't have anything to complain about. +find vendor -name .cargo-checksum.json \ + -exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+' %build %configure \ @@ -202,24 +284,35 @@ sed -i -e '1i // ignore-test jemalloc is disabled' \ --target=%{rust_triple} \ --libdir=%{common_libdir} \ --disable-codegen-tests \ + --disable-debuginfo-lines \ +%if %{with full_debuginfo} + --disable-debuginfo-only-std \ + --enable-debuginfo \ +%else + --enable-debuginfo-only-std \ + --disable-debuginfo \ +%endif --disable-jemalloc \ --disable-option-checking \ --disable-rpath \ - --enable-debuginfo \ + --enable-extended \ --enable-llvm-link-shared \ - --enable-local-rust --local-rust-root=%{local_rust_root} \ --enable-vendor \ + --local-rust-root=%{local_rust_root} \ --llvm-root=%{_prefix} \ --release-channel=%{channel} -./x.py dist +export RUST_BACKTRACE=full +%x_py dist --verbose -%{?with_tests:./x.py test} +%{?with_tests:%x_py test} %install rm -rf $RPM_BUILD_ROOT -DESTDIR=$RPM_BUILD_ROOT ./x.py dist --install +export DESTDIR=$RPM_BUILD_ROOT +%x_py install +%x_py install src # Make sure the shared libraries are in the proper libdir %if "%{_libdir}" != "%{common_libdir}" @@ -258,6 +351,12 @@ find $RPM_BUILD_ROOT%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+' install -d $RPM_BUILD_ROOT%{_datadir}/%{name} %{__mv} $RPM_BUILD_ROOT%{rustlibdir}/etc $RPM_BUILD_ROOT%{_datadir}/%{name} +# We don't need stdlib source +%{__rm} -r $RPM_BUILD_ROOT%{rustlibdir}/src + +# Create the path for crate-devel packages +install -d $RPM_BUILD_ROOT%{_datadir}/cargo/registry + %clean rm -rf $RPM_BUILD_ROOT @@ -266,29 +365,19 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(644,root,root,755) -%doc COPYRIGHT LICENSE-APACHE LICENSE-MIT README.md src/libbacktrace/LICENSE-libbacktrace src/rt/hoedown/LICENSE-hoedown +%doc COPYRIGHT LICENSE-APACHE LICENSE-MIT README.md vendor/backtrace-sys/src/libbacktrace/LICENSE-libbacktrace +%attr(755,root,root) %{_bindir}/rls %attr(755,root,root) %{_bindir}/rustc %attr(755,root,root) %{_bindir}/rustdoc -%attr(755,root,root) %{_libdir}/libarena-*.so -%attr(755,root,root) %{_libdir}/libflate-*.so -%attr(755,root,root) %{_libdir}/libfmt_macros-*.so -%attr(755,root,root) %{_libdir}/libgetopts-*.so -%attr(755,root,root) %{_libdir}/libgraphviz-*.so -%attr(755,root,root) %{_libdir}/libproc_macro-*.so -%attr(755,root,root) %{_libdir}/libproc_macro_plugin-*.so +%attr(755,root,root) %{_bindir}/rustfmt %attr(755,root,root) %{_libdir}/librustc*-*.so -%attr(755,root,root) %{_libdir}/librustdoc-*.so -%attr(755,root,root) %{_libdir}/libserialize-*.so %attr(755,root,root) %{_libdir}/libstd-*.so -%attr(755,root,root) %{_libdir}/libsyntax-*.so -%attr(755,root,root) %{_libdir}/libsyntax_ext-*.so -%attr(755,root,root) %{_libdir}/libsyntax_pos-*.so -%attr(755,root,root) %{_libdir}/libterm-*.so %attr(755,root,root) %{_libdir}/libtest-*.so %{_mandir}/man1/rustc.1* %{_mandir}/man1/rustdoc.1* %dir %{rustlibdir} %dir %{rustlibdir}/%{rust_triple} +%{rustlibdir}/%{rust_triple}/analysis %dir %{rustlibdir}/%{rust_triple}/lib %attr(755,root,root) %{rustlibdir}/%{rust_triple}/lib/*.so %{rustlibdir}/%{rust_triple}/lib/*.rlib @@ -307,9 +396,28 @@ rm -rf $RPM_BUILD_ROOT %files gdb %defattr(644,root,root,755) %attr(755,root,root) %{_bindir}/rust-gdb +%attr(755,root,root) %{_bindir}/rust-gdbgui %{_datadir}/%{name}/etc/gdb_*.py* %files doc %defattr(644,root,root,755) %dir %{_docdir}/%{name} %doc %{_docdir}/%{name}/html + +%files -n cargo +%defattr(644,root,root,755) +%attr(755,root,root) %{_bindir}/cargo +%attr(755,root,root) %{_bindir}/cargo-clippy +%attr(755,root,root) %{_bindir}/cargo-fmt +%attr(755,root,root) %{_bindir}/clippy-driver +%{_mandir}/man1/cargo*.1* +%dir %{_datadir}/cargo +%dir %{_datadir}/cargo/registry + +%files -n bash-completion-cargo +%defattr(644,root,root,755) +%{_sysconfdir}/bash_completion.d/cargo + +%files -n zsh-completion-cargo +%defattr(644,root,root,755) +%{zsh_compdir}/_cargo