Accepting request 851176 from devel:tools:building

OBS-URL: https://build.opensuse.org/request/show/851176
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/sccache?expand=0&rev=2
This commit is contained in:
2020-11-29 11:28:59 +00:00
committed by Git OBS Bridge
parent d7586ba5cf
commit d3b371f9ae
2 changed files with 22 additions and 3 deletions

View File

@@ -12,9 +12,10 @@
# 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/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global rustflags -Clink-arg=-Wl,-z,relro,-z,now -C debuginfo=2
%define configdir %{_sysconfdir}/%{name}
@@ -24,7 +25,7 @@ Release: 0
Summary: A compiler caching tool for Rust, C and C++ with optional cloud storage
License: Apache-2.0
Group: Development/Languages/Rust
Url: https://github.com/mozilla/%{name}
URL: https://github.com/mozilla/%{name}
Source0: %{name}-%{version}.tar.xz
Source1: vendor.tar.xz
Source2: cargo_config
@@ -54,7 +55,12 @@ find vendor -type f -name \*.rs -exec chmod -x '{}' \;
%build
export RUSTFLAGS="%{rustflags}"
cargo build --offline --release --features=all,dist-server,dist-client
# 'dist-server' available only on x86_64 so far - https://github.com/mozilla/sccache/issues/656
features="all,dist-client"
%ifarch x86_64
features="$features,dist-server"
%endif
cargo build --offline --release --features=$features
%install
install -D -d -m 0755 %{buildroot}%{_bindir}
@@ -62,14 +68,19 @@ install -D -d -m 0755 %{buildroot}%{_unitdir}
install -D -d -m 0755 %{buildroot}%{configdir}
install -m 0755 %{_builddir}/%{name}-%{version}/target/release/sccache %{buildroot}%{_bindir}/sccache
%ifarch x86_64
install -m 0755 %{_builddir}/%{name}-%{version}/target/release/sccache-dist %{buildroot}%{_bindir}/sccache-dist
%endif
%ifarch x86_64
install -m 0644 %{SOURCE10} %{buildroot}%{_unitdir}/sccache-dist-builder.service
install -m 0644 %{SOURCE11} %{buildroot}%{_unitdir}/sccache-dist-scheduler.service
%endif
install -m 0644 %{SOURCE12} %{buildroot}%{configdir}/builder.conf
install -m 0644 %{SOURCE13} %{buildroot}%{configdir}/scheduler.conf
install -m 0644 %{SOURCE14} %{buildroot}%{configdir}/client.example
%ifarch x86_64
%pre
%service_add_pre sccache-dist-builder.service
%service_add_pre sccache-dist-scheduler.service
@@ -85,15 +96,18 @@ install -m 0644 %{SOURCE14} %{buildroot}%{configdir}/client.example
%postun
%service_del_postun sccache-dist-builder.service
%service_del_postun sccache-dist-scheduler.service
%endif
%files
%license LICENSE
%doc README.md
%{_bindir}/sccache
%ifarch x86_64
%{_bindir}/sccache-dist
%{_unitdir}/sccache-dist-builder.service
%{_unitdir}/sccache-dist-scheduler.service
%endif
%dir %{configdir}
%config(noreplace) %{configdir}/scheduler.conf