rust/rust.spec

157 lines
5.1 KiB
RPMSpec

#
# spec file for package rust
#
# Copyright (c) 2015 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/
#
%global rustc_version 1_10
%global rustc_build_version 1_9
Name: rust
Version: 1.10.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
# renamed to match upstream and other distros
Provides: rustc-%{rustc_version} = %{version}
Obsoletes: rustc-%{rustc_version} <= 1.5
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-UPSTREAM: Fix misleading intentation errors on gcc 6.0
Patch1: 0001-Fix-misleading-intentation-errors-on-gcc-6.0.patch
# PATCH-FIX-UPSTREAM: Fix GCC 6 misleading indentation error in hoedown
Patch2: 0002-Fix-GCC-6-misleading-indentation-error-in-hoedown.patch
# PATCH-FIX-OPENSUSE: Disable embedding timestamp information
Patch3: 0003-Disable-embedding-timestamp-information.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: curl
%if 0%{?suse_version}
BuildRequires: fdupes
%endif
BuildRequires: gcc-c++
BuildRequires: python
BuildRequires: cmake
%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: rustc:/usr/bin/rust-gdb
Provides: rust-%{rustc_version}-gdb = %{version}
Obsoletes: rust-%{rustc_build_version}-gdb
Supplements: packageand(%{name}:gdb)
%description gdb
This subpackage provides pretty printers and a wrapper script for
invoking gdb on rust binaries.
%prep
%setup -q -n rustc-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
export CPPFLAGS="$RPM_OPT_FLAGS" # eliminate complain from RPMlint
./configure \
--enable-local-rust \
--local-rust-root=%{_prefix} \
--prefix=%{_prefix}
make %{?_smp_mflags}
%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
%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
%changelog