Makefile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. include $(TOPDIR)/rules.mk
  9. include $(INCLUDE_DIR)/kernel.mk
  10. PKG_NAME:=wireguard
  11. PKG_VERSION:=0.0.20180519
  12. PKG_RELEASE:=1
  13. PKG_SOURCE:=WireGuard-$(PKG_VERSION).tar.xz
  14. PKG_SOURCE_URL:=https://git.zx2c4.com/WireGuard/snapshot/
  15. PKG_HASH:=8846b3006c3f7e079bb38a4c985ccc2981e259f56c927b4cf47cbc1420e1c462
  16. PKG_LICENSE:=GPL-2.0 Apache-2.0
  17. PKG_LICENSE_FILES:=COPYING
  18. PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/WireGuard-$(PKG_VERSION)
  19. PKG_BUILD_PARALLEL:=1
  20. PKG_USE_MIPS16:=0
  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. SUBMENU:=VPN
  28. URL:=https://www.wireguard.com
  29. MAINTAINER:=Baptiste Jonglez <openwrt@bitsofnetworks.org>, \
  30. Dan Luedtke <mail@danrl.com>, \
  31. Jason A. Donenfeld <Jason@zx2c4.com>
  32. endef
  33. define Package/wireguard/Default/description
  34. WireGuard is a novel VPN that runs inside the Linux Kernel and utilizes
  35. state-of-the-art cryptography. It aims to be faster, simpler, leaner, and
  36. more useful than IPSec, while avoiding the massive headache. It intends to
  37. be considerably more performant than OpenVPN. WireGuard is designed as a
  38. general purpose VPN for running on embedded interfaces and super computers
  39. alike, fit for many different circumstances. It uses UDP.
  40. endef
  41. define Package/wireguard
  42. $(call Package/wireguard/Default)
  43. TITLE:=WireGuard meta-package
  44. DEPENDS:=+wireguard-tools +kmod-wireguard
  45. endef
  46. include $(INCLUDE_DIR)/kernel-defaults.mk
  47. include $(INCLUDE_DIR)/package-defaults.mk
  48. # Used by Build/Compile/Default
  49. MAKE_PATH:=src/tools
  50. MAKE_VARS += PLATFORM=linux
  51. define Build/Compile
  52. $(MAKE) $(KERNEL_MAKEOPTS) M="$(PKG_BUILD_DIR)/src" modules
  53. $(call Build/Compile/Default)
  54. endef
  55. define Package/wireguard/install
  56. true
  57. endef
  58. define Package/wireguard/description
  59. $(call Package/wireguard/Default/description)
  60. endef
  61. define Package/wireguard-tools
  62. $(call Package/wireguard/Default)
  63. TITLE:=WireGuard userspace control program (wg)
  64. DEPENDS:=+libmnl +ip
  65. endef
  66. define Package/wireguard-tools/description
  67. $(call Package/wireguard/Default/description)
  68. This package provides the userspace control program for WireGuard,
  69. `wg(8)`, and a netifd protocol helper.
  70. endef
  71. define Package/wireguard-tools/install
  72. $(INSTALL_DIR) $(1)/usr/bin/
  73. $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/tools/wg $(1)/usr/bin/
  74. $(INSTALL_DIR) $(1)/lib/netifd/proto/
  75. $(INSTALL_BIN) ./files/wireguard.sh $(1)/lib/netifd/proto/
  76. endef
  77. define KernelPackage/wireguard
  78. SECTION:=kernel
  79. CATEGORY:=Kernel modules
  80. SUBMENU:=Network Support
  81. TITLE:=WireGuard kernel module
  82. DEPENDS:=+IPV6:kmod-udptunnel6 +kmod-udptunnel4
  83. FILES:= $(PKG_BUILD_DIR)/src/wireguard.$(LINUX_KMOD_SUFFIX)
  84. AUTOLOAD:=$(call AutoProbe,wireguard)
  85. endef
  86. define KernelPackage/wireguard/description
  87. $(call Package/wireguard/Default/description)
  88. This package provides the kernel module for WireGuard.
  89. endef
  90. $(eval $(call BuildPackage,wireguard))
  91. $(eval $(call BuildPackage,wireguard-tools))
  92. $(eval $(call KernelPackage,wireguard))