Skip to content

Commit

Permalink
Add shadowsocks v2ray plugin from source
Browse files Browse the repository at this point in the history
  • Loading branch information
Ysurac committed Jan 30, 2019
1 parent 0fdab60 commit 4b31a55
Show file tree
Hide file tree
Showing 16 changed files with 1,288 additions and 66 deletions.
43 changes: 43 additions & 0 deletions golang-protobuf/Makefile
@@ -0,0 +1,43 @@
#
# Copyright (C) 2019 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=golang-protobuf
PKG_RELEASE:=1

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/golang/protobuf.git
PKG_SOURCE_VERSION:=347cf4a86c1cb8d262994d8ef5924d4576c5b331
PKG_SOURCE_DATE:=20190109

PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE

PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1

GO_PKG:=github.com/golang/protobuf
GO_PKG_SOURCE_ONLY:=1

include $(INCLUDE_DIR)/package.mk
include ../golang/golang-package.mk

define Package/golang-protobuf-dev
$(call GoPackage/GoSubMenu)
TITLE:=Go support for Google protocol buffers
URL:=https://github.com/golang/protobuf
DEPENDS:=$(GO_ARCH_DEPENDS) +protobuf
PKGARCH:=all
endef

define Package/golang-protobuf-dev/description
Go support for Google protocol buffers
endef

$(eval $(call GoSrcPackage,golang-protobuf-dev))
$(eval $(call BuildPackage,golang-protobuf-dev))
186 changes: 186 additions & 0 deletions golang/golang-compiler.mk
@@ -0,0 +1,186 @@
#
# Copyright (C) 2018 Jeffery To
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

ifeq ($(origin GO_INCLUDE_DIR),undefined)
GO_INCLUDE_DIR:=$(dir $(lastword $(MAKEFILE_LIST)))
endif

include $(GO_INCLUDE_DIR)/golang-values.mk


# $(1) valid GOOS_GOARCH combinations
# $(2) go version id
define GoCompiler/Default/CheckHost
$(if $(filter $(GO_HOST_OS_ARCH),$(1)),,$(error go-$(2) cannot be installed on $(GO_HOST_OS)/$(GO_HOST_ARCH)))
endef

# $(1) source go root
# $(2) destination prefix
# $(3) go version id
# $(4) additional environment variables (optional)
define GoCompiler/Default/Make
( \
cd $(1)/src ; \
$(if $(2),GOROOT_FINAL=$(2)/lib/go-$(3)) \
$(4) \
$(BASH) make.bash --no-banner ; \
)
endef

# $(1) destination prefix
# $(2) go version id
define GoCompiler/Default/Install/make-dirs
$(INSTALL_DIR) $(1)/lib/go-$(2)
$(INSTALL_DIR) $(1)/share/go-$(2)
endef

# $(1) source go root
# $(2) destination prefix
# $(3) go version id
# $(4) file/directory name
define GoCompiler/Default/Install/install-share-data
$(CP) $(1)/$(4) $(2)/share/go-$(3)/
$(LN) ../../share/go-$(3)/$(4) $(2)/lib/go-$(3)/
endef

# $(1) source go root
# $(2) destination prefix
# $(3) go version id
# $(4) GOOS_GOARCH
define GoCompiler/Default/Install/Bin
$(call GoCompiler/Default/Install/make-dirs,$(2),$(3))

$(call GoCompiler/Default/Install/install-share-data,$(1),$(2),$(3),api)

$(INSTALL_DATA) -p $(1)/VERSION $(2)/lib/go-$(3)/

for file in AUTHORS CONTRIBUTING.md CONTRIBUTORS LICENSE PATENTS README README.md; do \
if [ -f $(1)/$$$$file ]; then \
$(INSTALL_DATA) -p $(1)/$$$$file $(2)/share/go-$(3)/ ; \
fi ; \
done

$(INSTALL_DIR) $(2)/lib/go-$(3)/bin

