299 lines
9.3 KiB
RPMSpec
299 lines
9.3 KiB
RPMSpec
#
|
|
# spec file for package rust
|
|
#
|
|
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
|
# Copyright (c) 2017 Luke Jones, luke.nukem.jones@gmail.com
|
|
#
|
|
# 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_rust 1.19.0
|
|
%global cargo_version 0.21.0
|
|
%bcond_without rust_bootstrap
|
|
|
|
%global rust_arch %{_arch}
|
|
%global abi gnu
|
|
%ifarch armv7hl
|
|
%global rust_arch armv7
|
|
%global abi gnueabihf
|
|
%endif
|
|
%ifarch ppc64
|
|
%global rust_arch powerpc64
|
|
%endif
|
|
%ifarch ppc64le
|
|
%global rust_arch powerpc64le
|
|
%endif
|
|
# Must restrict the x86 build to i686 since i586 is currently unsupported
|
|
%ifarch %ix86
|
|
%global rust_arch i686
|
|
%endif
|
|
%global rust_triple %{rust_arch}-unknown-linux-%{abi}
|
|
|
|
%global dl_url https://static.rust-lang.org/dist
|
|
%global common_libdir %{_prefix}/lib
|
|
%global rustlibdir %{common_libdir}/rustlib
|
|
|
|
Name: rust
|
|
Version: 1.20.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: %{dl_url}/rustc-%{version}-src.tar.gz
|
|
Source1: config.toml
|
|
Source99: %{name}-rpmlintrc
|
|
Source100: cargo-%{cargo_version}-x86_64-unknown-linux-gnu.tar.gz
|
|
Source101: cargo-%{cargo_version}-i686-unknown-linux-gnu.tar.gz
|
|
Source102: cargo-%{cargo_version}-aarch64-unknown-linux-gnu.tar.gz
|
|
Source103: cargo-%{cargo_version}-armv7-unknown-linux-gnueabihf.tar.gz
|
|
Source104: cargo-%{cargo_version}-powerpc64-unknown-linux-gnu.tar.gz
|
|
Source105: cargo-%{cargo_version}-powerpc64le-unknown-linux-gnu.tar.gz
|
|
Source106: cargo-%{cargo_version}-s390x-unknown-linux-gnu.tar.gz
|
|
# PATCH-FIX-OPENSUSE: Set DT_SONAME when building dylibs
|
|
Patch1: add-soname.patch
|
|
BuildRequires: ccache
|
|
BuildRequires: chrpath
|
|
BuildRequires: cmake >= 3.4.3
|
|
BuildRequires: curl
|
|
BuildRequires: gcc-c++
|
|
BuildRequires: llvm-devel
|
|
BuildRequires: ninja
|
|
BuildRequires: procps
|
|
BuildRequires: python
|
|
Recommends: cargo
|
|
Recommends: %{name}-doc
|
|
Recommends: %{name}-std
|
|
|
|
Provides: rust = %{version}
|
|
Conflicts: otherproviders(rust)
|
|
Conflicts: rustc-bootstrap
|
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
# Restrict the architectures as building rust relies on being initially
|
|
# bootstrapped before we can build the n+1 release
|
|
ExclusiveArch: x86_64 %{arm} aarch64 ppc64 ppc64le s390x
|
|
%ifarch %ix86
|
|
ExclusiveArch: i586 i686
|
|
BuildArch: i686
|
|
%endif
|
|
|
|
%if 0%{?suse_version}
|
|
BuildRequires: fdupes
|
|
%endif
|
|
|
|
%if %{with rust_bootstrap}
|
|
BuildRequires: rust-std-bootstrap = %{prev_rust}
|
|
BuildRequires: rustc-bootstrap = %{prev_rust}
|
|
%else
|
|
BuildRequires: rust <= %{version}
|
|
BuildRequires: rust >= %{prev_rust}
|
|
BuildRequires: rust-std <= %{version}
|
|
BuildRequires: rust-std >= %{prev_rust}
|
|
%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 -n rust-std
|
|
Summary: Standard library for Rust
|
|
Group: Development/Languages/Other
|
|
Conflicts: otherproviders(rust-std)
|
|
|
|
%description -n rust-std
|
|
This package includes the standard libraries for building
|
|
applications written in Rust.
|
|
|
|
%package -n rust-doc
|
|
Summary: Rust documentation
|
|
Group: Development/Languages/Other
|
|
Conflicts: otherproviders(rust-doc)
|
|
|
|
%description -n rust-doc
|
|
Documentation for the Rust language.
|
|
|
|
%package -n rust-gdb
|
|
Summary: Gdb integration for rust binaries
|
|
Group: Development/Languages/Other
|
|
Supplements: packageand(%{name}:gdb)
|
|
Provides: rustc:%{_bindir}/rust-gdb
|
|
Conflicts: otherproviders(rust-gdb)
|
|
|
|
%description -n rust-gdb
|
|
This subpackage provides pretty printers and a wrapper script for
|
|
invoking gdb on rust binaries.
|
|
|
|
%package -n rust-src
|
|
Summary: Sources for the Rust standard library
|
|
Group: Development/Languages/Other
|
|
BuildArch: noarch
|
|
|
|
%description -n rust-src
|
|
This package includes source files for the Rust standard library. This
|
|
is commonly used for function detail lookups in helper programs such
|
|
as RLS or racer.
|
|
|
|
%prep
|
|
%ifarch x86_64
|
|
%setup -q -T -b 100 -n cargo-%{cargo_version}-%{rust_triple}
|
|
%endif
|
|
%ifarch %ix86
|
|
%setup -q -T -b 101 -n cargo-%{cargo_version}-i686-unknown-linux-%{abi}
|
|
%endif
|
|
%ifarch aarch64
|
|
%setup -q -T -b 102 -n cargo-%{cargo_version}-%{rust_triple}
|
|
%endif
|
|
%ifarch armv7hl
|
|
%setup -q -T -b 103 -n cargo-%{cargo_version}-%{rust_triple}
|
|
%endif
|
|
%ifarch ppc64
|
|
%setup -q -T -b 104 -n cargo-%{cargo_version}-%{rust_triple}
|
|
%endif
|
|
%ifarch ppc64le
|
|
%setup -q -T -b 105 -n cargo-%{cargo_version}-%{rust_triple}
|
|
%endif
|
|
%ifarch s390x
|
|
%setup -q -T -b 106 -n cargo-%{cargo_version}-%{rust_triple}
|
|
%endif
|
|
|
|
# The cargo binary is only used to build rust and is not shipped
|
|
# Using i686 for i586 seems to be okay for now but may cause issues in future
|
|
%ifarch %ix86
|
|
%global cargo_bin %{_builddir}/cargo-%{cargo_version}-i686-unknown-linux-%{abi}/cargo/bin/cargo
|
|
%else
|
|
%global cargo_bin %{_builddir}/cargo-%{cargo_version}-%{rust_triple}/cargo/bin/cargo
|
|
%endif
|
|
|
|
%setup -q -n rustc-%{version}-src
|
|
%patch1 -p1
|
|
sed -e 's:<cargo-bin>:%{cargo_bin}:g' \
|
|
-e 's:<rust-triple>:%{rust_triple}:g' \
|
|
-e 's:<prefix>:%{_prefix}:g' \
|
|
-e 's:<libdir>:%{common_libdir}:g' \
|
|
-e 's:<mandir>:%{_mandir}:g' \
|
|
-e 's:<docdir>:%{_docdir}/%{name}:g' \
|
|
%{SOURCE1} > config.toml
|
|
|
|
%build
|
|
export CPPFLAGS="%{optflags}" # eliminate complain from RPMlint
|
|
./x.py build --config config.toml
|
|
./x.py doc --config config.toml
|
|
|
|
%install
|
|
sed -e 's:<cargo-bin>:%{cargo_bin}:g' \
|
|
-e 's:<rust-triple>:%{rust_triple}:g' \
|
|
-e 's:<prefix>:%{buildroot}%{_prefix}:g' \
|
|
-e 's:<libdir>:%{buildroot}%{common_libdir}:g' \
|
|
-e 's:<mandir>:%{buildroot}%{_mandir}:g' \
|
|
-e 's:<docdir>:%{buildroot}%{_docdir}/%{name}:g' \
|
|
%{SOURCE1} > config.toml
|
|
./x.py install
|
|
./x.py install src
|
|
# Fix any rpaths if needed
|
|
chrpath -d %{buildroot}%{_prefix}/lib/lib*.so
|
|
|
|
# Remove executable permission from HTML documentation
|
|
# to prevent RPMLINT errors.
|
|
chmod -R -x+X %{buildroot}%{_docdir}/%{name}/html
|
|
|
|
# Remove surplus files
|
|
rm %{buildroot}%{rustlibdir}/components
|
|
rm %{buildroot}%{rustlibdir}/manifest-rust*
|
|
rm %{buildroot}%{rustlibdir}/install.log
|
|
rm %{buildroot}%{rustlibdir}/uninstall.sh
|
|
rm %{buildroot}%{rustlibdir}/rust-installer-version
|
|
# Remove lockfile to avoid errors.
|
|
rm %{buildroot}%{_docdir}/%{name}/html/.lock
|
|
|
|
# The remaining shared libraries should be executable for debuginfo extraction.
|
|
find %{buildroot}/%{_prefix}/lib/ -type f -name '*.so' -exec chmod -v +x '{}' '+'
|
|
|
|
# extract bundled licenses for packaging - From fedora spec
|
|
cp src/rt/hoedown/LICENSE src/rt/hoedown/LICENSE-hoedown
|
|
sed -e '/*\//q' src/libbacktrace/backtrace.h \
|
|
>src/libbacktrace/LICENSE-libbacktrace
|
|
|
|
# Remvove the license files from _docdir: make install put duplicates there
|
|
rm %{buildroot}%{_defaultdocdir}/%{name}/{COPYRIGHT,LICENSE-APACHE,LICENSE-MIT}
|
|
|
|
%if 0%{?suse_version}
|
|
%fdupes %{buildroot}%{_prefix}
|
|
%endif
|
|
|
|
%post -p /sbin/ldconfig
|
|
%postun -p /sbin/ldconfig
|
|
|
|
%files
|
|
%defattr(-,root,root,-)
|
|
%if 0%{?suse_version} == 1315 && !0{?is_opensuse}
|
|
%doc COPYRIGHT LICENSE-APACHE LICENSE-MIT
|
|
%doc src/libbacktrace/LICENSE-libbacktrace
|
|
%doc src/rt/hoedown/LICENSE-hoedown
|
|
%else
|
|
%license COPYRIGHT LICENSE-APACHE LICENSE-MIT
|
|
%license src/libbacktrace/LICENSE-libbacktrace
|
|
%license src/rt/hoedown/LICENSE-hoedown
|
|
%endif
|
|
%doc README.md
|
|
%{_bindir}/rustc
|
|
%{_bindir}/rustdoc
|
|
%{_bindir}/rust-lldb
|
|
%{_mandir}/man1/rustc.1*
|
|
%{_mandir}/man1/rustdoc.1*
|
|
%{_prefix}/lib/lib*.so
|
|
%exclude %{_docdir}/%{name}/html
|
|
%exclude %{rustlibdir}/src
|
|
|
|
%files -n rust-std
|
|
%defattr(-,root,root)
|
|
%dir %{rustlibdir}
|
|
%dir %{rustlibdir}/%{rust_triple}
|
|
%dir %{rustlibdir}/%{rust_triple}/lib
|
|
%{rustlibdir}/%{rust_triple}/lib/*.rlib
|
|
%{rustlibdir}/%{rust_triple}/lib/*.so
|
|
|
|
%files -n rust-gdb
|
|
%defattr(-,root,root,-)
|
|
%{_bindir}/rust-gdb
|
|
%dir %{rustlibdir}
|
|
%dir %{rustlibdir}/etc
|
|
%{rustlibdir}/etc/debugger_pretty_printers_common.py
|
|
%{rustlibdir}/etc/gdb_load_rust_pretty_printers.py
|
|
%{rustlibdir}/etc/gdb_rust_pretty_printing.py
|
|
%{rustlibdir}/etc/lldb_rust_formatters.py
|
|
|
|
%files -n rust-doc
|
|
%defattr(-,root,root)
|
|
%dir %{_docdir}/%{name}
|
|
%dir %{_docdir}/%{name}/html
|
|
%doc %{_docdir}/%{name}/html/*
|
|
|
|
%files -n rust-src
|
|
%defattr(-,root,root)
|
|
%dir %{rustlibdir}
|
|
%{rustlibdir}/src
|
|
|
|
%changelog
|