Blame SPECS/kmod-wireguard.spec

812836
%global pkg wireguard
812836
f037f6
%global kernel_version_min 4.18.0-315.el8
f037f6
f037f6
# To pick a specific kernel use `--define "kernel_version 4.18.0-315.el8"`
f037f6
# Otherwise the later version of %%{kernel_version_min} and the 'latest'
f037f6
# installed version of kernel-devel will be used.
f037f6
f037f6
%global kernel_version_latest %({ echo %{kernel_version_min}; rpm --query kernel-devel --queryformat '%%{VERSION}-%%{RELEASE}\\\n' | grep -v kernel-devel; } | sort -V | sed -e '0,/^%{kernel_version_min}$/d' | tail -n 1)
f037f6
f037f6
%if "%{kernel_version_latest}" != ""
f037f6
%{!?kernel_version:%{expand:%%global kernel_version %{kernel_version_latest}}}
f037f6
%endif
812836
fafb58
%global _use_internal_dependency_generator 0
812836
fafb58
%global debug_package %{nil}
fafb58
812836
%global __spec_install_post \
fafb58
  %{?__debug_package:%{__debug_install_post}} \
fafb58
  %{__arch_install_post} \
fafb58
  %{__os_install_post} \
fafb58
  %{__mod_compress_install_post}
fafb58
812836
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
fafb58
fafb58
fafb58
Name:             kmod-%{pkg}
52cf4e
Version:          1.0.20210606
fafb58
Release:          1%{?dist}
fafb58
Summary:          Fast, modern, secure VPN tunnel
fafb58
fafb58
License:          GPLv2
fafb58
URL:              https://www.wireguard.com/
fafb58
fafb58
Source0:          https://git.zx2c4.com/%{pkg}-linux-compat/snapshot/%{pkg}-linux-compat-%{version}.tar.xz
fafb58
52cf4e
Patch1:           0001-compat-account-for-latest-c8s-backports.patch
52cf4e
fafb58
ExclusiveArch:    x86_64 aarch64
fafb58
fafb58
BuildRequires:    elfutils-libelf-devel
812836
BuildRequires:    gcc
60abe3
BuildRequires:    kernel-abi-whitelists
fafb58
BuildRequires:    kernel-rpm-macros
fafb58
BuildRequires:    kmod
812836
BuildRequires:    make
fafb58
BuildRequires:    redhat-rpm-config
fafb58
BuildRequires:    xz
fafb58
f037f6
%{!?kernel_version:
f037f6
BuildRequires:    kernel-devel >= %{kernel_version_min}
f037f6
}
f037f6
f037f6
%{?kernel_version:
f037f6
BuildRequires:    kernel-devel = %{kernel_version}
f037f6
fafb58
Supplements:      kernel = %{kernel_version}
fafb58
fafb58
Requires:         (kernel = %{kernel_version} if kernel)
f037f6
f037f6
Provides:         kernel-modules = %{kernel_version}.%{_arch}
f037f6
}
f037f6
fafb58
Requires(post):   /usr/sbin/depmod
fafb58
Requires(postun): /usr/sbin/depmod
fafb58
fafb58
Provides:         %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
fafb58
fafb58
Supplements:      wireguard-tools
812836
Recommends:       wireguard-tools
fafb58
fafb58
fafb58
%description
fafb58
WireGuard is an extremely simple yet fast and modern VPN that utilizes
fafb58
state-of-the-art cryptography. It aims to be faster, simpler, leaner, and more
fafb58
useful than IPsec, while avoiding the massive headache. It intends to be
fafb58
considerably more performant than OpenVPN. WireGuard is designed as a general
fafb58
purpose VPN for running on embedded interfaces and super computers alike, fit
fafb58
for many different circumstances.
fafb58
fafb58
fafb58
%prep
fafb58
%autosetup -p1 -n %{pkg}-linux-compat-%{version}
fafb58
fafb58
fafb58
%build
fafb58
pushd src
fafb58
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
fafb58
popd
fafb58
fafb58
fafb58
%install
fafb58
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/net/%{pkg} src/%{pkg}.ko
fafb58
812836
# Make .ko objects temporarily executable for automatic stripping
fafb58
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
fafb58
fafb58
fafb58
%clean
fafb58
%{__rm} -rf %{buildroot}
fafb58
fafb58
fafb58
%post
fafb58
/usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
fafb58
fafb58
fafb58
%postun
fafb58
/usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
fafb58
fafb58
fafb58
%files
fafb58
%defattr(644,root,root,755)
fafb58
/lib/modules/%{kernel_version}.%{_arch}
fafb58
%license COPYING
fafb58
%doc README.md
fafb58
fafb58
fafb58
%changelog
f83540
* Wed Jul 21 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 1.0.20210606-1
60a62c
- Initial version