SHA256
1
0
forked from pool/rust
rust/rust.spec

204 lines
6.7 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 rustc_version 1_13
%global bootstrap 1.12.1
Name: rust
Version: 1.13.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_10
Obsoletes: rustc-1_11
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}
Recommends: cargo
Source0: https://static.rust-lang.org/dist/rustc-%{version}-src.tar.gz
Source1: rustc-%{bootstrap}-aarch64-unknown-linux-gnu.tar.gz
Source2: rustc-%{bootstrap}-armv7-unknown-linux-gnueabihf.tar.gz
Source3: rustc-%{bootstrap}-arm-unknown-linux-gnueabihf.tar.gz
Source4: rustc-%{bootstrap}-x86_64-unknown-linux-gnu.tar.gz
Source5: rustc-%{bootstrap}-i686-unknown-linux-gnu.tar.gz
ExclusiveArch: armv7hl armv6hl aarch64 %ix86 x86_64
Source100: %{name}-rpmlintrc
# PATCH-FIX-OPENSUSE: Set DT_SONAME when building dylibs
Patch1: add-soname.patch
# PATCH-FIX-UPSTREAM build armv7 on armv7
Patch2: 0001-Fix-armv7-autodetection.patch
# PATCH-FIX-UPSTREAM build arm on armv6
Patch3: 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}
Obsoletes: rust-1_11-gdb = %{version}
Obsoletes: rustc-1_11-gdb = %{version}
Supplements: packageand(%{name}:gdb)
%description gdb
This subpackage provides pretty printers and a wrapper script for
invoking gdb on rust binaries.
%prep
%setup -D -q -n rustc-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%ifarch aarch64
tar -xvzf $RPM_SOURCE_DIR/rustc-%{bootstrap}-aarch64-unknown-linux-gnu.tar.gz
%endif
%ifarch armv7hl
tar -xvzf $RPM_SOURCE_DIR/rustc-%{bootstrap}-armv7-unknown-linux-gnueabihf.tar.gz
%endif
%ifarch armv6hl
tar -xvzf $RPM_SOURCE_DIR/rustc-%{bootstrap}-arm-unknown-linux-gnueabihf.tar.gz
%endif
%ifarch x86_64
tar -xvzf $RPM_SOURCE_DIR/rustc-%{bootstrap}-x86_64-unknown-linux-gnu.tar.gz
%endif
%ifarch %ix86
tar -xvzf $RPM_SOURCE_DIR/rustc-%{bootstrap}-i686-unknown-linux-gnu.tar.gz
%endif
%build
pwd
export CPPFLAGS="$RPM_OPT_FLAGS" # eliminate complain from RPMlint
./configure \
--enable-local-rust \
%ifarch aarch64
--local-rust-root=%{_builddir}/rustc-%{version}/rustc-%{bootstrap}-aarch64-unknown-linux-gnu/rustc/ \
%endif
%ifarch armv7hl
--local-rust-root=%{_builddir}/rustc-%{version}/rustc-%{bootstrap}-armv7-unknown-linux-gnueabihf/rustc/ \
%endif
%ifarch armv6hl
--local-rust-root=%{_builddir}/rustc-%{version}/rustc-%{bootstrap}-arm-unknown-linux-gnueabihf/rustc/ \
%endif
%ifarch x86_64
--local-rust-root=%{_builddir}/rustc-%{version}/rustc-%{bootstrap}-x86_64-unknown-linux-gnu/rustc/ \
%endif
%ifarch %ix86
--local-rust-root=%{_builddir}/rustc-%{version}/rustc-%{bootstrap}-i686-unknown-linux-gnu/rustc/ \
%endif
--prefix=%{_prefix} \
--release-channel=stable
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