Merge pull request #11541 from neheb/jjjj
[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.29-9680
13 PKG_VERREL:=rtm
14 PKG_VERDATE:=2019.02.28
15 PKG_RELEASE:=3
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_HASH:=e6035fa7d9aaf59bdb342cd7ab5ecfdff89811a875f62a3230208cdc8a4e26e4
20
21 PKG_MAINTAINER:=Federico Di Marco <fededim@gmail.com>
22 PKG_LICENSE:=GPL-2.0-or-later
23 PKG_LICENSE_FILES:=COPYING
24
25 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/v$(PKG_VERSION)
26 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)/v$(PKG_VERSION)
27 PKG_BUILD_DEPENDS:=softethervpn/host
28 HOST_BUILD_DEPENDS:=readline/host libiconv/host
29
30 PKG_ASLR_PIE:=0
31 HAMCORE_SE2:=$(STAGING_DIR_HOST)/share/softethervpn/hamcore.se2
32
33 include $(INCLUDE_DIR)/nls.mk
34 include $(INCLUDE_DIR)/package.mk
35 include $(INCLUDE_DIR)/host-build.mk
36
37 # Execute in host build directory
38 HOST_MAKE_FLAGS += -C $(HOST_BUILD_DIR)
39
40 # Select 32 or 64 bit Makefile for host build depending on host architecture
41 HOST_MAKE_FLAGS += -f src/makefiles/linux_$(if $(shell uname -m | grep 64),64,32)bit.mak
42
43 HOST_LDFLAGS += -Wl,-rpath="$(STAGING_DIR_HOSTPKG)/lib"
44 # Prevent calling upstream configure
45 define Host/Configure
46 endef
47
48 define Host/Compile
49 # Build hamcorebuilder using host compiler and let it generate
50 # the hamcore.se2 archive file
51 # CFLAGS, CPPFLAGS & LDFLAGS need to be passed with CC because they are being ingored
52 CC="$(HOSTCC) $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(HOST_LDFLAGS)" $(MAKE) $(HOST_MAKE_FLAGS) \
53 src/bin/BuiltHamcoreFiles/unix/hamcore.se2
54 endef
55
56 define Host/Install
57 $(INSTALL_DIR) $(STAGING_DIR_HOST)/share/softethervpn
58 $(INSTALL_DATA) $(HOST_BUILD_DIR)/src/bin/BuiltHamcoreFiles/unix/hamcore.se2 $(HAMCORE_SE2)
59 endef
60
61
62 # Tune CFLAGS for target
63 TARGET_CFLAGS += \
64 $(if $(CONFIG_OPENSSL_WITH_SSL3),,-DSSL_OP_NO_SSLv3) \
65 $(if $(filter mips mipsel,$(ARCH)),-minterlink-mips16)
66
67 # Select 32 or 64 bit Makefile for target build depending on 64bit config symbol
68 MAKE_FLAGS += \
69 -f src/makefiles/linux_$(if $(CONFIG_ARCH_64BIT),64,32)bit.mak
70
71 # Map nonstandard CCFLAGS variable to standard TARGET_CFLAGS
72 MAKE_FLAGS += \
73 CC="$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_LDFLAGS)"
74
75 define Build/Configure
76 # Fetch prebuilt hamcore.se2 from staging dir
77 $(INSTALL_DIR) $(PKG_BUILD_DIR)/src/bin/BuiltHamcoreFiles/unix
78 $(CP) $(HAMCORE_SE2) $(PKG_BUILD_DIR)/src/bin/BuiltHamcoreFiles/unix/hamcore.se2
79
80 # Portably set hamcore.se2 modtime to one day in the future
81 # to prevent rebuilding it
82 perl -e 'utime(time() + 86400, time() + 86400, $$$$ARGV[0])' \
83 $(PKG_BUILD_DIR)/src/bin/BuiltHamcoreFiles/unix/hamcore.se2
84 endef
85
86
87 define Package/softethervpn/default
88 SECTION:=net
89 CATEGORY:=Network
90 SUBMENU:=VPN
91 TITLE:=Free Cross-platform Multi-protocol VPN server and client
92 URL:=http://www.softether.org/
93 endef
94
95 define Package/softethervpn/description
96 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
97 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
98 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,
99 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,
100 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
101 has very fast throughput, low latency and firewall resistance.
102 endef
103
104 define Package/softethervpn-base
105 $(Package/softethervpn/default)
106 DEPENDS:=+libpthread +librt +libreadline +libopenssl +libncurses +kmod-tun +zlib $(ICONV_DEPENDS)
107 TITLE += (Base)
108 endef
109
110 define Package/softethervpn-server
111 $(Package/softethervpn/default)
112 DEPENDS:=+softethervpn-base
113 TITLE += (Server)
114 endef
115
116 define Package/softethervpn-bridge
117 $(Package/softethervpn/default)
118 DEPENDS:=+softethervpn-base
119 TITLE += (Bridge)
120 endef
121
122 define Package/softethervpn-client
123 $(Package/softethervpn/default)
124 DEPENDS:=+softethervpn-base
125 TITLE += (Client)
126 endef
127
128 Package/softethervpn-base/description = $(Package/softethervpn/description)
129 Package/softethervpn-server/description = $(Package/softethervpn/description)
130 Package/softethervpn-bridge/description = $(Package/softethervpn/description)
131 Package/softethervpn-client/description = $(Package/softethervpn/description)
132
133 define Package/softethervpn-base/conffiles
134 /usr/libexec/softethervpn/lang.config
135 endef
136
137 define Package/softethervpn-server/conffiles
138 /usr/libexec/softethervpn/vpn_server.config
139 endef
140
141 define Package/softethervpn-client/conffiles
142 /usr/libexec/softethervpn/vpn_client.config
143 endef
144
145 define Package/softethervpn-bridge/conffiles
146 /usr/libexec/softethervpn/vpn_bridge.config
147 endef
148
149 define Package/softethervpn-base/install
150 $(INSTALL_DIR) $(1)/usr/libexec/softethervpn
151 $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpnserver/hamcore.se2 $(1)/usr/libexec/softethervpn
152 $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpncmd/vpncmd $(1)/usr/libexec/softethervpn
153 $(INSTALL_BIN) files/launcher.sh $(1)/usr/libexec/softethervpn
154
155 $(INSTALL_DATA) files/dummy $(1)/usr/libexec/softethervpn/lang.config
156
157 $(INSTALL_DIR) $(1)/usr/bin
158 $(LN) ../../usr/libexec/softethervpn/launcher.sh $(1)/usr/bin/vpncmd
159 endef
160
161 define Package/softethervpn-server/install
162 $(INSTALL_DIR) $(1)/usr/libexec/softethervpn
163 $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpnserver/vpnserver $(1)/usr/libexec/softethervpn
164
165 $(INSTALL_DATA) files/dummy $(1)/usr/libexec/softethervpn/vpn_server.config
166
167 $(INSTALL_DIR) $(1)/etc
168 $(INSTALL_DIR) $(1)/etc/init.d
169 $(INSTALL_BIN) files/vpnserver.init $(1)/etc/init.d/softethervpnserver
170 endef
171
172 define Package/softethervpn-bridge/install
173 $(INSTALL_DIR) $(1)/usr/libexec/softethervpn
174 $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpnbridge/vpnbridge $(1)/usr/libexec/softethervpn
175
176 $(INSTALL_DATA) files/dummy $(1)/usr/libexec/softethervpn/vpn_bridge.config
177
178 $(INSTALL_DIR) $(1)/etc
179 $(INSTALL_DIR) $(1)/etc/init.d
180 $(INSTALL_BIN) files/vpnbridge.init $(1)/etc/init.d/softethervpnbridge
181 endef
182
183 define Package/softethervpn-client/install
184 $(INSTALL_DIR) $(1)/usr/libexec/softethervpn
185 $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpnclient/vpnclient $(1)/usr/libexec/softethervpn
186
187 $(INSTALL_DATA) files/dummy $(1)/usr/libexec/softethervpn/vpn_client.config
188
189 $(INSTALL_DIR) $(1)/etc
190 $(INSTALL_DIR) $(1)/etc/init.d
191 $(INSTALL_BIN) files/vpnclient.init $(1)/etc/init.d/softethervpnclient
192 endef
193
194 $(eval $(call BuildPackage,softethervpn-base))
195 $(eval $(call BuildPackage,softethervpn-server))
196 $(eval $(call BuildPackage,softethervpn-client))
197 $(eval $(call BuildPackage,softethervpn-bridge))
198 $(eval $(call HostBuild))