1
0

Makefile 4.3 KB

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