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.

144 lines
4.1 KiB

  1. #
  2. # Copyright (C) 2010-2015 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=openvpn
  9. PKG_VERSION:=2.5.1
  10. PKG_RELEASE:=2
  11. PKG_SOURCE_URL:=\
  12. https://build.openvpn.net/downloads/releases/ \
  13. https://swupdate.openvpn.net/community/releases/
  14. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  15. PKG_HASH:=40930489c837c05f6153f38e1ebaec244431ef1a034e4846ff732d71d59ff194
  16. PKG_MAINTAINER:=Magnus Kroken <mkroken@gmail.com>
  17. PKG_INSTALL:=1
  18. PKG_FIXUP:=autoreconf
  19. PKG_BUILD_PARALLEL:=1
  20. PKG_LICENSE:=GPL-2.0
  21. PKG_CPE_ID:=cpe:/a:openvpn:openvpn
  22. include $(INCLUDE_DIR)/package.mk
  23. define Package/openvpn/Default
  24. TITLE:=Open source VPN solution using $(2)
  25. SECTION:=net
  26. CATEGORY:=Network
  27. URL:=http://openvpn.net
  28. SUBMENU:=VPN
  29. MENU:=1
  30. DEPENDS:=+kmod-tun +OPENVPN_$(1)_ENABLE_LZO:liblzo +OPENVPN_$(1)_ENABLE_IPROUTE2:ip $(3)
  31. VARIANT:=$(1)
  32. PROVIDES:=openvpn openvpn-crypto
  33. endef
  34. Package/openvpn-openssl=$(call Package/openvpn/Default,openssl,OpenSSL,+PACKAGE_openvpn-openssl:libopenssl)
  35. Package/openvpn-mbedtls=$(call Package/openvpn/Default,mbedtls,mbedTLS,+PACKAGE_openvpn-mbedtls:libmbedtls)
  36. define Package/openvpn/config/Default
  37. source "$(SOURCE)/Config-$(1).in"
  38. endef
  39. Package/openvpn-openssl/config=$(call Package/openvpn/config/Default,openssl)
  40. Package/openvpn-mbedtls/config=$(call Package/openvpn/config/Default,mbedtls)
  41. ifeq ($(BUILD_VARIANT),mbedtls)
  42. CONFIG_OPENVPN_MBEDTLS:=y
  43. endif
  44. ifeq ($(BUILD_VARIANT),openssl)
  45. CONFIG_OPENVPN_OPENSSL:=y
  46. endif
  47. CONFIGURE_VARS += \
  48. IPROUTE=/sbin/ip \
  49. NETSTAT=/sbin/netstat
  50. TARGET_CFLAGS += -ffunction-sections -fdata-sections
  51. TARGET_LDFLAGS += -Wl,--gc-sections
  52. define Build/Configure
  53. $(call Build/Configure/Default, \
  54. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_SMALL),--enable-small) \
  55. --disable-selinux \
  56. --disable-systemd \
  57. --disable-plugins \
  58. --disable-debug \
  59. --disable-pkcs11 \
  60. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_LZO),--enable,--disable)-lzo \
  61. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_LZ4),--enable,--disable)-lz4 \
  62. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_X509_ALT_USERNAME),--enable,--disable)-x509-alt-username \
  63. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_MANAGEMENT),--enable,--disable)-management \
  64. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_FRAGMENT),--enable,--disable)-fragment \
  65. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_MULTIHOME),--enable,--disable)-multihome \
  66. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_IPROUTE2),--enable,--disable)-iproute2 \
  67. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_DEF_AUTH),--enable,--disable)-def-auth \
  68. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_PF),--enable,--disable)-pf \
  69. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_PORT_SHARE),--enable,--disable)-port-share \
  70. $(if $(CONFIG_OPENVPN_OPENSSL),--with-crypto-library=openssl) \
  71. $(if $(CONFIG_OPENVPN_MBEDTLS),--with-crypto-library=mbedtls) \
  72. )
  73. endef
  74. define Package/openvpn-$(BUILD_VARIANT)/conffiles
  75. /etc/config/openvpn
  76. /etc/openvpn.user
  77. endef
  78. define Package/openvpn-$(BUILD_VARIANT)/install
  79. $(INSTALL_DIR) \
  80. $(1)/usr/sbin \
  81. $(1)/usr/share/openvpn \
  82. $(1)/etc/init.d \
  83. $(1)/etc/config \
  84. $(1)/etc/openvpn \
  85. $(1)/lib/functions \
  86. $(1)/lib/upgrade/keep.d \
  87. $(1)/usr/libexec \
  88. $(1)/etc/hotplug.d/openvpn
  89. $(INSTALL_BIN) \
  90. $(PKG_INSTALL_DIR)/usr/sbin/openvpn \
  91. $(1)/usr/sbin/
  92. $(INSTALL_BIN) \
  93. files/openvpn.init \
  94. $(1)/etc/init.d/openvpn
  95. $(INSTALL_BIN) \
  96. files/usr/libexec/openvpn-hotplug \
  97. $(1)/usr/libexec/openvpn-hotplug
  98. $(INSTALL_DATA) \
  99. files/lib/functions/openvpn.sh \
  100. $(1)/lib/functions/openvpn.sh
  101. $(INSTALL_DATA) \
  102. files/etc/hotplug.d/openvpn/01-user \
  103. $(1)/etc/hotplug.d/openvpn/01-user
  104. $(INSTALL_DATA) \
  105. files/etc/openvpn.user \
  106. $(1)/etc/openvpn.user
  107. $(INSTALL_DATA) \
  108. files/openvpn.options \
  109. $(1)/usr/share/openvpn/openvpn.options
  110. $(INSTALL_CONF) files/openvpn.config \
  111. $(1)/etc/config/openvpn
  112. $(INSTALL_DATA) \
  113. files/openvpn.upgrade \
  114. $(1)/lib/upgrade/keep.d/openvpn
  115. endef
  116. $(eval $(call BuildPackage,openvpn-openssl))
  117. $(eval $(call BuildPackage,openvpn-mbedtls))