770efe4948dc837e09233e616978b7bfeeba3bf4
[openwrt/openwrt.git] / package / network / services / wireguard / Makefile
1 #
2 # Copyright (C) 2016-2017 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.20180514
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:=e895b65e06e85429403be3d1987577a6967476b069f0ff53caead6f682f466da
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:=Baptiste Jonglez <openwrt@bitsofnetworks.org>, \
39 Dan Luedtke <mail@danrl.com>, \
40 Jason A. Donenfeld <Jason@zx2c4.com>
41 endef
42
43 define Package/wireguard/Default/description
44 WireGuard is a novel VPN that runs inside the Linux Kernel and utilizes
45 state-of-the-art cryptography. It aims to be faster, simpler, leaner, and
46 more useful than IPSec, while avoiding the massive headache. It intends to
47 be considerably more performant than OpenVPN. WireGuard is designed as a
48 general purpose VPN for running on embedded interfaces and super computers
49 alike, fit for many different circumstances. It uses UDP.
50 endef
51
52 define Package/wireguard
53 $(call Package/wireguard/Default)
54 TITLE:=WireGuard meta-package
55 DEPENDS:=+wireguard-tools +kmod-wireguard
56 endef
57
58 include $(INCLUDE_DIR)/kernel-defaults.mk
59 include $(INCLUDE_DIR)/package-defaults.mk
60
61 # Used by Build/Compile/Default
62 MAKE_PATH:=src/tools
63 MAKE_VARS += PLATFORM=linux
64
65 define Build/Compile
66 $(MAKE) $(KERNEL_MAKEOPTS) M="$(PKG_BUILD_DIR)/src" modules
67 $(call Build/Compile/Default)
68 endef
69
70 define Package/wireguard/install
71 true
72 endef
73
74 define Package/wireguard/description
75 $(call Package/wireguard/Default/description)
76 endef
77
78 define Package/wireguard-tools
79 $(call Package/wireguard/Default)
80 TITLE:=WireGuard userspace control program (wg)
81 DEPENDS:=+libmnl +ip
82 endef
83
84 define Package/wireguard-tools/description
85 $(call Package/wireguard/Default/description)
86
87 This package provides the userspace control program for WireGuard,
88 `wg(8)`, and a netifd protocol helper.
89 endef
90
91 define Package/wireguard-tools/install
92 $(INSTALL_DIR) $(1)/usr/bin/
93 $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/tools/wg $(1)/usr/bin/
94 $(INSTALL_DIR) $(1)/lib/netifd/proto/
95 $(INSTALL_BIN) ./files/wireguard.sh $(1)/lib/netifd/proto/
96 endef
97
98 define KernelPackage/wireguard
99 SECTION:=kernel
100 CATEGORY:=Kernel modules
101 SUBMENU:=Network Support
102 TITLE:=WireGuard kernel module
103 DEPENDS:=+IPV6:kmod-udptunnel6 +kmod-udptunnel4
104 FILES:= $(PKG_BUILD_DIR)/src/wireguard.$(LINUX_KMOD_SUFFIX)
105 AUTOLOAD:=$(call AutoProbe,wireguard)
106 endef
107
108 define KernelPackage/wireguard/description
109 $(call Package/wireguard/Default/description)
110
111 This package provides the kernel module for WireGuard.
112 endef
113
114 $(eval $(call BuildPackage,wireguard))
115 $(eval $(call BuildPackage,wireguard-tools))
116 $(eval $(call KernelPackage,wireguard))