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