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"`
aa2b03
# Otherwise the latest installed kernel-devel version later than
aa2b03
# %%{kernel_version_min} will be used.
f037f6
b58d31
%global kernel_version_latest %({ echo %{kernel_version_min}; rpm --query kernel-devel --queryformat '%%{VERSION}-%%{RELEASE}\\\n' | grep -v "package kernel-devel is not installed"; } | 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
05d26b
%global __find_requires %{nil}
e0be9c
%global __find_provides /usr/lib/rpm/find-provides
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
c72d15
Release:          2%{?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
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}
4fd350
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
f037f6
ee700d
Requires:         kernel-core = %{kernel_version}
4fd350
Requires:         kernel-core-uname-r = %{kernel_version}.%{_arch}
6bfada
Requires:         kernel-modules = %{kernel_version}
4fd350
Requires:         kernel-modules-uname-r = %{kernel_version}.%{_arch}
f037f6
6f7084
Provides:         installonlypkg(kernel-module)
627a9e
Provides:         %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
f037f6
}
f037f6
fafb58
Requires(post):   /usr/sbin/depmod
fafb58
Requires(postun): /usr/sbin/depmod
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
050315
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
050315
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
050315
050315
050315
%preun
050315
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
050315
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
fafb58
fafb58
fafb58
%postun
050315
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
050315
then
050315
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
050315
    then
050315
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
050315
    fi
050315
050315
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
050315
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
050315
fi
050315
050315
050315
%posttrans
050315
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
050315
then
050315
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
050315
    then
050315
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
050315
    fi
050315
050315
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
050315
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
050315
fi
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
c72d15
* Thu Jul 29 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 1.0.20210606-2
c72d15
- Rebuild for 4.18.0-326.el8
c72d15
f83540
* Wed Jul 21 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 1.0.20210606-1
60a62c
- Initial version