lede-packages-rs

git clone git://archive.git.mtrnord.blog/MTRNord/lede-packages-rs.git
Log | Files | Refs | README | LICENSE

Makefile (5928B)


      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.22-9634
     13 PKG_VERREL:=beta
     14 PKG_VERDATE:=2016.11.27
     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:=703d41b34ff49d008ddd329340a5a75e
     20 
     21 PKG_BUILD_DIR:=$(BUILD_DIR)/v$(PKG_VERSION)
     22 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/v$(PKG_VERSION)
     23 
     24 PKG_LICENSE:=GPL-2.0
     25 PKG_LICENSE_FILES:=COPYING
     26 
     27 PKG_BUILD_DEPENDS:=softethervpn/host
     28 
     29 HAMCORE_SE2:=$(STAGING_DIR_HOST)/share/softethervpn/hamcore.se2
     30 
     31 include $(INCLUDE_DIR)/nls.mk
     32 include $(INCLUDE_DIR)/package.mk
     33 include $(INCLUDE_DIR)/host-build.mk
     34 
     35 
     36 # Override CC to add fake libreadline to linker search path
     37 HOSTCC += -L./src/readline
     38 
     39 # Add defines to turn add_history() and readline() calls into no-ops
     40 HOSTCC += -D'add_history(x)' -D'readline(x)=\"\"'
     41 
     42 # Execute in host build directory
     43 HOST_MAKE_FLAGS += -C $(HOST_BUILD_DIR)
     44 
     45 # Select 32 or 64 bit Makefile for host build depending on host architecture
     46 HOST_MAKE_FLAGS += -f src/makefiles/linux_$(if $(shell uname -m | grep 64),64,32)bit.mak
     47 
     48 # Prevent calling upstream configure
     49 define Host/Configure
     50 endef
     51 
     52 define Host/Compile
     53 	# Prepare fake readline headers and library
     54 	mkdir -p $(HOST_BUILD_DIR)/src/readline
     55 	touch $(HOST_BUILD_DIR)/src/readline/readline.h
     56 	touch $(HOST_BUILD_DIR)/src/readline/history.h
     57 	ar rcs $(HOST_BUILD_DIR)/src/readline/libreadline.a
     58 
     59 	# Build hamcorebuilder using host compiler and let it generate
     60 	# the hamcore.se2 archive file
     61 	CC="$(HOSTCC)" $(MAKE) $(HOST_MAKE_FLAGS) \
     62 		src/bin/BuiltHamcoreFiles/unix/hamcore.se2
     63 endef
     64 
     65 define Host/Install
     66 	$(INSTALL_DIR) $(STAGING_DIR_HOST)/share/softethervpn
     67 	$(INSTALL_DATA) $(HOST_BUILD_DIR)/src/bin/BuiltHamcoreFiles/unix/hamcore.se2 $(HAMCORE_SE2)
     68 endef
     69 
     70 
     71 # Tune CFLAGS for target
     72 TARGET_CFLAGS += \
     73 	$(if $(CONFIG_OPENSSL_WITH_SSL3),,-DSSL_OP_NO_SSLv3) \
     74 	$(if $(filter mips mipsel,$(ARCH)),-minterlink-mips16)
     75 
     76 # Select 32 or 64 bit Makefile for target build depending on 64bit config symbol
     77 MAKE_FLAGS += \
     78 	-f src/makefiles/linux_$(if $(CONFIG_ARCH_64BIT),64,32)bit.mak
     79 
     80 # Map nonstandard CCFLAGS variable to standard TARGET_CFLAGS
     81 MAKE_VARS += \
     82 	CCFLAGS="$(TARGET_CFLAGS)"
     83 
     84 define Build/Configure
     85 	# Fetch prebuilt hamcore.se2 from staging dir
     86 	$(INSTALL_DIR) $(PKG_BUILD_DIR)/src/bin/BuiltHamcoreFiles/unix
     87 	$(CP) $(HAMCORE_SE2) $(PKG_BUILD_DIR)/src/bin/BuiltHamcoreFiles/unix/hamcore.se2
     88 
     89 	# Portably set hamcore.se2 modtime to one day in the future
     90 	# to prevent rebuilding it
     91 	perl -e 'utime(time() + 86400, time() + 86400, $$$$ARGV[0])' \
     92 		$(PKG_BUILD_DIR)/src/bin/BuiltHamcoreFiles/unix/hamcore.se2
     93 endef
     94 
     95 
     96 define Package/softethervpn
     97   SECTION:=net
     98   CATEGORY:=Network
     99   SUBMENU:=VPN
    100   DEPENDS:=+libpthread +librt +libreadline +libopenssl +libncurses +kmod-tun +zlib $(ICONV_DEPENDS)
    101   TITLE:=Free Cross-platform Multi-protocol VPN server and client
    102   URL:=http://www.softether.org/
    103   MAINTAINER:=Federico Di Marco <fededim@gmail.com>
    104 endef
    105 
    106 define Package/softethervpn/description
    107 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
    108 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
    109 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,
    110 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,
    111 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
    112 has very fast throughput, low latency and firewall resistance.
    113 endef
    114 
    115 
    116 define Package/softethervpn/conffiles
    117 /usr/libexec/softethervpn/vpn_server.config
    118 /usr/libexec/softethervpn/vpn_client.config
    119 /usr/libexec/softethervpn/vpn_bridge.config
    120 /usr/libexec/softethervpn/lang.config
    121 endef
    122 
    123 define Package/softethervpn/install
    124 	$(INSTALL_DIR) $(1)/usr/libexec/softethervpn
    125 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpnserver/vpnserver $(1)/usr/libexec/softethervpn
    126 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpnserver/hamcore.se2 $(1)/usr/libexec/softethervpn
    127 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpnclient/vpnclient $(1)/usr/libexec/softethervpn
    128 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpnbridge/vpnbridge $(1)/usr/libexec/softethervpn
    129 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vpncmd/vpncmd $(1)/usr/libexec/softethervpn
    130 	$(INSTALL_BIN) files/launcher.sh $(1)/usr/libexec/softethervpn
    131 
    132 	$(INSTALL_DATA) files/dummy $(1)/usr/libexec/softethervpn/vpn_server.config
    133 	$(INSTALL_DATA) files/dummy $(1)/usr/libexec/softethervpn/vpn_bridge.config
    134 	$(INSTALL_DATA) files/dummy $(1)/usr/libexec/softethervpn/vpn_client.config
    135 	$(INSTALL_DATA) files/dummy $(1)/usr/libexec/softethervpn/lang.config
    136 
    137 	$(INSTALL_DIR) $(1)/usr/bin
    138 
    139 	#$(LN) ../../usr/libexec/softethervpn/launcher.sh $(1)/usr/bin/vpnserver
    140 	#$(LN) ../../usr/libexec/softethervpn/launcher.sh $(1)/usr/bin/vpnclient
    141 	#$(LN) ../../usr/libexec/softethervpn/launcher.sh $(1)/usr/bin/vpnbridge
    142 	$(LN) ../../usr/libexec/softethervpn/launcher.sh $(1)/usr/bin/vpncmd
    143 
    144 	$(INSTALL_DIR) $(1)/etc
    145 	$(INSTALL_DIR) $(1)/etc/init.d
    146 	$(INSTALL_BIN) files/vpnserver.init $(1)/etc/init.d/softethervpnserver
    147 	$(INSTALL_BIN) files/vpnbridge.init $(1)/etc/init.d/softethervpnbridge
    148 	$(INSTALL_BIN) files/vpnclient.init $(1)/etc/init.d/softethervpnclient
    149 endef
    150 
    151 $(eval $(call BuildPackage,softethervpn))
    152 $(eval $(call HostBuild))