284936173346cda3dcd3912d674e766ad6569a70
[openwrt/openwrt.git] / package / network / services / wireguard / Makefile
1 #
2 # Copyright (C) 2016-2018 Jason A. Donenfeld <Jason@zx2c4.com>
3 # Copyright (C) 2016 Baptiste Jonglez <openwrt@bitsofnetworks.org>
4 # Copyright (C) 2016-2017 Dan Luedtke <mail@danrl.com>
5 #
6 # This is free software, licensed under the GNU General Public License v2.
7 # See /LICENSE for more information.
8
9 include $(TOPDIR)/rules.mk
10 include $(INCLUDE_DIR)/kernel.mk
11
12 PKG_NAME:=wireguard
13
14 PKG_VERSION:=0.0.20191219
15 PKG_RELEASE:=1
16
17 PKG_SOURCE:=WireGuard-$(PKG_VERSION).tar.xz
18 PKG_SOURCE_URL:=https://git.zx2c4.com/WireGuard/snapshot/
19 PKG_HASH:=5aba6f0c38e97faa0b155623ba594bb0e4bd5e29deacd8d5ed8bda8d8283b0e7
20
21 PKG_LICENSE:=GPL-2.0 Apache-2.0
22 PKG_LICENSE_FILES:=COPYING
23
24 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/WireGuard-$(PKG_VERSION)
25 PKG_BUILD_PARALLEL:=1
26 PKG_USE_MIPS16:=0
27
28 # WireGuard's makefile needs this to know where to build the kernel module
29 export KERNELDIR:=$(LINUX_DIR)
30
31 include $(INCLUDE_DIR)/package.mk
32
33 define Package/wireguard/Default
34 SECTION:=net
35 CATEGORY:=Network
36 SUBMENU:=VPN
37 URL:=https://www.wireguard.com
38 MAINTAINER:=Jason A. Donenfeld <Jason@zx2c4.com>
39 endef
40
41 define Package/wireguard/Default/description
42 WireGuard is a novel VPN that runs inside the Linux Kernel and utilizes
43 state-of-the-art cryptography. It aims to be faster, simpler, leaner, and
44 more useful than IPSec, while avoiding the massive headache. It intends to
45 be considerably more performant than OpenVPN. WireGuard is designed as a
46 general purpose VPN for running on embedded interfaces and super computers
47 alike, fit for many different circumstances. It uses UDP.
48 endef
49
50 define Package/wireguard
51 $(call Package/wireguard/Default)
52 TITLE:=WireGuard meta-package
53 DEPENDS:=+wireguard-tools +kmod-wireguard
54 endef
55
56 include $(INCLUDE_DIR)/kernel-defaults.mk
57 include $(INCLUDE_DIR)/package-defaults.mk
58
59 # Used by Build/Compile/Default
60 MAKE_PATH:=src/tools
61 MAKE_VARS += PLATFORM=linux
62
63 define Build/Compile
64 $(MAKE) $(KERNEL_MAKEOPTS) M="$(PKG_BUILD_DIR)/src" modules
65 $(call Build/Compile/Default)
66 endef
67
68 define Package/wireguard/install
69 true
70 endef
71
72 define Package/wireguard/description
73 $(call Package/wireguard/Default/description)
74 endef
75
76 define Package/wireguard-tools
77 $(call Package/wireguard/Default)
78 TITLE:=WireGuard userspace control program (wg)
79 DEPENDS:=+libmnl +ip
80 endef
81
82 define Package/wireguard-tools/description
83 $(call Package/wireguard/Default/description)
84
85 This package provides the userspace control program for WireGuard,
86 `wg(8)`, a netifd protocol helper, and a re-resolve watchdog script.
87 endef
88
89 define Package/wireguard-tools/install
90 $(INSTALL_DIR) $(1)/usr/bin/
91 $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/tools/wg $(1)/usr/bin/
92 $(INSTALL_BIN) ./files/wireguard_watchdog $(1)/usr/bin/
93 $(INSTALL_DIR) $(1)/lib/netifd/proto/
94 $(INSTALL_BIN) ./files/wireguard.sh $(1)/lib/netifd/proto/
95 endef
96
97 define KernelPackage/wireguard
98 SECTION:=kernel
99 CATEGORY:=Kernel modules
100 SUBMENU:=Network Support
101 TITLE:=WireGuard kernel module
102 DEPENDS:=+IPV6:kmod-udptunnel6 +kmod-udptunnel4
103 FILES:= $(PKG_BUILD_DIR)/src/wireguard.$(LINUX_KMOD_SUFFIX)
104 AUTOLOAD:=$(call AutoProbe,wireguard)
105 endef
106
107 define KernelPackage/wireguard/description
108 $(call Package/wireguard/Default/description)
109
110 This package provides the kernel module for WireGuard.
111 endef
112
113 $(eval $(call BuildPackage,wireguard))
114 $(eval $(call BuildPackage,wireguard-tools))
115 $(eval $(call KernelPackage,wireguard))