Makefile 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. #
  2. # Copyright (C) 2008-2016 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. # Based on the initial porting done by el1n
  8. include $(TOPDIR)/rules.mk
  9. PKG_NAME:=softethervpn
  10. PKG_VERSION:=4.25-9656
  11. PKG_VERREL:=rtm
  12. PKG_VERDATE:=2018.01.15
  13. PKG_RELEASE:=1
  14. PKG_SOURCE:=softether-src-v$(PKG_VERSION)-$(PKG_VERREL).tar.gz
  15. PKG_SOURCE_URL:=http://www.softether-download.com/files/softether/v$(PKG_VERSION)-$(PKG_VERREL)-$(PKG_VERDATE)-tree/Source_Code/
  16. PKG_HASH:=b946dec3da5833ad2be69125224784b8a8e2a4149297d0c0a907ba0e1c4535f8
  17. PKG_BUILD_DIR:=$(BUILD_DIR)/v$(PKG_VERSION)
  18. HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/v$(PKG_VERSION)
  19. PKG_LICENSE:=GPL-2.0
  20. PKG_LICENSE_FILES:=COPYING
  21. PKG_BUILD_DEPENDS:=softethervpn/host
  22. HAMCORE_SE2:=$(STAGING_DIR_HOST)/share/softethervpn/hamcore.se2
  23. include $(INCLUDE_DIR)/nls.mk
  24. include $(INCLUDE_DIR)/package.mk
  25. include $(INCLUDE_DIR)/host-build.mk
  26. # Override CC to add fake libreadline to linker search path
  27. HOSTCC += -L./src/readline
  28. # Add defines to turn add_history() and readline() calls into no-ops
  29. HOSTCC += -D'add_history(x)' -D'readline(x)=\"\"'
  30. # Execute in host build directory
  31. HOST_MAKE_FLAGS += -C $(HOST_BUILD_DIR)
  32. # Select 32 or 64 bit Makefile for host build depending on host architecture
  33. HOST_MAKE_FLAGS += -f src/makefiles/linux_$(if $(shell uname -m | grep 64),64,32)bit.mak
  34. # Prevent calling upstream configure
  35. define Host/Configure
  36. endef
  37. define Host/Compile
  38. # Prepare fake readline headers and library
  39. mkdir -p $(HOST_BUILD_DIR)/src/readline
  40. touch $(HOST_BUILD_DIR)/src/readline/readline.h
  41. touch $(HOST_BUILD_DIR)/src/readline/history.h
  42. ar rcs $(HOST_BUILD_DIR)/src/readline/libreadline.a
  43. # Build hamcorebuilder using host compiler and let it generate
  44. # the hamcore.se2 archive file
  45. CC="$(HOSTCC)" $(MAKE) $(HOST_MAKE_FLAGS) \
  46. src/bin/BuiltHamcoreFiles/unix/hamcore.se2
  47. endef
  48. define Host/Install
  49. $(INSTALL_DIR) $(STAGING_DIR_HOST)/share/softethervpn
  50. $(INSTALL_DATA) $(HOST_BUILD_DIR)/src/bin/BuiltHamcoreFiles/unix/hamcore.se2 $(HAMCORE_SE2)
  51. endef
  52. # Tune CFLAGS for target
  53. TARGET_CFLAGS += \
  54. $(if $(CONFIG_OPENSSL_WITH_SSL3),,-DSSL_OP_NO_SSLv3) \
  55. $(if $(filter mips mipsel,$(ARCH)),-minterlink-mips16)
  56. # Select 32 or 64 bit Makefile for target build depending on 64bit config symbol
  57. MAKE_FLAGS += \
  58. -f src/makefiles/linux_$(if $(CONFIG_ARCH_64BIT),64,32)bit.mak
  59. # Map nonstandard CCFLAGS variable to standard TARGET_CFLAGS
  60. MAKE_FLAGS += \
  61. CC="$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_LDFLAGS)"
  62. define Build/Configure
  63. # Fetch prebuilt hamcore.se2 from staging dir
  64. $(INSTALL_DIR) $(PKG_BUILD_DIR)/src/bin/BuiltHamcoreFiles/unix
  65. $(CP) $(HAMCORE_SE2) $(PKG_BUILD_DIR)/src/bin/BuiltHamcoreFiles/unix/hamcore.se2
  66. # Portably set hamcore.se2 modtime to one day in the future
  67. # to prevent rebuilding it
  68. perl -e 'utime(time() + 86400, time() + 86400, $$$$ARGV[0])' \
  69. $(PKG_BUILD_DIR)/src/bin/BuiltHamcoreFiles/unix/hamcore.se2
  70. endef
  71. define Package/softethervpn
  72. SECTION:=net
  73. CATEGORY:=Network
  74. SUBMENU:=VPN
  75. DEPENDS:=+libpthread +librt +libreadline +libopenssl +libncurses +kmod-tun +zlib $(ICONV_DEPENDS)
  76. TITLE:=Free Cross-platform Multi-protocol VPN server and client
  77. URL:=http://www.softether.org/
  78. MAINTAINER:=Federico Di Marco <fededim@gmail.com>
  79. endef
  80. define Package/softethervpn/description
  81. SoftEther VPN ("SoftEther" means "Software Ethernet") is one of the world's most powerful and easy-to-use multi-protocol VPN software developed as an academic
  82. project from University of Tsukuba, Japan. SoftEther VPN has strong compatibility to today's most popular VPN products among the world. It has the interoperability
  83. with OpenVPN, L2TP, IPsec, EtherIP, L2TPv3, Cisco VPN Routers and MS-SSTP VPN Clients. SoftEther VPN is the world's only VPN software which supports SSL-VPN,
  84. OpenVPN, L2TP, EtherIP, L2TPv3 and IPsec as a single VPN software. SoftEther VPN is not only an alternative VPN server to existing VPN products (OpenVPN,
  85. IPsec and MS-SSTP), but has also original strong SSL-VPN protocol to penetrate any kinds of firewalls. Ultra-optimized SSL-VPN Protocol of SoftEther VPN
  86. has very fast throughput, low latency and firewall resistance.
  87. endef
  88. define Package/softethervpn/conffiles
  89. /usr/libexec/softethervpn/vpn_server.config
  90. /usr/libexec/softethervpn/vpn_client.config
  91. /usr/libexec/softethervpn/vpn_bridge.config
  92. /usr/libexec/softethervpn/lang.config
  93. endef
  94. define Package/softethervpn/install
  95. $(INSTALL_DIR) $(1)/usr/libexec/softethervpn
  96. $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpnserver/vpnserver $(1)/usr/libexec/softethervpn
  97. $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpnserver/hamcore.se2 $(1)/usr/libexec/softethervpn
  98. $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpnclient/vpnclient $(1)/usr/libexec/softethervpn
  99. $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpnbridge/vpnbridge $(1)/usr/libexec/softethervpn
  100. $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpncmd/vpncmd $(1)/usr/libexec/softethervpn
  101. $(INSTALL_BIN) files/launcher.sh $(1)/usr/libexec/softethervpn
  102. $(INSTALL_DATA) files/dummy $(1)/usr/libexec/softethervpn/vpn_server.config
  103. $(INSTALL_DATA) files/dummy $(1)/usr/libexec/softethervpn/vpn_bridge.config
  104. $(INSTALL_DATA) files/dummy $(1)/usr/libexec/softethervpn/vpn_client.config
  105. $(INSTALL_DATA) files/dummy $(1)/usr/libexec/softethervpn/lang.config
  106. $(INSTALL_DIR) $(1)/usr/bin
  107. #$(LN) ../../usr/libexec/softethervpn/launcher.sh $(1)/usr/bin/vpnserver
  108. #$(LN) ../../usr/libexec/softethervpn/launcher.sh $(1)/usr/bin/vpnclient
  109. #$(LN) ../../usr/libexec/softethervpn/launcher.sh $(1)/usr/bin/vpnbridge
  110. $(LN) ../../usr/libexec/softethervpn/launcher.sh $(1)/usr/bin/vpncmd
  111. $(INSTALL_DIR) $(1)/etc
  112. $(INSTALL_DIR) $(1)/etc/init.d
  113. $(INSTALL_BIN) files/vpnserver.init $(1)/etc/init.d/softethervpnserver
  114. $(INSTALL_BIN) files/vpnbridge.init $(1)/etc/init.d/softethervpnbridge
  115. $(INSTALL_BIN) files/vpnclient.init $(1)/etc/init.d/softethervpnclient
  116. endef
  117. $(eval $(call BuildPackage,softethervpn))
  118. $(eval $(call HostBuild))