From 823f658c771af8b6ff07a3581a2c63efc6a15ad2 Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Tue, 24 Dec 2019 17:59:37 +0300 Subject: Go: linking against libunit. --- auto/modules/go | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'auto/modules/go') diff --git a/auto/modules/go b/auto/modules/go index 51b5979d..4646684e 100644 --- a/auto/modules/go +++ b/auto/modules/go @@ -74,6 +74,8 @@ fi NXT_GO_PATH=${NXT_GO_PATH=`${NXT_GO} env GOPATH`} NXT_GO_PATH=${NXT_GO_PATH:-`pwd`/${NXT_GO}} +NXT_GO_PKG=nginx/unit + $echo " + Go package path: \"${NXT_GO_PATH}\"" if grep ^$NXT_GO: $NXT_MAKEFILE 2>&1 > /dev/null; then @@ -88,7 +90,6 @@ cat << END >> $NXT_MAKEFILE .PHONY: ${NXT_GO} .PHONY: ${NXT_GO}-install .PHONY: ${NXT_GO}-install-src -.PHONY: ${NXT_GO}-install-build .PHONY: ${NXT_GO}-uninstall GOPATH = $NXT_GO_PATH @@ -101,23 +102,30 @@ install: ${NXT_GO}-install ${NXT_GO}: -${NXT_GO}-install: ${NXT_GO}-install-build +${NXT_GO}-install: ${NXT_GO}-install-src ${NXT_GO}-install-env + GOPATH=\$(DESTDIR)\$(GOPATH) ${NXT_GO} build ${NXT_GO_PKG} + +${NXT_GO}-install-src: + install -d \$(DESTDIR)\$(NXT_GO_DST)/src/${NXT_GO_PKG} + install -p -m644 ./src/go/unit/* \$(DESTDIR)\$(NXT_GO_DST)/src/${NXT_GO_PKG}/ -${NXT_GO}-install-src: ${NXT_VERSION_H} - install -d \$(DESTDIR)\$(NXT_GO_DST)/src/nginx/unit - install -p -m644 ./src/*.h ./build/*.h ./src/go/unit/* \ - ./src/nxt_unit.c ./src/nxt_lvlhsh.c ./src/nxt_murmur_hash.c \ - ./src/nxt_websocket.c \ - \$(DESTDIR)\$(NXT_GO_DST)/src/nginx/unit/ +${NXT_GO}-install-env: \$(DESTDIR)\$(NXT_GO_DST)/src/${NXT_GO_PKG}/env.go \ + ${NXT_VERSION_H} ${NXT_BUILD_DIR}/${NXT_LIB_UNIT_STATIC} -${NXT_GO}-install-build: ${NXT_GO}-install-src - GOPATH=\$(DESTDIR)\$(GOPATH) ${NXT_GO} build nginx/unit +\$(DESTDIR)\$(NXT_GO_DST)/src/${NXT_GO_PKG}/env.go: + install -d \$(DESTDIR)\$(NXT_GO_DST)/src/${NXT_GO_PKG} + $echo "package unit" > \$@ + $echo "/*" >> \$@ + $echo "#cgo CPPFLAGS: -I${PWD}/src -I${PWD}/${NXT_BUILD_DIR}" >> \$@ + $echo "#cgo LDFLAGS: -L${PWD}/${NXT_BUILD_DIR}" >> \$@ + $echo "*/" >> \$@ + $echo 'import "C"' >> \$@ uninstall: ${NXT_GO}-uninstall ${NXT_GO}-uninstall: - rm -rf \$(DESTDIR)\$(NXT_GO_DST)/src/nginx/unit - rm -rf \$(DESTDIR)\$(NXT_GO_DST)/pkg/\$(GOOS)_\$(GOARCH)/nginx/unit + rm -rf \$(DESTDIR)\$(NXT_GO_DST)/src/${NXT_GO_PKG} + rm -rf \$(DESTDIR)\$(NXT_GO_DST)/pkg/\$(GOOS)_\$(GOARCH)/${NXT_GO_PKG} END -- cgit From a427ecd4c547958079cce2dae13060b2d60aa4d4 Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Tue, 24 Dec 2019 17:59:48 +0300 Subject: Go: installing go module for tests into build directory. --- auto/modules/go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'auto/modules/go') diff --git a/auto/modules/go b/auto/modules/go index 4646684e..fad31036 100644 --- a/auto/modules/go +++ b/auto/modules/go @@ -72,7 +72,7 @@ fi NXT_GO_PATH=${NXT_GO_PATH=`${NXT_GO} env GOPATH`} -NXT_GO_PATH=${NXT_GO_PATH:-`pwd`/${NXT_GO}} +NXT_GO_PATH=${NXT_GO_PATH:-${PWD}/${NXT_BUILD_DIR}/${NXT_GO}} NXT_GO_PKG=nginx/unit -- cgit From f5a2984acf9a562b6b1eb45a21d9af2be2415659 Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Tue, 24 Dec 2019 17:59:52 +0300 Subject: Go: moving source files to the root of the project. This patch includes packaging changes related to files move. --- auto/modules/go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'auto/modules/go') diff --git a/auto/modules/go b/auto/modules/go index fad31036..a6ea8bc8 100644 --- a/auto/modules/go +++ b/auto/modules/go @@ -107,7 +107,7 @@ ${NXT_GO}-install: ${NXT_GO}-install-src ${NXT_GO}-install-env ${NXT_GO}-install-src: install -d \$(DESTDIR)\$(NXT_GO_DST)/src/${NXT_GO_PKG} - install -p -m644 ./src/go/unit/* \$(DESTDIR)\$(NXT_GO_DST)/src/${NXT_GO_PKG}/ + install -p -m644 ./go/* \$(DESTDIR)\$(NXT_GO_DST)/src/${NXT_GO_PKG}/ ${NXT_GO}-install-env: \$(DESTDIR)\$(NXT_GO_DST)/src/${NXT_GO_PKG}/env.go \ ${NXT_VERSION_H} ${NXT_BUILD_DIR}/${NXT_LIB_UNIT_STATIC} -- cgit From 693a458b4ea87b7b387bd9d094de2b42be7ecdbd Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Wed, 25 Dec 2019 20:00:32 +0300 Subject: Go: changing import name for "unit.nginx.org/go". This patch includes packaging changes - update unit-go installation directory. --- auto/modules/go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'auto/modules/go') diff --git a/auto/modules/go b/auto/modules/go index a6ea8bc8..2d53dd65 100644 --- a/auto/modules/go +++ b/auto/modules/go @@ -74,7 +74,7 @@ fi NXT_GO_PATH=${NXT_GO_PATH=`${NXT_GO} env GOPATH`} NXT_GO_PATH=${NXT_GO_PATH:-${PWD}/${NXT_BUILD_DIR}/${NXT_GO}} -NXT_GO_PKG=nginx/unit +NXT_GO_PKG=unit.nginx.org/go $echo " + Go package path: \"${NXT_GO_PATH}\"" -- cgit