1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Update golang

This commit is contained in:
Ycarus (Yannick Chabanois) 2020-10-09 13:15:13 +02:00
parent 66c06647c9
commit e0f08f96f5
9 changed files with 1061 additions and 328 deletions

View file

@ -1,5 +1,5 @@
#
# Copyright (C) 2018 Jeffery To
# Copyright (C) 2018, 2020 Jeffery To
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -24,8 +24,8 @@ endef
# $(4) additional environment variables (optional)
define GoCompiler/Default/Make
( \
cd $(1)/src ; \
$(if $(2),GOROOT_FINAL=$(2)/lib/go-$(3)) \
cd "$(1)/src" ; \
$(if $(2),GOROOT_FINAL="$(2)/lib/go-$(3)") \
$(4) \
$(BASH) make.bash --no-banner ; \
)
@ -34,8 +34,8 @@ 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)
$(INSTALL_DIR) "$(1)/lib/go-$(2)"
$(INSTALL_DIR) "$(1)/share/go-$(2)"
endef
# $(1) source go root
@ -43,48 +43,49 @@ endef
# $(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)/
$(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
# $(5) install suffix (optional)
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)/
$(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)/ ; \
for file in AUTHORS CONTRIBUTING.md CONTRIBUTORS LICENSE PATENTS README.md SECURITY.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
$(INSTALL_DIR) "$(2)/lib/go-$(3)/bin"
ifeq ($(4),$(GO_HOST_OS_ARCH))
$(INSTALL_BIN) -p $(1)/bin/* $(2)/lib/go-$(3)/bin/
$(INSTALL_BIN) -p "$(1)/bin"/* "$(2)/lib/go-$(3)/bin/"
else
$(INSTALL_BIN) -p $(1)/bin/$(4)/* $(2)/lib/go-$(3)/bin/
$(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"
$(CP) "$(1)/pkg/$(4)$(if $(5),_$(5))" "$(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)/
$(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
$(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
@ -110,29 +111,29 @@ define GoCompiler/Default/Install/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' \) \
"$(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/ ; \
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)
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
rm -f "$(1)/bin/go"
rm -f "$(1)/bin/gofmt"
endef
@ -141,6 +142,7 @@ endef
# $(3) destination prefix
# $(4) go version id
# $(5) GOOS_GOARCH
# $(6) install suffix (optional)
define GoCompiler/AddProfile
# $$(1) valid GOOS_GOARCH combinations
@ -155,7 +157,7 @@ define GoCompiler/AddProfile
# $$(1) override install prefix (optional)
define GoCompiler/$(1)/Install/Bin
$$(call GoCompiler/Default/Install/Bin,$(2),$$(or $$(1),$(3)),$(4),$(5))
$$(call GoCompiler/Default/Install/Bin,$(2),$$(or $$(1),$(3)),$(4),$(5),$(6))
endef
# $$(1) override install prefix (optional)