]> git.pld-linux.org Git - packages/rust.git/blobdiff - rust.spec
rpm4 noarch
[packages/rust.git] / rust.spec
index 7130ecb561801c16d8e30ead674f3621a60ed300..91be41aceac946be6767fd279286a4e38d2c5706 100644 (file)
--- a/rust.spec
+++ b/rust.spec
@@ -1,42 +1,41 @@
 # TODO
 # - consider a rust-std package containing .../rustlib/$target
 #   This might allow multilib cross-compilation to work naturally.
-
-# The channel can be stable, beta, or nightly
-%define channel stable
-
 #
 # Conditional build:
-%bcond_with bootstrap
-%bcond_without tests           # build without tests
+%bcond_with    bootstrap
+%bcond_with    tests           # build without tests
+
+# The channel can be stable, beta, or nightly
+%define                channel         stable
 
 %if "%{channel}" == "stable"
-%define rustc_package rustc-%{version}-src
+%define                rustc_package   rustc-%{version}-src
 %else
-%define rustc_package rustc-%{channel}-src
+%define                rustc_package   rustc-%{channel}-src
 %endif
 
 # 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_base https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}
+%define                bootstrap_rust  1.17.0
+%define                bootstrap_cargo 0.18.0
+%define                bootstrap_date  2017-04-27
 
 Summary:       The Rust Programming Language
 Name:          rust
 Version:       1.18.0
-Release:       0.1
+Release:       2
 # Licenses: (rust itself) and (bundled libraries)
 License:       (ASL 2.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:       %{bootstrap_base}-x86_64-unknown-linux-gnu.tar.gz
+Source1:       https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-x86_64-unknown-linux-gnu.tar.gz
 # Source1-md5: 98e8f479515969123b4c203191104a54
-Source2:       %{bootstrap_base}-i686-unknown-linux-gnu.tar.gz
+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
 URL:           https://www.rust-lang.org/
 BuildRequires: cmake
 BuildRequires: curl
@@ -48,9 +47,9 @@ BuildRequires:        ncurses-devel
 BuildRequires: python
 BuildRequires: zlib-devel
 %if %{without bootstrap}
-BuildRequires: %{name} < %{version}-%{release}
 BuildRequires: %{name} >= %{bootstrap_rust}
 BuildRequires: cargo >= %{bootstrap_cargo}
+BuildConflicts:        %{name} > %{version}
 %endif
 # make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs
 BuildRequires: procps
@@ -61,23 +60,30 @@ 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} %{arm}
+ExclusiveArch: %{x8664} %{ix86}
 
-%define rust_triple %{_target_cpu}-unknown-linux-gnu
+%define                rust_triple     %{_target_cpu}-unknown-linux-gnu
 
 %if %{without bootstrap}
-%define local_rust_root %{_prefix}
+%define                local_rust_root %{_prefix}
 %else
