1
0

Makefile 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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.4.3
  10. PKG_RELEASE:=2
  11. PKG_SOURCE_URL:=\
  12. https://build.openvpn.net/downloads/releases/ \
  13. https://swupdate.openvpn.net/community/releases/ \
  14. http://www.eurephia.net/openvpn/
  15. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  16. PKG_HASH:=7aa86167a5b8923e54e8795b814ed77288c793671f59fd830d9ab76d4b480571
  17. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  18. PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  19. PKG_INSTALL:=1
  20. PKG_FIXUP:=autoreconf
  21. PKG_BUILD_PARALLEL:=1
  22. PKG_LICENSE:=GPL-2.0
  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. ifeq ($(1),nossl)
  34. PROVIDES:=openvpn
  35. else
  36. PROVIDES:=openvpn openvpn-crypto
  37. endif
  38. endef
  39. Package/openvpn-openssl=$(call Package/openvpn/Default,openssl,OpenSSL,+PACKAGE_openvpn-openssl:libopenssl)
  40. Package/openvpn-mbedtls=$(call Package/openvpn/Default,mbedtls,mbedTLS,+PACKAGE_openvpn-mbedtls:libmbedtls)
  41. Package/openvpn-nossl=$(call Package/openvpn/Default,nossl,plaintext (no SSL))
  42. define Package/openvpn/config/Default
  43. source "$(SOURCE)/Config-$(1).in"
  44. endef
  45. Package/openvpn-openssl/config=$(call Package/openvpn/config/Default,openssl)
  46. Package/openvpn-mbedtls/config=$(call Package/openvpn/config/Default,mbedtls)
  47. Package/openvpn-nossl/config=$(call Package/openvpn/config/Default,nossl)
  48. ifeq ($(BUILD_VARIANT),mbedtls)
  49. CONFIG_OPENVPN_MBEDTLS:=y
  50. endif
  51. ifeq ($(BUILD_VARIANT),openssl)
  52. CONFIG_OPENVPN_OPENSSL:=y
  53. endif
  54. ifeq ($(BUILD_VARIANT),nossl)
  55. CONFIG_OPENVPN_NOSSL:=y
  56. endif
  57. CONFIGURE_VARS += \
  58. IFCONFIG=/sbin/ifconfig \
  59. ROUTE=/sbin/route \
  60. IPROUTE=/sbin/ip \
  61. NETSTAT=/sbin/netstat
  62. TARGET_CFLAGS += -ffunction-sections -fdata-sections
  63. TARGET_LDFLAGS += -Wl,--gc-sections
  64. define Build/Configure
  65. $(call Build/Configure/Default, \
  66. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_SMALL),--enable-small) \
  67. --disable-selinux \
  68. --disable-systemd \
  69. --disable-plugins \
  70. --disable-debug \
  71. --disable-pkcs11 \
  72. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_LZO),--enable,--disable)-lzo \
  73. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_LZ4),--enable,--disable)-lz4 \
  74. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_X509_ALT_USERNAME),enable,disable-x509-alt-username)-ssl \
  75. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_SERVER),--enable,--disable)-server \
  76. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_MANAGEMENT),--enable,--disable)-management \
  77. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_SOCKS),--enable,--disable)-socks \
  78. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_HTTP),--enable,--disable)-http-proxy \
  79. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_FRAGMENT),--enable,--disable)-fragment \
  80. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_MULTIHOME),--enable,--disable)-multihome \
  81. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_IPROUTE2),--enable,--disable)-iproute2 \
  82. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_DEF_AUTH),--enable,--disable)-def-auth \
  83. $(if $(CONFIG_OPENVPN_$(BUILD_VARIANT)_ENABLE_PF),--enable,--disable)-pf \
  84. $(if $(CONFIG_OPENVPN_NOSSL),--disable-ssl --disable-crypto,--enable-ssl --enable-crypto) \
  85. $(if $(CONFIG_OPENVPN_OPENSSL),--with-crypto-library=openssl) \
  86. $(if $(CONFIG_OPENVPN_MBEDTLS),--with-crypto-library=mbedtls) \
  87. )
  88. endef
  89. define Package/openvpn-$(BUILD_VARIANT)/conffiles
  90. /etc/config/openvpn
  91. endef
  92. define Package/openvpn-$(BUILD_VARIANT)/install
  93. $(INSTALL_DIR) \
  94. $(1)/usr/sbin \
  95. $(1)/usr/share/openvpn \
  96. $(1)/etc/init.d \
  97. $(1)/etc/config \
  98. $(1)/etc/openvpn \
  99. $(1)/lib/upgrade/keep.d
  100. $(INSTALL_BIN) \
  101. $(PKG_INSTALL_DIR)/usr/sbin/openvpn \
  102. $(1)/usr/sbin/
  103. $(INSTALL_BIN) \
  104. files/openvpn.init \
  105. $(1)/etc/init.d/openvpn
  106. $(INSTALL_DATA) \
  107. files/openvpn.options \
  108. $(1)/usr/share/openvpn/openvpn.options
  109. $(INSTALL_CONF) files/openvpn.config \
  110. $(1)/etc/config/openvpn
  111. $(INSTALL_DATA) \
  112. files/openvpn.upgrade \
  113. $(1)/lib/upgrade/keep.d/openvpn
  114. endef
  115. $(eval $(call BuildPackage,openvpn-openssl))
  116. $(eval $(call BuildPackage,openvpn-mbedtls))
  117. $(eval $(call BuildPackage,openvpn-nossl))