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 Name: %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel}
19 Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}}
20 Source0: https://git.zx2c4.com/WireGuard/snapshot/%{pname}-%{version}.tar.xz
21 # Source0-md5: c11254fe48695e61c145a7e82756ecba
22 Summary: WireGuard is an extremely simple yet fast and modern VPN that utilizes state-of-the-art cryptography
24 Group: Networking/Daemons
25 URL: https://www.wireguard.com/
26 %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:3.10}}
27 BuildRequires: libmnl-devel
28 BuildRequires: rpmbuild(macros) >= 1.701
29 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
32 WireGuard is an extremely simple yet fast and modern VPN that utilizes
33 state-of-the-art cryptography. It aims to be faster, simpler, leaner,
34 and more useful than IPSec, while avoiding the massive headache. It
35 intends to be considerably more performant than OpenVPN. WireGuard is
36 designed as a general purpose VPN for running on embedded interfaces
37 and super computers alike, fit for many different circumstances.
39 This package contains user space tools. You need to also install
40 kernel module from kernel-*-misc-wireguard package.
43 %package -n kernel%{_alt_kernel}-misc-wireguard\
44 Summary: WireGuard kernel module\
45 Release: %{rel}@%{_kernel_ver_str}\
47 Requires(post,postun): /sbin/depmod\
48 %requires_releq_kernel\
49 Requires(postun): %releq_kernel\
51 %description -n kernel%{_alt_kernel}-misc-wireguard\
52 WireGuard kernel module.\
54 %files -n kernel%{_alt_kernel}-misc-wireguard\
55 %defattr(644,root,root,755)\
56 /lib/modules/%{_kernel_ver}/misc/*.ko*\
59 %post -n kernel%{_alt_kernel}-misc-wireguard\
60 %depmod %{_kernel_ver}\
62 %postun -n kernel%{_alt_kernel}-misc-wireguard\
63 %depmod %{_kernel_ver}\
66 %define build_kernel_pkg()\
67 %build_kernel_modules -C src -m wireguard\
68 %install_kernel_modules -D installed -m src/wireguard -d misc\
71 %{?with_kernel:%{expand:%create_kernel_packages}}
74 %setup -q -n %{pname}-%{version}
77 %{?with_kernel:%{expand:%build_kernel_packages}}
84 rm -rf $RPM_BUILD_ROOT
87 install -d $RPM_BUILD_ROOT
88 cp -a installed/* $RPM_BUILD_ROOT
92 %{make} -C src/tools install \
93 PREFIX=$RPM_BUILD_ROOT%{_prefix} \
94 SYSCONFDIR=$RPM_BUILD_ROOT%{_sysconfdir} \
95 SYSTEMDUNITDIR=$RPM_BUILD_ROOT%{systemdunitdir} \
100 rm -rf $RPM_BUILD_ROOT
105 %if %{with userspace}
107 %defattr(644,root,root,755)
108 %doc contrib/examples README.md
109 %attr(755,root,root) %{_bindir}/wg
110 %attr(755,root,root) %{_bindir}/wg-quick
111 %dir %{_sysconfdir}/wireguard
112 %{systemdunitdir}/wg-quick@.service
113 %{_mandir}/man8/wg-quick.8*
114 %{_mandir}/man8/wg.8*