kcptun: update go version

This commit is contained in:
LEAN-ESX 2020-02-29 22:49:03 -08:00
parent 408141f81f
commit 55ae2ecc7a
5 changed files with 150 additions and 60 deletions

View File

@ -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 <kuoruan@gmail.com>
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))) \
)

View File

@ -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)

View File

@ -34,7 +34,21 @@
#include <linux/atmioc.h>
--- 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);
}
}

View File

@ -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 <net/if.h>
#include <netinet/in.h>
#include <atm.h>
-#define _LINUX_NETDEVICE_H /* glibc2 */
#include <linux/types.h>
#include <linux/if_arp.h>
--- a/src/arpd/itf.c
+++ b/src/arpd/itf.c
@@ -12,7 +12,6 @@
#include <sys/types.h>
#include <linux/atmclip.h>
#include <sys/socket.h>
-#define _LINUX_NETDEVICE_H /* glibc2 */
#include <linux/types.h>
#include <linux/if_arp.h>
--- a/src/arpd/io.c
+++ b/src/arpd/io.c
@@ -21,7 +21,6 @@
#include <atm.h>
#include <linux/atmclip.h> /* for CLIP_DEFAULT_IDLETIMER */
#include <linux/atmarp.h>
-#define _LINUX_NETDEVICE_H /* glibc2 */
#include <linux/types.h>
#include <linux/if_arp.h>
--- a/src/arpd/arp.c
+++ b/src/arpd/arp.c
@@ -15,7 +15,6 @@
#include <sys/types.h>
#include <sys/socket.h> /* for linux/if_arp.h */
#include <netinet/in.h> /* for ntohs, etc. */
-#define _LINUX_NETDEVICE_H /* very crude hack for glibc2 */
#include <linux/types.h>
#include <linux/if_arp.h>
#include <linux/if_ether.h>

View File

@ -0,0 +1,30 @@
--- a/src/include/atmd.h
+++ b/src/include/atmd.h
@@ -10,6 +10,7 @@
#include <stdint.h>
#include <stdio.h>
+#include <string.h>
#include <sys/types.h>
#include <sys/time.h>
--- a/src/lib/unix.c
+++ b/src/lib/unix.c
@@ -8,6 +8,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
--- a/src/sigd/kernel.c
+++ b/src/sigd/kernel.c
@@ -8,6 +8,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <errno.h>
#include <assert.h>