Makefile 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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.8
  10. PKG_RELEASE:=3
  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:=2bbd0026469902037ee6499b68283d5ab36c74e36cae3112082cfdf6c77a0c57
  16. PKG_MAINTAINER:=Magnus Kroken <mkroken@gmail.com>
  17. PKG_INSTALL:=1
  18. PKG_FIXUP:=autoreconf
  19. PKG_BUILD_PARALLEL:=1
  20. PKG_BUILD_FLAGS:=gc-sections
  21. PKG_LICENSE:=GPL-2.0
  22. PKG_CPE_ID:=cpe:/a:openvpn:openvpn
  23. include $(INCLUDE_DIR)/package.mk
  24. define Package/openvpn/Default
  25. TITLE:=Open source VPN solution using $(2)
  26. SECTION:=net
  27. CATEGORY:=Network
  28. URL:=http://openvpn.net
  29. SUBMENU:=VPN
  30. MENU:=1
  31. DEPENDS:=+kmod-tun +OPENVPN_$(1)_ENABLE_LZO:liblzo +OPENVPN_$(1)_ENABLE_IPROUTE2:ip $(3)
  32. VARIANT:=$(1)
  33. PROVIDES:=openvpn openvpn-crypto
  34. endef
  35. Package/openvpn-openssl=$(call Package/openvpn/Default,openssl,OpenSSL,+PACKAGE_openvpn-openssl:libopenssl)
  36. Package/openvpn-mbedtls=$(call Package/openvpn/Default,mbedtls,mbedTLS,+PACKAGE_openvpn-mbedtls:libmbedtls)
  37. Package/openvpn-wolfssl=$(call Package/openvpn/Default,wolfssl,WolfSSL \(experimental\),+PACKAGE_openvpn-wolfssl:libwolfssl)
  38. define Package/openvpn/config/Default
  39. source "$(SOURCE)/Config-$(1).in"
  40. endef
  41. Package/openvpn-openssl/config=$(call Package/openvpn/config/Default,openssl)
  42. Package/openvpn-mbedtls/config=$(call Package/openvpn/config/Default,mbedtls)
  43. Package/openvpn-wolfssl/config=$(call Package/openvpn/config/Default,wolfssl)
  44. ifeq ($(BUILD_VARIANT),mbedtls)
  45. CONFIG_OPENVPN_MBEDTLS:=y
  46. endif
  47. ifeq ($(BUILD_VARIANT),openssl)
  48. CONFIG_OPENVPN_OPENSSL:=y
  49. endif
  50. ifeq ($(BUILD_VARIANT),wolfssl)
  51. CONFIG_OPENVPN_WOLFSSL:=y
  52. endif
  53. CONFIGURE_VARS += \
  54. IPROUTE=/sbin/ip \
  55. NETSTAT=/sbin/netstat
  56. define Build/Configure
  57. $(call Build/Configure/Default, \
  58. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_SMALL),--enable-small) \
  59. --disable-selinux \
  60. --disable-systemd \
  61. --disable-plugins \
  62. --disable-debug \
  63. --disable-pkcs11 \
  64. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_LZO),--enable,--disable)-lzo \
  65. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_LZ4),--enable,--disable)-lz4 \
  66. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_X509_ALT_USERNAME),--enable,--disable)-x509-alt-username \
  67. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_MANAGEMENT),--enable,--disable)-management \
  68. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_FRAGMENT),--enable,--disable)-fragment \
  69. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_MULTIHOME),--enable,--disable)-multihome \
  70. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_IPROUTE2),--enable,--disable)-iproute2 \
  71. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_DEF_AUTH),--enable,--disable)-def-auth \
  72. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_PF),--enable,--disable)-pf \
  73. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_PORT_SHARE),--enable,--disable)-port-share \
  74. $(if $(CONFIG_OPENVPN_OPENSSL),--with-crypto-library=openssl --with-openssl-engine=no) \
  75. $(if $(CONFIG_OPENVPN_MBEDTLS),--with-crypto-library=mbedtls) \
  76. $(if $(CONFIG_OPENVPN_WOLFSSL),--with-crypto-library=wolfssl) \
  77. )
  78. endef
  79. define Package/openvpn-$(BUILD_VARIANT)/conffiles
  80. /etc/config/openvpn
  81. /etc/openvpn.user
  82. endef
  83. define Package/openvpn-$(BUILD_VARIANT)/install
  84. $(INSTALL_DIR) \
  85. $(1)/usr/sbin \
  86. $(1)/usr/share/openvpn \
  87. $(1)/etc/init.d \
  88. $(1)/etc/config \
  89. $(1)/etc/openvpn \
  90. $(1)/lib/functions \
  91. $(1)/lib/upgrade/keep.d \
  92. $(1)/usr/libexec \
  93. $(1)/etc/hotplug.d/openvpn
  94. $(INSTALL_BIN) \
  95. $(PKG_INSTALL_DIR)/usr/sbin/openvpn \
  96. $(1)/usr/sbin/
  97. $(INSTALL_BIN) \
  98. files/openvpn.init \
  99. $(1)/etc/init.d/openvpn
  100. $(INSTALL_BIN) \
  101. files/usr/libexec/openvpn-hotplug \
  102. $(1)/usr/libexec/openvpn-hotplug
  103. $(INSTALL_DATA) \
  104. files/lib/functions/openvpn.sh \
  105. $(1)/lib/functions/openvpn.sh
  106. $(INSTALL_DATA) \
  107. files/etc/hotplug.d/openvpn/01-user \
  108. $(1)/etc/hotplug.d/openvpn/01-user
  109. $(INSTALL_DATA) \
  110. files/etc/openvpn.user \
  111. $(1)/etc/openvpn.user
  112. $(INSTALL_DATA) \
  113. files/openvpn.options \
  114. $(1)/usr/share/openvpn/openvpn.options
  115. $(INSTALL_CONF) files/openvpn.config \
  116. $(1)/etc/config/openvpn
  117. $(INSTALL_DATA) \
  118. files/openvpn.upgrade \
  119. $(1)/lib/upgrade/keep.d/openvpn
  120. endef
  121. $(eval $(call BuildPackage,openvpn-openssl))
  122. $(eval $(call BuildPackage,openvpn-mbedtls))
  123. $(eval $(call BuildPackage,openvpn-wolfssl))