]>
Commit | Line | Data |
---|---|---|
5a08c828 JR |
1 | # Conditional build: |
2 | %bcond_without kernel # don't build kernel modules | |
3 | %bcond_without userspace # don't build userspace tools | |
4 | ||
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} | |
7 | exit 1 | |
8 | %endif | |
9 | ||
10 | %if %{without userspace} | |
11 | # nothing to be placed to debuginfo package | |
12 | %define _enable_debug_packages 0 | |
13 | %endif | |
14 | ||
fdb609f4 | 15 | %define rel 2 |
5a08c828 | 16 | %define pname WireGuard |
fdb609f4 | 17 | Summary: WireGuard is an extremely simple yet fast and modern VPN that utilizes state-of-the-art cryptography |
5a08c828 | 18 | Name: %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel} |
2b10bf96 | 19 | Version: 0.0.20191219 |
67e9697d | 20 | Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}} |
5a08c828 JR |
21 | License: GPL v2 |
22 | Group: Networking/Daemons | |
fdb609f4 JR |
23 | Source0: https://git.zx2c4.com/WireGuard/snapshot/%{pname}-%{version}.tar.xz |
24 | # Source0-md5: 5175ca88850993dc88a4c9d924ee79d4 | |
25 | Patch0: kernel-5.4.29.patch | |
5a08c828 JR |
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) | |
31 | ||
32 | %description | |
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. | |
39 | ||
40 | This package contains user space tools. You need to also install | |
41 | kernel module from kernel-*-misc-wireguard package. | |
42 | ||
43 | %define kernel_pkg()\ | |
44 | %package -n kernel%{_alt_kernel}-misc-wireguard\ | |
45 | Summary: WireGuard kernel module\ | |
46 | Release: %{rel}@%{_kernel_ver_str}\ | |
47 | Group: Base/Kernel\ | |
48 | Requires(post,postun): /sbin/depmod\ | |
49 | %requires_releq_kernel\ | |
50 | Requires(postun): %releq_kernel\ | |
51 | \ | |
52 | %description -n kernel%{_alt_kernel}-misc-wireguard\ | |
53 | WireGuard kernel module.\ | |
54 | %if %{with kernel}\ | |
55 | %files -n kernel%{_alt_kernel}-misc-wireguard\ | |
56 | %defattr(644,root,root,755)\ | |
57 | /lib/modules/%{_kernel_ver}/misc/*.ko*\ | |
58 | %endif\ | |
59 | \ | |
60 | %post -n kernel%{_alt_kernel}-misc-wireguard\ | |
61 | %depmod %{_kernel_ver}\ | |
62 | \ | |
63 | %postun -n kernel%{_alt_kernel}-misc-wireguard\ | |
64 | %depmod %{_kernel_ver}\ | |
65 | %{nil} | |
66 | ||
67 | %define build_kernel_pkg()\ | |
68 | %build_kernel_modules -C src -m wireguard\ | |
69 | %install_kernel_modules -D installed -m src/wireguard -d misc\ | |
70 | %{nil} | |
71 | ||
72 | %{?with_kernel:%{expand:%create_kernel_packages}} | |
73 | ||
74 | %prep | |
d7de597f | 75 | %setup -q -n %{pname}-%{version} |
fdb609f4 | 76 | %patch0 -p1 |
5a08c828 JR |
77 | |
78 | %build | |
79 | %{?with_kernel:%{expand:%build_kernel_packages}} | |
80 | ||
81 | %if %{with userspace} | |
82 | %{make} -C src/tools | |
83 | %endif | |
84 | ||
85 | %install | |
86 | rm -rf $RPM_BUILD_ROOT | |
87 | ||
88 | %if %{with kernel} | |
89 | install -d $RPM_BUILD_ROOT | |
90 | cp -a installed/* $RPM_BUILD_ROOT | |
91 | %endif | |
92 | ||
93 | %if %{with userspace} | |
94 | %{make} -C src/tools install \ | |
95 | PREFIX=$RPM_BUILD_ROOT%{_prefix} \ | |
96 | SYSCONFDIR=$RPM_BUILD_ROOT%{_sysconfdir} \ | |
97 | SYSTEMDUNITDIR=$RPM_BUILD_ROOT%{systemdunitdir} \ | |
98 | WITH_SYSTEMDUNITS=yes | |
99 | %endif | |
100 | ||
101 | %clean | |
102 | rm -rf $RPM_BUILD_ROOT | |
103 | ||
104 | %postun | |
105 | %systemd_reload | |
106 | ||
107 | %if %{with userspace} | |
108 | %files | |
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* | |
117 | %endif |