-%define bootstrap_root rust-%{bootstrap_rust}-%{rust_triple}
-%define local_rust_root %{_builddir}/%{rustc_package}/%{bootstrap_root}
+%define                bootstrap_root  rust-%{bootstrap_rust}-%{rust_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
+# 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                _noautoreqfiles         lib.*-[[:xdigit:]]{8}[.]so.*
+%define                _noautoprovfiles        lib.*-[[:xdigit:]]{8}[.]so.*
 
 %description
 Rust is a systems programming language that runs blazingly fast,
@@ -89,7 +95,9 @@ documentation generator.
 %package debugger-common
 Summary:       Common debugger pretty printers for Rust
 Group:         Development/Debuggers
+%if "%{_rpmversion}" >= "5"
 BuildArch:     noarch
+%endif
 
 %description debugger-common
 This package includes the common functionality for %{name}-gdb and
@@ -100,7 +108,9 @@ Summary:    GDB pretty printers for Rust
 Group:         Development/Debuggers
 Requires:      %{name}-debugger-common = %{version}-%{release}
 Requires:      gdb
+%if "%{_rpmversion}" >= "5"
 BuildArch:     noarch
+%endif
 
 %description gdb
 This package includes the rust-gdb script, which allows easier
@@ -111,8 +121,9 @@ Summary:    LLDB pretty printers for Rust
 Group:         Development/Debuggers
 Requires:      %{name}-debugger-common = %{version}-%{release}
 Requires:      lldb
-Requires:      python-lldb
+%if "%{_rpmversion}" >= "5"
 BuildArch:     noarch
+%endif
 
 %description lldb
 This package includes the rust-lldb script, which allows easier
@@ -121,7 +132,9 @@ debugging of Rust programs.
 %package doc
 Summary:       Documentation for Rust
 Group:         Documentation
+%if "%{_rpmversion}" >= "5"
 BuildArch:     noarch
+%endif
 
 %description doc
 This package includes HTML documentation for the Rust programming
@@ -129,6 +142,8 @@ language and its standard library.
 
 %prep
 %setup -q -n %{rustc_package}
+%patch0 -p1
+
 %if %{with bootstrap}
 %ifarch %{x8664}
 tar xf %{SOURCE1}
@@ -164,22 +179,14 @@ sed -i -e '1i // ignore-test jemalloc is disabled' \
        src/test/compile-fail/allocator-rust-dylib-is-jemalloc.rs \
        src/test/run-pass/allocator-default.rs
 
-# Fedora's LLVM doesn't support any mips targets -- see "llc -version".
-# Fixed properly by Rust PR36344, which should be released in 1.13.
-sed -i -e '/target=mips/,+1s/^/# unsupported /' \
-       src/test/run-make/atomic-lock-free/Makefile
-
-%if %{without bootstrap}
-# The hardcoded stage0 "lib" is inappropriate when using Fedora's own rustc
-sed -i -e '/^HLIB_RELATIVE/s/lib$/$$(CFG_LIBDIR_RELATIVE)/' mk/main.mk
-%endif
-
 %build
 %configure \
+       --libdir=%{common_libdir} \
        --disable-option-checking \
        --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \
        --enable-local-rust --local-rust-root=%{local_rust_root} \
        --llvm-root=%{_prefix} --disable-codegen-tests \
+       --enable-llvm-link-shared \
        --disable-jemalloc \
        --disable-rpath \
        --enable-debuginfo \
@@ -188,23 +195,32 @@ sed -i -e '/^HLIB_RELATIVE/s/lib$/$$(CFG_LIBDIR_RELATIVE)/' mk/main.mk
 
 ./x.py dist
 
+%{?with_tests:./x.py test}
+
 %install
 rm -rf $RPM_BUILD_ROOT
 
 DESTDIR=$RPM_BUILD_ROOT ./x.py dist --install
 
+# Make sure the shared libraries are in the proper libdir
+%if "%{_libdir}" != "%{common_libdir}"
+mkdir -p %{buildroot}%{_libdir}
+find $RPM_BUILD_ROOT%{common_libdir} -maxdepth 1 -type f -name '*.so' \
+       -exec mv -v -t $RPM_BUILD_ROOT%{_libdir} '{}' '+'
+%endif
+
 # The shared libraries should be executable for debuginfo extraction.
 find $RPM_BUILD_ROOT%{_libdir}/ -type f -name '*.so' -exec chmod -v +x '{}' '+'
 
 # The libdir libraries are identical to those under rustlib/.  It's easier on
 # library loading if we keep them in libdir, but we do need them in rustlib/
 # to support dynamic linking for compiler plugins, so we'll symlink.
-(cd "$RPM_BUILD_ROOT%{_libdir}/rustlib/%{rust_triple}/lib" &&
+(cd "$RPM_BUILD_ROOT%{rustlibdir}/%{rust_triple}/lib" &&
        find ../../../../%{_lib} -maxdepth 1 -name '*.so' \
        -exec ln -v -f -s -t . '{}' '+')
 
 # Remove installer artifacts (manifests, uninstall scripts, etc.)
-find $RPM_BUILD_ROOT%{_libdir}/rustlib/ -maxdepth 1 -type f -exec rm -v '{}' '+'
+find $RPM_BUILD_ROOT%{rustlibdir}/ -maxdepth 1 -type f -exec rm -v '{}' '+'
 
 # FIXME: __os_install_post will strip the rlibs
 # -- should we find a way to preserve debuginfo?
@@ -221,7 +237,7 @@ find $RPM_BUILD_ROOT%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+'
 
 # Move rust-gdb's python scripts so they're noarch
 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}
-mv -v $RPM_BUILD_ROOT%{_libdir}/rustlib%{_sysconfdir} $RPM_BUILD_ROOT%{_datadir}/%{name}/
+mv -v $RPM_BUILD_ROOT%{rustlibdir}/%{_sysconfdir} $RPM_BUILD_ROOT%{_datadir}/%{name}/
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -237,11 +253,14 @@ rm -rf $RPM_BUILD_ROOT
 %doc README.md
 %attr(755,root,root) %{_bindir}/rustc
 %attr(755,root,root) %{_bindir}/rustdoc
+%attr(755,root,root) %{_libdir}/lib*.so
 %{_mandir}/man1/rustc.1*
 %{_mandir}/man1/rustdoc.1*
-%{_libdir}/lib*
-%dir %{_libdir}/rustlib
-%{_libdir}/rustlib/%{rust_triple}
+%dir %{rustlibdir}
+%dir %{rustlibdir}/%{rust_triple}
+%dir %{rustlibdir}/%{rust_triple}/lib
+%attr(755,root,root) %{rustlibdir}/%{rust_triple}/lib/*.so
+%{rustlibdir}/%{rust_triple}/lib/*.rlib
 
 %files debugger-common
 %defattr(644,root,root,755)
This page took 0.371493 seconds and 4 git commands to generate.