ifeq ($(4),$(GO_HOST_OS_ARCH))
$(INSTALL_BIN) -p $(1)/bin/* $(2)/lib/go-$(3)/bin/
else
$(INSTALL_BIN) -p $(1)/bin/$(4)/* $(2)/lib/go-$(3)/bin/
endif

$(INSTALL_DIR) $(2)/lib/go-$(3)/pkg
$(CP) $(1)/pkg/$(4) $(2)/lib/go-$(3)/pkg/

$(INSTALL_DIR) $(2)/lib/go-$(3)/pkg/tool/$(4)
$(INSTALL_BIN) -p $(1)/pkg/tool/$(4)/* $(2)/lib/go-$(3)/pkg/tool/$(4)/
endef

# $(1) destination prefix
# $(2) go version id
define GoCompiler/Default/Install/BinLinks
$(INSTALL_DIR) $(1)/bin
$(LN) ../lib/go-$(2)/bin/go $(1)/bin/go
$(LN) ../lib/go-$(2)/bin/gofmt $(1)/bin/gofmt
endef

# $(1) source go root
# $(2) destination prefix
# $(3) go version id
define GoCompiler/Default/Install/Doc
$(call GoCompiler/Default/Install/make-dirs,$(2),$(3))

$(call GoCompiler/Default/Install/install-share-data,$(1),$(2),$(3),doc)
$(call GoCompiler/Default/Install/install-share-data,$(1),$(2),$(3),favicon.ico)
$(call GoCompiler/Default/Install/install-share-data,$(1),$(2),$(3),robots.txt)
endef

# $(1) source go root
# $(2) destination prefix
# $(3) go version id
define GoCompiler/Default/Install/Src
$(call GoCompiler/Default/Install/make-dirs,$(2),$(3))

$(call GoCompiler/Default/Install/install-share-data,$(1),$(2),$(3),lib)
$(call GoCompiler/Default/Install/install-share-data,$(1),$(2),$(3),misc)
$(call GoCompiler/Default/Install/install-share-data,$(1),$(2),$(3),src)
$(call GoCompiler/Default/Install/install-share-data,$(1),$(2),$(3),test)

$(FIND) \
$(2)/share/go-$(3)/src/ \
\! -type d -a \( -name '*.bat' -o -name '*.rc' \) \
-delete

if [ -d $(1)/pkg/include ]; then \
$(INSTALL_DIR) $(2)/lib/go-$(3)/pkg ; \
$(INSTALL_DIR) $(2)/share/go-$(3)/pkg ; \
$(CP) $(1)/pkg/include $(2)/share/go-$(3)/pkg/ ; \
$(LN) ../../../share/go-$(3)/pkg/include $(2)/lib/go-$(3)/pkg/ ; \
fi
endef

# $(1) destination prefix
# $(2) go version id
define GoCompiler/Default/Uninstall
rm -rf $(1)/lib/go-$(2)
rm -rf $(1)/share/go-$(2)
endef

# $(1) destination prefix
define GoCompiler/Default/Uninstall/BinLinks
rm -f $(1)/bin/go
rm -f $(1)/bin/gofmt
endef


# $(1) profile name
# $(2) source go root
# $(3) destination prefix
# $(4) go version id
# $(5) GOOS_GOARCH
define GoCompiler/AddProfile

# $$(1) valid GOOS_GOARCH combinations
define GoCompiler/$(1)/CheckHost
$$(call GoCompiler/Default/CheckHost,$$(1),$(4))
endef

# $$(1) additional environment variables (optional)
define GoCompiler/$(1)/Make
$$(call GoCompiler/Default/Make,$(2),$(3),$(4),$$(1))
endef

# $$(1) override install prefix (optional)
define GoCompiler/$(1)/Install/Bin
$$(call GoCompiler/Default/Install/Bin,$(2),$$(or $$(1),$(3)),$(4),$(5))
endef

# $$(1) override install prefix (optional)
define GoCompiler/$(1)/Install/BinLinks
$$(call GoCompiler/Default/Install/BinLinks,$$(or $$(1),$(3)),$(4))
endef

# $$(1) override install prefix (optional)
define GoCompiler/$(1)/Install/Doc
$$(call GoCompiler/Default/Install/Doc,$(2),$$(or $$(1),$(3)),$(4))
endef

# $$(1) override install prefix (optional)
define GoCompiler/$(1)/Install/Src
$$(call GoCompiler/Default/Install/Src,$(2),$$(or $$(1),$(3)),$(4))
endef

# $$(1) override install prefix (optional)
define GoCompiler/$(1)/Uninstall
$$(call GoCompiler/Default/Uninstall,$$(or $$(1),$(3)),$(4))
endef

# $$(1) override install prefix (optional)
define GoCompiler/$(1)/Uninstall/BinLinks
$$(call GoCompiler/Default/Uninstall/BinLinks,$$(or $$(1),$(3)))
endef

endef
47 changes: 47 additions & 0 deletions golang/golang-golang-x-crypto/Makefile
@@ -0,0 +1,47 @@
#
# Copyright (C) 2018 Jeffery To
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=golang-golang-x-crypto
PKG_RELEASE:=1

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/golang/crypto.git
PKG_SOURCE_VERSION:=a49355c7e3f8fe157a85be2f77e6e269a0f89602
PKG_SOURCE_DATE:=20180620
PKG_MIRROR_HASH:=80b16b203736ac56883d0610edbc5981eb78f15b7b35d11b5ca639f7c3814214

PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>

PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1

GO_PKG:=golang.org/x/crypto
GO_PKG_SOURCE_ONLY:=1

include $(INCLUDE_DIR)/package.mk
include ../golang-package.mk

define Package/golang-golang-x-crypto-dev
$(call GoPackage/GoSubMenu)
TITLE:=Go supplementary cryptography libraries
URL:=https://godoc.org/golang.org/x/crypto
DEPENDS:=$(GO_ARCH_DEPENDS) \
+golang-golang-x-net-dev \
+golang-golang-x-sys-dev
PKGARCH:=all
endef

define Package/golang-golang-x-crypto-dev/description
Supplementary Go cryptography libraries.
endef

$(eval $(call GoSrcPackage,golang-golang-x-crypto-dev))
$(eval $(call BuildPackage,golang-golang-x-crypto-dev))
58 changes: 58 additions & 0 deletions golang/golang-golang-x-net/Makefile
@@ -0,0 +1,58 @@
#
# Copyright (C) 2018 Jeffery To
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=golang-golang-x-net
PKG_RELEASE:=1

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/golang/net.git
PKG_SOURCE_VERSION:=afe8f62b1d6bbd81f31868121a50b06d8188e1f9
PKG_SOURCE_DATE:=20180620
PKG_MIRROR_HASH:=9a8bb3bf21ea60121d7e87f1bd1af9effbdcd908f758be99457653172d13eb1e

PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>

PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1

GO_PKG:=golang.org/x/net
# exclude http2/h2i to break circular dependency with golang-golang-x-crypto-dev
# since there are no other binaries, can skip compilation
GO_PKG_SOURCE_ONLY:=1

include $(INCLUDE_DIR)/package.mk
include ../golang-package.mk

define Package/golang-golang-x-net-dev
$(call GoPackage/GoSubMenu)
TITLE:=Go supplementary network libraries
URL:=https://godoc.org/golang.org/x/net
DEPENDS:=$(GO_ARCH_DEPENDS) +golang-golang-x-text-dev
PKGARCH:=all
endef

define Package/golang-golang-x-net-dev/description
Supplementary Go networking libraries.
endef

# http2/testdata/draft-ietf-httpbis-http2.xml is a non-free document
# http2/z_spec_test.go uses http2/testdata/draft-ietf-httpbis-http2.xml
define Package/golang-golang-x-net-dev/install
$(call GoPackage/Package/Install/Src,$(1))

rm -f $(1)$(GO_PKG_PATH)/src/$(GO_PKG)/http2/testdata/draft-ietf-httpbis-http2.xml
rmdir $(1)$(GO_PKG_PATH)/src/$(GO_PKG)/http2/testdata/

rm -f $(1)$(GO_PKG_PATH)/src/$(GO_PKG)/http2/z_spec_test.go
endef

$(eval $(call GoSrcPackage,golang-golang-x-net-dev))
$(eval $(call BuildPackage,golang-golang-x-net-dev))
46 changes: 46 additions & 0 deletions golang/golang-golang-x-sys/Makefile
@@ -0,0 +1,46 @@
#
# Copyright (C) 2018 Jeffery To
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=golang-golang-x-sys
PKG_RELEASE:=1

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/golang/sys.git
PKG_SOURCE_VERSION:=63fc586f45fe72d95d5240a5d5eb95e6503907d3
PKG_SOURCE_DATE:=20180621
PKG_MIRROR_HASH:=3afe7936fb9fb291ef9b9cfa88f51576cdc19abbd34240232ce284958ac7dbaf

PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>

PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1

GO_PKG:=golang.org/x/sys
GO_PKG_SOURCE_ONLY:=1

include $(INCLUDE_DIR)/package.mk
include ../golang-package.mk

define Package/golang-golang-x-sys-dev
$(call GoPackage/GoSubMenu)
TITLE:=Go packages for interaction with the OS
URL:=https://godoc.org/golang.org/x/sys
DEPENDS:=$(GO_ARCH_DEPENDS)
PKGARCH:=all
endef

define Package/golang-golang-x-sys-dev/description
Supplementary Go packages for low-level interactions with the operating
system.
endef

$(eval $(call GoSrcPackage,golang-golang-x-sys-dev))
$(eval $(call BuildPackage,golang-golang-x-sys-dev))

0 comments on commit 4b31a55

Please sign in to comment.