1
0
zram-generator/zram-generator.spec

84 lines
2.9 KiB
RPMSpec

#
# spec file
#
# Copyright (c) 2021 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
%global _systemd_util_dir /usr/lib/systemd
Name: zram-generator
Version: 1.0.1~git25.5e0ec60
Release: 0
Summary: Systemd unit generator for zram swap devices
License: MIT
Group: Development/Libraries/Rust
# Upstream license specification: MIT
URL: https://github.com/systemd/zram-generator
Source0: %{name}-%{version}.tar.xz
Source1: vendor.tar.xz
Source2: cargo_config
Source3: zram-generator-rpmlintrc
BuildRequires: cargo-packaging
BuildRequires: groff
BuildRequires: rubygem(ronn)
BuildRequires: pkgconfig(systemd)
%description
This is a systemd unit generator that enables swap on zram.
(With zram, there is no physical swap device. Part of the avaialable RAM
is used to store compressed pages, essentially trading CPU cycles for memory.)
To configure and activate swap and zram devices with file-systems, create a configuration file in /etc/systemd/zram.generator.conf. You can consult %{_datadir}/doc/%{name}/zram-generator.conf.example for an example and a list of available settings.
%prep
%autosetup -a1 -p1 -n %{name}-%{version}
mkdir .cargo
cp %{SOURCE2} .cargo/config
%build
export SYSTEMD_UTIL_DIR=%{_systemd_util_dir}
export LC_ALL=C.UTF-8
%{cargo_build}
%make_build SYSTEMD_SYSTEM_UNIT_DIR=%{_unitdir} SYSTEMD_SYSTEM_GENERATOR_DIR=%{_systemdgeneratordir} \
systemd-service man
%install
install -Dpm755 target/release/zram-generator -t %{buildroot}%{_systemdgeneratordir}
install -Dpm644 units/systemd-zram-setup@.service -t %{buildroot}%{_unitdir}
install -Dpm644 zram-generator.conf.example -t %{buildroot}%{_prefix}/share/doc/zram-generator/
install -Dpm644 man/zram-generator.8 -t %{buildroot}%{_prefix}/share/man/man8/
install -Dpm644 man/zram-generator.5 -t %{buildroot}%{_prefix}/share/man/man5/zram-generator.conf.5
%fdupes -s %{buildroot}%{_mandir}
%fdupes %{buildroot}%{_prefix}
%check
export SYSTEMD_UTIL_DIR=%{_systemd_util_dir}
%{cargo_test}
%files
%doc README.md
%dir %{_datadir}/doc/%{name}
%{_datadir}/doc/%{name}/zram-generator.conf.example
%dir %{_systemdgeneratordir}
%{_systemdgeneratordir}/zram-generator
%{_unitdir}/systemd-zram-setup@.service
%{_mandir}/man8/zram-generator.8*
%{_mandir}/man5/zram-generator.conf.5*
%changelog