Makefile 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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.9
  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.gz
  15. PKG_HASH:=8794b7125998c68f30de654267a702b9581454ca1e7061511fcc5f99fea4bd32
  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 --with-openssl-engine=no) \
  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))