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