From 55ae2ecc7a92c68a9cb489fd8e53fb784cf96c9f Mon Sep 17 00:00:00 2001 From: LEAN-ESX Date: Sat, 29 Feb 2020 22:49:03 -0800 Subject: [PATCH] kcptun: update go version --- package/lean/kcptun/Makefile | 110 +++++++++--------- package/network/utils/linux-atm/Makefile | 2 +- .../patches/400-portability_fixes.patch | 16 ++- .../510-remove-LINUX_NETDEVICE-hack.patch | 52 +++++++++ .../linux-atm/patches/700-musl-include.patch | 30 +++++ 5 files changed, 150 insertions(+), 60 deletions(-) create mode 100644 package/network/utils/linux-atm/patches/510-remove-LINUX_NETDEVICE-hack.patch create mode 100644 package/network/utils/linux-atm/patches/700-musl-include.patch diff --git a/package/lean/kcptun/Makefile b/package/lean/kcptun/Makefile index 10f7c08b9..d7a912c6f 100644 --- a/package/lean/kcptun/Makefile +++ b/package/lean/kcptun/Makefile @@ -1,71 +1,65 @@ # -# Copyright (C) 2015-2016 OpenWrt.org +# Copyright (C) 2019 Xingwang Liao # -# This is free software, licensed under the GNU General Public License v3. +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. # include $(TOPDIR)/rules.mk -ifeq ($(ARCH),x86_64) - PKG_ARCH_KCPTUN:=amd64 -endif -ifeq ($(ARCH),mipsel) - PKG_ARCH_KCPTUN:=mipsle -endif -ifeq ($(ARCH),mips) - PKG_ARCH_KCPTUN:=mips -endif -ifeq ($(ARCH),i386) - PKG_ARCH_KCPTUN:=386 -endif -ifeq ($(ARCH),arm) - PKG_ARCH_KCPTUN:=arm7 -endif -ifeq ($(BOARD),bcm53xx) - PKG_ARCH_KCPTUN:=arm6 -endif -ifeq ($(BOARD),kirkwood) - PKG_ARCH_KCPTUN:=arm5 -endif -ifeq ($(ARCH),aarch64) - PKG_ARCH_KCPTUN:=arm64 -endif - -PKG_NAME:=kcptun-client +PKG_NAME:=kcptun PKG_VERSION:=20200226 -PKG_RELEASE:=2 -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE:=kcptun-linux-$(PKG_ARCH_KCPTUN)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://github.com/xtaci/kcptun/releases/download/v$(PKG_VERSION) -PKG_HASH:=skip +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/xtaci/kcptun/tar.gz/v$(PKG_VERSION)? +PKG_HASH:=3d3c342b6073a199f3daa926f1b1d221d50d385fd6905bf00286b0f874439822 + +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE.md +PKG_MAINTAINER:=Xingwang Liao + +PKG_BUILD_DEPENDS:=golang/host +PKG_BUILD_PARALLEL:=1 +PKG_USE_MIPS16:=0 + +GO_PKG:=github.com/xtaci/kcptun + +GO_PKG_LDFLAGS:=-s -w -X 'main.VERSION=$(PKG_VERSION)-$(PKG_RELEASE) for OpenWrt' + +# Can't use GO_PKG_LDFLAGS_X to define X args with space include $(INCLUDE_DIR)/package.mk +include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk -define Package/$(PKG_NAME) - SECTION:=net - CATEGORY:=Network - TITLE:=Kcptun is a cross-platform proxy software - DEPENDS:= - URL:=https://github.com/xtaci/kcptun +define Package/kcptun/Default + define Package/kcptun-$(1) + SECTION:=net + CATEGORY:=Network + SUBMENU:=Web Servers/Proxies + DEPENDS:=$$(GO_ARCH_DEPENDS) + TITLE:=Simple UDP Tunnel Based On KCP ($1) + URL:=https://github.com/xtaci/kcptun + endef + + define Package/kcptun-$(1)/description + A Stable & Secure Tunnel Based On KCP with N:M Multiplexing. + + This package contains the kcptun $(1). + endef + + define Package/kcptun-$(1)/install + $$(call GoPackage/Package/Install/Bin,$$(PKG_INSTALL_DIR)) + + $$(INSTALL_DIR) $$(1)/usr/bin + $$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)/usr/bin/kcptun-$(1) + endef endef -define Package/$(PKG_NAME)/description - Kcptun is a Fast and Reliable ARQ Protocol tunnel -endef +KCPTUN_COMPONENTS:=client server -define Build/Prepare - tar -xzvf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) -endef - -define Build/Configure -endef - -define Build/Compile -endef - -define Package/$(PKG_NAME)/install - $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/client_linux_$(PKG_ARCH_KCPTUN) $(1)/usr/bin/kcptun-client -endef - -$(eval $(call BuildPackage,$(PKG_NAME))) +$(foreach component,$(KCPTUN_COMPONENTS), \ + $(eval $(call Package/kcptun/Default,$(component))) \ + $(eval $(call GoBinPackage,kcptun-$(component))) \ + $(eval $(call BuildPackage,kcptun-$(component))) \ +) \ No newline at end of file diff --git a/package/network/utils/linux-atm/Makefile b/package/network/utils/linux-atm/Makefile index f2ad888e4..c74febcbb 100644 --- a/package/network/utils/linux-atm/Makefile +++ b/package/network/utils/linux-atm/Makefile @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=linux-atm PKG_VERSION:=2.5.2 -PKG_RELEASE:=6 +PKG_RELEASE:=7 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/$(PKG_NAME) diff --git a/package/network/utils/linux-atm/patches/400-portability_fixes.patch b/package/network/utils/linux-atm/patches/400-portability_fixes.patch index 9fe3e1fae..41425eed1 100644 --- a/package/network/utils/linux-atm/patches/400-portability_fixes.patch +++ b/package/network/utils/linux-atm/patches/400-portability_fixes.patch @@ -34,7 +34,21 @@ #include --- a/src/sigd/atmsigd.c +++ b/src/sigd/atmsigd.c -@@ -517,7 +517,7 @@ int main(int argc,char **argv) +@@ -283,12 +283,11 @@ static void setup_signals(void) + /* ------------------------------- main ... ------------------------------- */ + + +-static void trace_on_exit(int status,void *dummy) ++static void trace_on_exit(void) + { + char path[PATH_MAX+1]; + FILE *file; + +- if (!status) return; + if (!dump_dir) file = stderr; + else { + sprintf(path,"atmsigd.%d.trace.exit",getpid()); +@@ -517,7 +516,7 @@ int main(int argc,char **argv) exit(0); } } diff --git a/package/network/utils/linux-atm/patches/510-remove-LINUX_NETDEVICE-hack.patch b/package/network/utils/linux-atm/patches/510-remove-LINUX_NETDEVICE-hack.patch new file mode 100644 index 000000000..d76ec1eaf --- /dev/null +++ b/package/network/utils/linux-atm/patches/510-remove-LINUX_NETDEVICE-hack.patch @@ -0,0 +1,52 @@ +This fixes the following compile problem with kernel 4.20: + +In file included from arp.c:20:0: +include/linux/if_arp.h:121:16: error: 'IFNAMSIZ' undeclared here (not in a function) + char arp_dev[IFNAMSIZ]; + ^~~~~~~~ +make[7]: *** [Makefile:459: arp.o] Error 1 + +This is caused by commit 6a12709da354 ("net: if_arp: use define instead +of hard-coded value") in the upstream Linux kernel which is integrated +in Linux 4.20. + +--- a/src/oamd/io.c ++++ b/src/oamd/io.c +@@ -20,7 +20,6 @@ + #include + #include + #include +-#define _LINUX_NETDEVICE_H /* glibc2 */ + #include + #include + +--- a/src/arpd/itf.c ++++ b/src/arpd/itf.c +@@ -12,7 +12,6 @@ + #include + #include + #include +-#define _LINUX_NETDEVICE_H /* glibc2 */ + #include + #include + +--- a/src/arpd/io.c ++++ b/src/arpd/io.c +@@ -21,7 +21,6 @@ + #include + #include /* for CLIP_DEFAULT_IDLETIMER */ + #include +-#define _LINUX_NETDEVICE_H /* glibc2 */ + #include + #include + +--- a/src/arpd/arp.c ++++ b/src/arpd/arp.c +@@ -15,7 +15,6 @@ + #include + #include /* for linux/if_arp.h */ + #include /* for ntohs, etc. */ +-#define _LINUX_NETDEVICE_H /* very crude hack for glibc2 */ + #include + #include + #include diff --git a/package/network/utils/linux-atm/patches/700-musl-include.patch b/package/network/utils/linux-atm/patches/700-musl-include.patch new file mode 100644 index 000000000..2b2268d8a --- /dev/null +++ b/package/network/utils/linux-atm/patches/700-musl-include.patch @@ -0,0 +1,30 @@ +--- a/src/include/atmd.h ++++ b/src/include/atmd.h +@@ -10,6 +10,7 @@ + + #include + #include ++#include + #include + #include + +--- a/src/lib/unix.c ++++ b/src/lib/unix.c +@@ -8,6 +8,7 @@ + + #include + #include ++#include + #include + #include + #include +--- a/src/sigd/kernel.c ++++ b/src/sigd/kernel.c +@@ -8,6 +8,7 @@ + + #include + #include ++#include + #include + #include +