summaryrefslogtreecommitdiffhomepage
path: root/auto
diff options
context:
space:
mode:
authorAlexander Borisov <alexander.borisov@nginx.com>2019-02-22 16:31:44 +0300
committerAlexander Borisov <alexander.borisov@nginx.com>2019-02-22 16:31:44 +0300
commit608e09e9def182756e2f1650c6f3416b209fbf58 (patch)
treeb56e435fd0cb36dc2233ee0b843f13f2fcfa9ff1 /auto
parentc96b2baca50fe2f5c17f96406e6d741e88267921 (diff)
downloadunit-608e09e9def182756e2f1650c6f3416b209fbf58.tar.gz
unit-608e09e9def182756e2f1650c6f3416b209fbf58.tar.bz2
Improvement and unification of version processing in build scripts.
This also eliminates expressions that incompatible with BSD make, thus fixing installation of Node.js module on FreeBSD (broken by dace60fc4926).
Diffstat (limited to 'auto')
-rw-r--r--auto/make28
-rw-r--r--auto/modules/go2
-rw-r--r--auto/modules/nodejs11
3 files changed, 22 insertions, 19 deletions
diff --git a/auto/make b/auto/make
index 4f716b93..1eee2a78 100644
--- a/auto/make
+++ b/auto/make
@@ -67,6 +67,22 @@ done
$echo >> $NXT_MAKEFILE
+# The version file.
+
+cat << END >> $NXT_MAKEFILE
+
+include version
+
+$NXT_VERSION_H: version
+ $echo '#define NXT_VERSION "\$(NXT_VERSION)"' > $NXT_VERSION_H
+ $echo '#define NXT_VERNUM \$(NXT_VERNUM)' >> $NXT_VERSION_H
+
+$NXT_BUILD_DIR/src/nxt_unit.o: $NXT_VERSION_H
+$NXT_BUILD_DIR/src/nxt_lib.o: $NXT_VERSION_H
+
+END
+
+
# Shared and static library.
cat << END >> $NXT_MAKEFILE
@@ -82,14 +98,6 @@ $NXT_BUILD_DIR/$NXT_LIB_STATIC: \$(NXT_LIB_OBJS)
$NXT_STATIC_LINK $NXT_BUILD_DIR/$NXT_LIB_STATIC \\
\$(NXT_LIB_OBJS)
-$NXT_BUILD_DIR/nxt_unit_version.h: src/nxt_main.h
- $echo -n '#define NXT_UNIT_VERNUM ' > $NXT_BUILD_DIR/nxt_unit_version.h
- grep 'define NXT_VERNUM' src/nxt_main.h \\
- | sed -e 's/[^0-9]//g' >> $NXT_BUILD_DIR/nxt_unit_version.h
-
-$NXT_BUILD_DIR/src/nxt_unit.o: $NXT_BUILD_DIR/nxt_unit_version.h
-$NXT_BUILD_DIR/src/nxt_lib.o: $NXT_BUILD_DIR/nxt_unit_version.h
-
$NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC: \$(NXT_LIB_UNIT_OBJS)
$NXT_STATIC_LINK $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC \\
\$(NXT_LIB_UNIT_OBJS)
@@ -296,7 +304,7 @@ libunit-install: $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC
install -d \$(DESTDIR)$NXT_INCDIR
install -p -m u=rw,go=r src/nxt_unit.h src/nxt_unit_field.h \
src/nxt_unit_request.h src/nxt_unit_response.h src/nxt_unit_sptr.h \
- src/nxt_unit_typedefs.h $NXT_BUILD_DIR/nxt_unit_version.h \
+ src/nxt_unit_typedefs.h $NXT_BUILD_DIR/nxt_version.h \
\$(DESTDIR)$NXT_INCDIR/
libunit-uninstall:
@@ -308,7 +316,7 @@ libunit-uninstall:
\$(DESTDIR)$NXT_INCDIR/nxt_unit_response.h \
\$(DESTDIR)$NXT_INCDIR/nxt_unit_sptr.h \
\$(DESTDIR)$NXT_INCDIR/nxt_unit_typedefs.h \
- \$(DESTDIR)$NXT_INCDIR/nxt_unit_version.h
+ \$(DESTDIR)$NXT_INCDIR/nxt_version.h
@rmdir -p \$(DESTDIR)$NXT_INCDIR 2>/dev/null || true
END
diff --git a/auto/modules/go b/auto/modules/go
index e9b2321d..62c3743f 100644
--- a/auto/modules/go
+++ b/auto/modules/go
@@ -103,7 +103,7 @@ ${NXT_GO}:
${NXT_GO}-install: ${NXT_GO}-install-build
-${NXT_GO}-install-src: ${NXT_BUILD_DIR}/nxt_unit_version.h
+${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 \
diff --git a/auto/modules/nodejs b/auto/modules/nodejs
index 57bf9d3a..6fd00496 100644
--- a/auto/modules/nodejs
+++ b/auto/modules/nodejs
@@ -145,9 +145,6 @@ cat << END >> $NXT_MAKEFILE
.PHONY: ${NXT_NODE}-build
.PHONY: ${NXT_NODE}-publish
-NXT_UNIT_VERSION=\$(shell grep 'define NXT_VERSION' \
- src/nxt_main.h | sed -e 's/^.*"\(.*\)".*/\1/')
-
${NXT_NODE}: ${NXT_NODE}-copy $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC
${NXT_NODE_EXPORTS} && \\
cd ${NXT_NODE_TMP} && ${NXT_NODE_GYP} configure build clean
@@ -156,14 +153,12 @@ ${NXT_NODE}-copy: ${NXT_NODE_VERSION_FILE}
mkdir -p ${NXT_BUILD_DIR}/src/
cp -rp src/nodejs/* ${NXT_BUILD_DIR}/src/${NXT_NODE}
-${NXT_NODE_VERSION_FILE}: src/nxt_main.h
+${NXT_NODE_VERSION_FILE}: ${NXT_VERSION_H}
mkdir -p ${NXT_NODE_TMP}
- $echo -n '#define NXT_NODE_VERNUM ' > $NXT_NODE_VERSION_FILE
- grep 'define NXT_VERNUM' src/nxt_main.h \\
- | sed -e 's/[^0-9]//g' >> $NXT_NODE_VERSION_FILE
+ $echo '#define NXT_NODE_VERNUM \$(NXT_VERNUM)' > $NXT_NODE_VERSION_FILE
${NXT_NODE_TARBALL}: ${NXT_NODE}-copy
- sed -e 's/"version"\s*:.*/"version": "\$(NXT_UNIT_VERSION).0",/' \
+ sed -e 's/"version"\s*:.*/"version": "\$(NXT_VERSION).0",/' \
${NXT_NODE_TMP}/package.json > ${NXT_NODE_TMP}/package.json.tmp
mv ${NXT_NODE_TMP}/package.json.tmp ${NXT_NODE_TMP}/package.json
tar -zcvf ${NXT_NODE_TARBALL} -C ${NXT_NODE_TMP} .