You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
3.2 KiB

  1. #
  2. # Copyright (C) 2016 Jason A. Donenfeld <Jason@zx2c4.com>
  3. # Copyright (C) 2016 Baptiste Jonglez <openwrt@bitsofnetworks.org>
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. # See /LICENSE for more information.
  7. include $(TOPDIR)/rules.mk
  8. include $(INCLUDE_DIR)/kernel.mk
  9. PKG_NAME:=wireguard
  10. PKG_VERSION:=0.0.20161230
  11. PKG_RELEASE:=1
  12. PKG_SOURCE:=WireGuard-$(PKG_VERSION).tar.xz
  13. # This is actually SHA256, but OpenWRT/LEDE will figure it out based on the length
  14. PKG_MD5SUM:=69c9770daf9c8ff6632d614afc117b60774760f1224c9322c84f8da92b9ae396
  15. PKG_SOURCE_URL:=https://git.zx2c4.com/WireGuard/snapshot/
  16. PKG_BUILD_DIR:=$(BUILD_DIR)/WireGuard-$(PKG_VERSION)
  17. PKG_LICENSE:=GPL-2.0
  18. PKG_LICENSE_FILES:=COPYING
  19. PKG_USE_MIPS16:=0
  20. PKG_BUILD_PARALLEL:=1
  21. # Wireguard's makefile needs this to know where to build the kernel module
  22. export KERNELDIR:=$(LINUX_DIR)
  23. include $(INCLUDE_DIR)/package.mk
  24. define Package/wireguard/Default
  25. SECTION:=net
  26. CATEGORY:=Network
  27. URL:=https://www.wireguard.io
  28. MAINTAINER:=Baptiste Jonglez <openwrt@bitsofnetworks.org>, \
  29. Dan Luedtke <mail@danrl.com>
  30. endef
  31. define Package/wireguard/Default/description
  32. WireGuard is a novel VPN that runs inside the Linux Kernel and utilizes
  33. state-of-the-art cryptography. It aims to be faster, simpler, leaner, and
  34. more useful than IPSec, while avoiding the massive headache. It intends to
  35. be considerably more performant than OpenVPN. WireGuard is designed as a
  36. general purpose VPN for running on embedded interfaces and super computers
  37. alike, fit for many different circumstances.
  38. It runs over UDP.
  39. endef
  40. define Package/wireguard
  41. $(call Package/wireguard/Default)
  42. TITLE:=Wireguard meta-package
  43. DEPENDS:=+wireguard-tools +kmod-wireguard
  44. endef
  45. include $(INCLUDE_DIR)/kernel-defaults.mk
  46. include $(INCLUDE_DIR)/package-defaults.mk
  47. # Used by Build/Compile/Default
  48. MAKE_PATH:=src/tools
  49. define Build/Compile
  50. $(MAKE) $(KERNEL_MAKEOPTS) M="$(PKG_BUILD_DIR)/src" modules
  51. $(call Build/Compile/Default)
  52. endef
  53. define Package/wireguard/description
  54. $(call Package/wireguard/Default/description)
  55. endef
  56. define Package/wireguard-tools
  57. $(call Package/wireguard/Default)
  58. TITLE:=Wireguard userspace control program (wg)
  59. DEPENDS:=+libmnl
  60. endef
  61. define Package/wireguard-tools/description
  62. $(call Package/wireguard/Default/description)
  63. This package provides the userspace control program for wireguard, `wg`,
  64. and a netifd protocol helper.
  65. endef
  66. define Package/wireguard-tools/install
  67. $(INSTALL_DIR) $(1)/usr/bin/
  68. $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/tools/wg $(1)/usr/bin/
  69. $(INSTALL_DIR) $(1)/lib/netifd/proto/
  70. $(INSTALL_BIN) ./files/wireguard.sh $(1)/lib/netifd/proto/
  71. endef
  72. define KernelPackage/wireguard
  73. SECTION:=kernel
  74. CATEGORY:=Kernel modules
  75. SUBMENU:=Network Support
  76. TITLE:=Wireguard kernel module
  77. DEPENDS:=+IPV6:kmod-udptunnel6 +kmod-udptunnel4 +kmod-ipt-hashlimit
  78. FILES:= $(PKG_BUILD_DIR)/src/wireguard.$(LINUX_KMOD_SUFFIX)
  79. AUTOLOAD:=$(call AutoLoad,33,wireguard)
  80. endef
  81. define KernelPackage/wireguard/description
  82. $(call Package/wireguard/Default/description)
  83. This package provides the kernel module for wireguard.
  84. endef
  85. $(eval $(call BuildPackage,wireguard))
  86. $(eval $(call BuildPackage,wireguard-tools))
  87. $(eval $(call KernelPackage,wireguard))