You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

131 lines
5.9 KiB

  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.21-9613
  11. PKG_VERREL:=beta
  12. PKG_VERDATE:=2016.04.24
  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_MD5SUM:=928d882d5fc23e00f0a5fa4ebf292ab9
  17. PKG_BUILD_DIR:=$(BUILD_DIR)/v$(PKG_VERSION)
  18. PKG_LICENSE:=GPL-2.0
  19. PKG_LICENSE_FILES:=COPYING
  20. include $(INCLUDE_DIR)/nls.mk
  21. include $(INCLUDE_DIR)/package.mk
  22. define Package/softethervpn
  23. SECTION:=net
  24. CATEGORY:=Network
  25. SUBMENU:=VPN
  26. DEPENDS:=+libpthread +librt +libreadline +libopenssl +libncurses +kmod-tun +zlib $(ICONV_DEPENDS)
  27. TITLE:=Free Cross-platform Multi-protocol VPN server and client
  28. URL:=http://www.softether.org/
  29. MAINTAINER:=Federico Di Marco <fededim@gmail.com>
  30. endef
  31. define Package/softethervpn/description
  32. 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
  33. 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
  34. 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,
  35. 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,
  36. 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
  37. has very fast throughput, low latency and firewall resistance.
  38. endef
  39. define Package/softethervpn/conffiles
  40. /usr/libexec/softethervpn/vpn_server.config
  41. /usr/libexec/softethervpn/vpn_client.config
  42. /usr/libexec/softethervpn/vpn_bridge.config
  43. /usr/libexec/softethervpn/lang.config
  44. endef
  45. ifeq ($(CONFIG_OPENSSL_WITH_SSL3),y)
  46. SE_FLAGS=-DSSL3_SUPPORT
  47. endif
  48. ifeq ($(ARCH),mips)
  49. SE_FLAGS+= -minterlink-mips16
  50. endif
  51. ifeq ($(ARCH),mipsel)
  52. SE_FLAGS+= -minterlink-mips16
  53. endif
  54. define Build/Configure
  55. if [ -v CONFIG_64BIT ]; then cp $(PKG_BUILD_DIR)/src/makefiles/linux_64bit.mak $(PKG_BUILD_DIR)/Makefile; else cp $(PKG_BUILD_DIR)/src/makefiles/linux_32bit.mak $(PKG_BUILD_DIR)/Makefile; fi;
  56. endef
  57. define Build/Compile
  58. # Softether compiles first a tool called hamcorebuilder which is essentially an archiver. Then the compilation calls this archiver to pack all
  59. # resource files (*.html, *.config, .txt, readme, languages) it needs to run in an archive file called hamcore.se2. The three executables are then built
  60. # and they will have a runtime dependency on this resource archive. By default OpenWRT build process cross compiles all targets in the makefile
  61. # generating therefore an error when the archive is generated since the executable is crosscompiled to run on the router and instead it is run
  62. # by the build host. The workaround is to compile the archiver with the host environment, generate the hamcore.se2 archive and cross compile everything
  63. # again without regenerating the archive.
  64. # we clean the last cross compiled version
  65. make -C $(PKG_BUILD_DIR) clean
  66. # we compile the hamcorebuilder utility and generate hamcore archive using host environment
  67. make -C $(PKG_BUILD_DIR) src/bin/BuiltHamcoreFiles/unix/hamcore.se2
  68. # we clean everything, but we save the built hamcore archive and we update its timestamp to avoid rebuilding the archive with cross compiled hamcorebuilder
  69. mv $(PKG_BUILD_DIR)/src/bin/BuiltHamcoreFiles/unix/hamcore.se2 $(PKG_BUILD_DIR)/src/bin/BuiltHamcoreFiles/unix/hamcore.se2.1
  70. make -C $(PKG_BUILD_DIR) clean
  71. mv $(PKG_BUILD_DIR)/src/bin/BuiltHamcoreFiles/unix/hamcore.se2.1 $(PKG_BUILD_DIR)/src/bin/BuiltHamcoreFiles/unix/hamcore.se2
  72. touch -d "`date -d 1day`" $(PKG_BUILD_DIR)/src/bin/BuiltHamcoreFiles/unix/hamcore.se2
  73. ls -la $(PKG_BUILD_DIR)/src/bin/BuiltHamcoreFiles/unix
  74. # we cross compile everything from the scratch
  75. $(MAKE) \
  76. $(TARGET_CONFIGURE_OPTS) \
  77. CCFLAGS="$(SE_FLAGS) -I$(STAGING_DIR)/usr/include $(ICONV_CFLAGS)" \
  78. LDFLAGS="-L$(STAGING_DIR)/usr/lib $(ICONV_LDFLAGS)" \
  79. -C $(PKG_BUILD_DIR)
  80. endef
  81. define Package/softethervpn/install
  82. $(INSTALL_DIR) $(1)/usr/libexec/softethervpn
  83. $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpnserver/vpnserver $(1)/usr/libexec/softethervpn
  84. $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpnserver/hamcore.se2 $(1)/usr/libexec/softethervpn
  85. $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpnclient/vpnclient $(1)/usr/libexec/softethervpn
  86. $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpnbridge/vpnbridge $(1)/usr/libexec/softethervpn
  87. $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpncmd/vpncmd $(1)/usr/libexec/softethervpn
  88. $(INSTALL_BIN) files/launcher.sh $(1)/usr/libexec/softethervpn
  89. $(INSTALL_DATA) files/dummy $(1)/usr/libexec/softethervpn/vpn_server.config
  90. $(INSTALL_DATA) files/dummy $(1)/usr/libexec/softethervpn/vpn_bridge.config
  91. $(INSTALL_DATA) files/dummy $(1)/usr/libexec/softethervpn/vpn_client.config
  92. $(INSTALL_DATA) files/dummy $(1)/usr/libexec/softethervpn/lang.config
  93. $(INSTALL_DIR) $(1)/usr/bin
  94. #$(LN) ../../usr/libexec/softethervpn/launcher.sh $(1)/usr/bin/vpnserver
  95. #$(LN) ../../usr/libexec/softethervpn/launcher.sh $(1)/usr/bin/vpnclient
  96. #$(LN) ../../usr/libexec/softethervpn/launcher.sh $(1)/usr/bin/vpnbridge
  97. $(LN) ../../usr/libexec/softethervpn/launcher.sh $(1)/usr/bin/vpncmd
  98. $(INSTALL_DIR) $(1)/etc
  99. $(INSTALL_DIR) $(1)/etc/init.d
  100. $(INSTALL_BIN) files/vpnserver.init $(1)/etc/init.d/softethervpnserver
  101. $(INSTALL_BIN) files/vpnbridge.init $(1)/etc/init.d/softethervpnbridge
  102. $(INSTALL_BIN) files/vpnclient.init $(1)/etc/init.d/softethervpnclient
  103. endef
  104. $(eval $(call BuildPackage,softethervpn))