2 %bcond_without kernel # don't build kernel modules
3 %bcond_without userspace # don't build userspace tools
5 %if 0%{?_pld_builder:1} && %{with kernel} && %{with userspace}
6 %{error:kernel and userspace cannot be built at the same time on PLD builders}
10 %if %{without userspace}
11 # nothing to be placed to debuginfo package
12 %define _enable_debug_packages 0
16 %define pname WireGuard
17 Summary: WireGuard is an extremely simple yet fast and modern VPN that utilizes state-of-the-art cryptography
18 Name: %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel}
20 Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}}
22 Group: Networking/Daemons
23 Source0: https://git.zx2c4.com/WireGuard/snapshot/%{pname}-%{version}.tar.xz
24 # Source0-md5: 5175ca88850993dc88a4c9d924ee79d4
25 Patch0: kernel-5.4.29.patch
26 URL: https://www.wireguard.com/
27 %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:3.10}}
28 BuildRequires: libmnl-devel
29 BuildRequires: rpmbuild(macros) >= 1.701
30 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
33 WireGuard is an extremely simple yet fast and modern VPN that utilizes
34 state-of-the-art cryptography. It aims to be faster, simpler, leaner,
35 and more useful than IPSec, while avoiding the massive headache. It
36 intends to be considerably more performant than OpenVPN. WireGuard is
37 designed as a general purpose VPN for running on embedded interfaces
38 and super computers alike, fit for many different circumstances.
40 This package contains user space tools. You need to also install
41 kernel module from kernel-*-misc-wireguard package.
44 %package -n kernel%{_alt_kernel}-misc-wireguard\
45 Summary: WireGuard kernel module\
46 Release: %{rel}@%{_kernel_ver_str}\
48 Requires(post,postun): /sbin/depmod\
49 %requires_releq_kernel\
50 Requires(postun): %releq_kernel\
52 %description -n kernel%{_alt_kernel}-misc-wireguard\
53 WireGuard kernel module.\
55 %files -n kernel%{_alt_kernel}-misc-wireguard\
56 %defattr(644,root,root,755)\
57 /lib/modules/%{_kernel_ver}/misc/*.ko*\
60 %post -n kernel%{_alt_kernel}-misc-wireguard\
61 %depmod %{_kernel_ver}\
63 %postun -n kernel%{_alt_kernel}-misc-wireguard\
64 %depmod %{_kernel_ver}\
67 %define build_kernel_pkg()\
68 %build_kernel_modules -C src -m wireguard\
69 %install_kernel_modules -D installed -m src/wireguard -d misc\
72 %{?with_kernel:%{expand:%create_kernel_packages}}
75 %setup -q -n %{pname}-%{version}
79 %{?with_kernel:%{expand:%build_kernel_packages}}
86 rm -rf $RPM_BUILD_ROOT
89 install -d $RPM_BUILD_ROOT
90 cp -a installed/* $RPM_BUILD_ROOT
94 %{make} -C src/tools install \
95 PREFIX=$RPM_BUILD_ROOT%{_prefix} \
96 SYSCONFDIR=$RPM_BUILD_ROOT%{_sysconfdir} \
97 SYSTEMDUNITDIR=$RPM_BUILD_ROOT%{systemdunitdir} \
102 rm -rf $RPM_BUILD_ROOT
107 %if %{with userspace}
109 %defattr(644,root,root,755)
110 %doc contrib/examples README.md
111 %attr(755,root,root) %{_bindir}/wg
112 %attr(755,root,root) %{_bindir}/wg-quick
113 %dir %{_sysconfdir}/wireguard
114 %{systemdunitdir}/wg-quick@.service
115 %{_mandir}/man8/wg-quick.8*
116 %{_mandir}/man8/wg.8*