rust/rust.spec

197 lines
6.1 KiB
RPMSpec

#
# spec file for package rust
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%bcond_without bootstrap_tarball
%global rustc_version 1_11
%global rustc_build_version 1_10
Name: rust
Version: 1.11.0
Release: 0
Summary: A systems programming language
License: MIT or Apache-2.0
Group: Development/Languages/Other
Url: http://www.rust-lang.org
ExclusiveArch: %ix86 x86_64 %arm aarch64
# renamed to match upstream and other distros
Obsoletes: rustc-1_9
Provides: rustc = %{version}
Provides: rustc-stable = %{version}
#FIXME: currently there's no way to have rustc and rustc-beta installed
# some alternatives system should be implemented
Conflicts: rustc < %{version}
BuildRequires: rustc-%{rustc_build_version}
Recommends: cargo
Source0: https://static.rust-lang.org/dist/rustc-%{version}-src.tar.gz
#use snap.sh to update following lines from "magic" constanst from src/snapshots.txt
Source100: %{name}-rpmlintrc
# PATCH-FIX-OPENSUSE: Disable embedding timestamp information
Patch1: 0003-Disable-embedding-timestamp-information.patch
# PATCH-FIX-OPENSUSE: Set DT_SONAME when building dylibs
Patch2: add-soname.patch
# PATCH-FIX-UPSTREAM build armv7 on armv7
Patch3: 0001-Fix-armv7-autodetection.patch
# PATCH-FIX-UPSTREAM build arm on armv6
Patch4: 0002-Add-armv6l-autodetection.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: curl
%if 0%{?suse_version}
BuildRequires: fdupes
%endif
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: python
%description
Rust is a systems programming language focused on three goals:
safety, speed, and concurrency. It maintains these goals without
having a garbage collector, making it a useful language for a
number of use cases other languages are not good at: embedding
in other languages, programs with specific space and time
requirements, and writing low-level code, like device drivers
and operating systems. It improves on current languages targeting
this space by having a number of compile-time safety checks
that produce no runtime overhead, while eliminating all
data races. Rust also aims to achieve "zero-cost abstractions",
even though some of these abstractions feel like those of a
high-level language. Even then, Rust still allows precise
control like a low-level language would.
%package doc
Summary: Rust documentation
Group: Development/Languages/Other
%description doc
Documentation for the Rust language.
%package gdb
Summary: Gdb integration for rust binaries
Group: Development/Languages/Other
Provides: rust-%{rustc_version}-gdb = %{version}
Provides: rustc:/usr/bin/rust-gdb
Obsoletes: rust-1_9-gdb = %{version}
Provides: rust-1_9-gdb <= %{version}
Obsoletes: rustc-1_9-gdb = %{version}
Provides: rustc-1_9-gdb <= %{version}
Obsoletes: rust-1_10-gdb = %{version}
Provides: rust-1_10-gdb <= %{version}
Obsoletes: rustc-1_10-gdb = %{version}
Provides: rustc-1_10-gdb <= %{version}
Supplements: packageand(%{name}:gdb)
%description gdb
This subpackage provides pretty printers and a wrapper script for
invoking gdb on rust binaries.
%if %{with bootstrap_tarball}
%package bootstrap-tarball
Summary: Bootstrap tarball with rust binaries
Group: Development/Languages/Other
%description bootstrap-tarball
This subpackage provides tarball with rust binaries used for rust-bootstrap
package.
%endif
%prep
%setup -q -n rustc-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
export CPPFLAGS="$RPM_OPT_FLAGS" # eliminate complain from RPMlint
./configure \
--enable-local-rust \
--local-rust-root=%{_prefix} \
--prefix=%{_prefix} \
--release-channel=stable
make %{?_smp_mflags}
%if %{with bootstrap_tarball}
make %{?_smp_mflags} dist-tar-bins
%endif
%install
make %{?_smp_mflags} install DESTDIR=$RPM_BUILD_ROOT
# Remove executable permission from HTML documentation
# to prevent RPMLINT errors.
chmod -R -x+X $RPM_BUILD_ROOT%{_prefix}/share/doc/rust/html
# Remove files which mention buildroot to prevent RPMLINT errors.
rm $RPM_BUILD_ROOT%{_prefix}/lib/rustlib/manifest-rust*
rm $RPM_BUILD_ROOT%{_prefix}/lib/rustlib/install.log
# Remove lockfile to avoid errors.
rm $RPM_BUILD_ROOT%{_prefix}/share/doc/rust/html/.lock
# allow parallel installation of docs
mv %{buildroot}%{_prefix}/share/doc/rust \
%{buildroot}%{_prefix}/share/doc/rust-%{version}
%if 0%{?suse_version}
%fdupes $RPM_BUILD_ROOT%{_prefix}
%endif
%if %{with bootstrap_tarball}
mkdir -p %{buildroot}%{_prefix}/share/rust-bootstrap-tarball
mv dist/rustc-*.tar.gz %{buildroot}%{_prefix}/share/rust-bootstrap-tarball
%endif
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(-,root,root,-)
%{_bindir}/rustc
%{_bindir}/rustdoc
%{_mandir}/*/rust*
%exclude %{_prefix}/share/doc/rust
%{_prefix}/lib/*.so
%{_prefix}/lib/rustlib
%exclude %{_prefix}/lib/rustlib/etc/gdb_load_rust_pretty_printers.py
%exclude %{_prefix}/lib/rustlib/etc/gdb_rust_pretty_printing.py
%files doc
%defattr(-,root,root)
%{_prefix}/share/doc/rust-%{version}
%files gdb
%defattr(-,root,root,-)
%{_bindir}/rust-gdb
%{_prefix}/lib/rustlib/etc/gdb_load_rust_pretty_printers.py
%{_prefix}/lib/rustlib/etc/gdb_rust_pretty_printing.py
%if %{with bootstrap_tarball}
%files bootstrap-tarball
%defattr(-,root,root,-)
%dir %{_prefix}/share/rust-bootstrap-tarball
%{_prefix}/share/rust-bootstrap-tarball/rustc-*.tar.gz
%endif
%changelog