File rustc-1_9.spec of Package rustc-1_9

#
# 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/
#

%define with_bootstrap 1

Name:           rustc-1_9
Version:        1.9.0
Release:        0
Summary:        Systems programming language that runs blazingly fast
License:        MIT or Apache-2.0
Group:          Development/Languages/Other
Url:            http://www.rust-lang.org
# renamed to match upstream and other distros
Provides:       rust = %{version}
Obsoletes:      rust <= 1.5
Provides:       rustc = %{version}
#FIXME: currently there's no way to have rustc and rustc-beta installed
#       some alternatives system should be implemented
Conflicts:      rustc < %{version}

%if %with_bootstrap
BuildRequires:  rustc-stage0 = 20160318.235d774
%else
BuildRequires:  rustc >= 1.9
%endif

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 aren’t 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 -n rust-1_9-gdb
Summary:        Gdb integration for rust binaries
Group:          Development/Languages/Other
Provides:       rustc:/usr/bin/rust-gdb
Supplements:    packageand(%{name}:gdb)

%description -n rust-1_9-gdb
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 \
%if %with_bootstrap
    --local-rust-root=%{_libexecdir}/rust-stage0 \
%else
    --local-rust-root=%{_prefix} \
%endif
    --prefix=%{_prefix}
make %{?jobs:-j%jobs}

%install
make %{?jobs:-j%jobs} 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

%if 0%{?suse_version}
%fdupes $RPM_BUILD_ROOT%{_prefix}
%endif

%post
/sbin/ldconfig

%postun
/sbin/ldconfig

%clean
rm -rf $RPM_BUILD_ROOT

%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

%files -n rust-1_9-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
openSUSE Build Service is sponsored by