summaryrefslogtreecommitdiffhomepage
path: root/auto/modules
diff options
context:
space:
mode:
Diffstat (limited to 'auto/modules')
-rw-r--r--auto/modules/go32
1 files changed, 20 insertions, 12 deletions
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