rust/rust.spec

159 lines
4.8 KiB
RPMSpec
Raw Normal View History

#
# 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/
#
%global prev_version 1.13.0
%bcond_with bootstrap
Name: rust
Version: 1.14.0
Release: 0
Summary: A systems programming language
License: MIT or Apache-2.0
Group: Development/Languages/Other
Url: http://www.rust-lang.org
Source0: https://static.rust-lang.org/dist/rustc-%{version}-src.tar.gz
Source100: %{name}-rpmlintrc
# PATCH-FIX-OPENSUSE: Set DT_SONAME when building dylibs
Patch1: add-soname.patch
BuildRequires: cmake
BuildRequires: curl
BuildRequires: gcc-c++
BuildRequires: python
Recommends: cargo
#FIXME: currently there's no way to have rustc and rustc-beta installed
Conflicts: rust < %{version}
Conflicts: rustc <= %{version}
Conflicts: rustc-bootstrap <= %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExclusiveArch: %{ix86} x86_64 %{arm} aarch64
%if 0%{?suse_version}
BuildRequires: fdupes
%endif
%if %{with bootstrap}
BuildRequires: rustc-bootstrap <= %{prev_version}
BuildRequires: rustc-bootstrap >= %{prev_version}
%else
%ifnarch armv7hl
BuildRequires: rust <= %{version}
BuildRequires: rust >= %{prev_version}
%endif
%ifarch armv7hl
BuildRequires: rustc-bootstrap <= %{prev_version}
BuildRequires: rustc-bootstrap >= %{prev_version}
%endif
%endif
%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
Supplements: packageand(%{name}:gdb)
Provides: rust-gdb = %{version}
Provides: rustc:%{_bindir}/rust-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
%build
export CPPFLAGS="%{optflags}" # eliminate complain from RPMlint
# FIXME: you should use the %%configure macro
./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} DESTDIR=%{buildroot} install
# Remove executable permission from HTML documentation
# to prevent RPMLINT errors.
chmod -R -x+X %{buildroot}%{_datadir}/doc/rust/html
# Remove files which mention buildroot to prevent RPMLINT errors.
rm %{buildroot}%{_prefix}/lib/rustlib/manifest-rust*
rm %{buildroot}%{_prefix}/lib/rustlib/install.log
# Remove lockfile to avoid errors.
rm %{buildroot}%{_datadir}/doc/rust/html/.lock
# allow parallel installation of docs
mv %{buildroot}%{_datadir}/doc/rust \
%{buildroot}%{_datadir}/doc/rust-%{version}
%if 0%{?suse_version}
%fdupes %{buildroot}%{_prefix}
%endif
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(-,root,root,-)
%{_bindir}/rustc
%{_bindir}/rustdoc
%{_mandir}/*/rust*
%exclude %{_datadir}/doc/rust
%{_prefix}/lib/*.so
%{_prefix}/lib/rustlib
%exclude %{_prefix}/lib/rustlib%{_sysconfdir}/gdb_load_rust_pretty_printers.py
%exclude %{_prefix}/lib/rustlib%{_sysconfdir}/gdb_rust_pretty_printing.py
%files doc
%defattr(-,root,root)
%{_datadir}/doc/rust-%{version}
%files gdb
%defattr(-,root,root,-)
%{_bindir}/rust-gdb
%{_prefix}/lib/rustlib%{_sysconfdir}/gdb_load_rust_pretty_printers.py
%{_prefix}/lib/rustlib%{_sysconfdir}/gdb_rust_pretty_printing.py
%changelog