summaryrefslogtreecommitdiffhomepage
path: root/auto/modules
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--auto/modules/go34
-rw-r--r--auto/modules/java_get_jar9
2 files changed, 27 insertions, 16 deletions
diff --git a/auto/modules/go b/auto/modules/go
index 51b5979d..2d53dd65 100644
--- a/auto/modules/go
+++ b/auto/modules/go
@@ -72,7 +72,9 @@ 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=unit.nginx.org/go
$echo " + Go package path: \"${NXT_GO_PATH}\""
@@ -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 ./go/* \$(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
diff --git a/auto/modules/java_get_jar b/auto/modules/java_get_jar
index c61d0a53..52cd146f 100644
--- a/auto/modules/java_get_jar
+++ b/auto/modules/java_get_jar
@@ -8,7 +8,9 @@
# NXT_JAR_LOCAL_REPO=$HOME/.m2/repository/
NXT_JAR_FILE=${NXT_JAR_NAME}-${NXT_JAR_VERSION}.jar
-NXT_JAR_LOCAL="${NXT_JAR_LOCAL_REPO}${NXT_JAR_NAMESPACE}${NXT_JAR_NAME}/${NXT_JAR_VERSION}/${NXT_JAR_FILE}"
+NXT_JAR_LOCAL_DIR="${NXT_JAR_LOCAL_REPO}${NXT_JAR_NAMESPACE}${NXT_JAR_NAME}/${NXT_JAR_VERSION}"
+NXT_JAR_LOCAL="${NXT_JAR_LOCAL_DIR}/${NXT_JAR_FILE}"
+NXT_JAR_LOCAL_TMP="${NXT_JAR_LOCAL_DIR}/.${NXT_JAR_FILE}.$$"
NXT_JAR_URL=${NXT_JAR_REPO}${NXT_JAR_NAMESPACE}${NXT_JAR_NAME}/${NXT_JAR_VERSION}/${NXT_JAR_FILE}
if [ ! -f "$NXT_BUILD_DIR/$NXT_JAR_FILE" ]; then
@@ -16,8 +18,9 @@ if [ ! -f "$NXT_BUILD_DIR/$NXT_JAR_FILE" ]; then
$echo "getting remote $NXT_JAR_FILE ... "
$echo "getting remote $NXT_JAR_FILE ..." >> $NXT_AUTOCONF_ERR
- mkdir -p "${NXT_JAR_LOCAL_REPO}${NXT_JAR_NAMESPACE}${NXT_JAR_NAME}/${NXT_JAR_VERSION}/"
- curl --progress-bar "$NXT_JAR_URL" -o "$NXT_JAR_LOCAL"
+ mkdir -p "${NXT_JAR_LOCAL_DIR}"
+ curl --progress-bar "$NXT_JAR_URL" -o "$NXT_JAR_LOCAL_TMP"
+ mv "$NXT_JAR_LOCAL_TMP" "$NXT_JAR_LOCAL"
else
$echo "getting local $NXT_JAR_FILE"
$echo "getting local $NXT_JAR_FILE ..." >> $NXT_AUTOCONF_ERR