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.

151 lines
4.5 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.5
  10. PKG_RELEASE:=1
  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:=119bd69fa0210838f6cdaa273696dc738efa200f454dbe11eb6dfb75dfb6003b
  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. Package/openvpn-wolfssl=$(call Package/openvpn/Default,wolfssl,WolfSSL \(experimental\),+PACKAGE_openvpn-wolfssl:libwolfssl)
  37. define Package/openvpn/config/Default
  38. source "$(SOURCE)/Config-$(1).in"
  39. endef
  40. Package/openvpn-openssl/config=$(call Package/openvpn/config/Default,openssl)
  41. Package/openvpn-mbedtls/config=$(call Package/openvpn/config/Default,mbedtls)
  42. Package/openvpn-wolfssl/config=$(call Package/openvpn/config/Default,wolfssl)
  43. ifeq ($(BUILD_VARIANT),mbedtls)
  44. CONFIG_OPENVPN_MBEDTLS:=y
  45. endif
  46. ifeq ($(BUILD_VARIANT),openssl)
  47. CONFIG_OPENVPN_OPENSSL:=y
  48. endif
  49. ifeq ($(BUILD_VARIANT),wolfssl)
  50. CONFIG_OPENVPN_WOLFSSL:=y
  51. endif
  52. CONFIGURE_VARS += \
  53. IPROUTE=/sbin/ip \
  54. NETSTAT=/sbin/netstat
  55. TARGET_CFLAGS += -ffunction-sections -fdata-sections
  56. TARGET_LDFLAGS += -Wl,--gc-sections
  57. define Build/Configure
  58. $(call Build/Configure/Default, \
  59. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_SMALL),--enable-small) \
  60. --disable-selinux \
  61. --disable-systemd \
  62. --disable-plugins \
  63. --disable-debug \
  64. --disable-pkcs11 \
  65. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_LZO),--enable,--disable)-lzo \
  66. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_LZ4),--enable,--disable)-lz4 \
  67. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_X509_ALT_USERNAME),--enable,--disable)-x509-alt-username \
  68. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_MANAGEMENT),--enable,--disable)-management \
  69. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_FRAGMENT),--enable,--disable)-fragment \
  70. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_MULTIHOME),--enable,--disable)-multihome \
  71. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_IPROUTE2),--enable,--disable)-iproute2 \
  72. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_DEF_AUTH),--enable,--disable)-def-auth \
  73. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_PF),--enable,--disable)-pf \
  74. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_PORT_SHARE),--enable,--disable)-port-share \
  75. $(if $(CONFIG_OPENVPN_OPENSSL),--with-crypto-library=openssl) \
  76. $(if $(CONFIG_OPENVPN_MBEDTLS),--with-crypto-library=mbedtls) \
  77. $(if $(CONFIG_OPENVPN_WOLFSSL),--with-crypto-library=wolfssl) \
  78. )
  79. endef
  80. define Package/openvpn-$(BUILD_VARIANT)/conffiles
  81. /etc/config/openvpn
  82. /etc/openvpn.user
  83. endef
  84. define Package/openvpn-$(BUILD_VARIANT)/install
  85. $(INSTALL_DIR) \
  86. $(1)/usr/sbin \
  87. $(1)/usr/share/openvpn \
  88. $(1)/etc/init.d \
  89. $(1)/etc/config \
  90. $(1)/etc/openvpn \
  91. $(1)/lib/functions \
  92. $(1)/lib/upgrade/keep.d \
  93. $(1)/usr/libexec \
  94. $(1)/etc/hotplug.d/openvpn
  95. $(INSTALL_BIN) \
  96. $(PKG_INSTALL_DIR)/usr/sbin/openvpn \
  97. $(1)/usr/sbin/
  98. $(INSTALL_BIN) \
  99. files/openvpn.init \
  100. $(1)/etc/init.d/openvpn
  101. $(INSTALL_BIN) \
  102. files/usr/libexec/openvpn-hotplug \
  103. $(1)/usr/libexec/openvpn-hotplug
  104. $(INSTALL_DATA) \
  105. files/lib/functions/openvpn.sh \
  106. $(1)/lib/functions/openvpn.sh
  107. $(INSTALL_DATA) \
  108. files/etc/hotplug.d/openvpn/01-user \
  109. $(1)/etc/hotplug.d/openvpn/01-user
  110. $(INSTALL_DATA) \
  111. files/etc/openvpn.user \
  112. $(1)/etc/openvpn.user
  113. $(INSTALL_DATA) \
  114. files/openvpn.options \
  115. $(1)/usr/share/openvpn/openvpn.options
  116. $(INSTALL_CONF) files/openvpn.config \
  117. $(1)/etc/config/openvpn
  118. $(INSTALL_DATA) \
  119. files/openvpn.upgrade \
  120. $(1)/lib/upgrade/keep.d/openvpn
  121. endef
  122. $(eval $(call BuildPackage,openvpn-openssl))
  123. $(eval $(call BuildPackage,openvpn-mbedtls))
  124. $(eval $(call BuildPackage,openvpn-wolfssl))