summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--auto/make28
-rw-r--r--auto/modules/go2
-rw-r--r--auto/modules/nodejs11
-rwxr-xr-xconfigure1
-rw-r--r--pkg/Makefile4
-rw-r--r--pkg/deb/Makefile5
-rw-r--r--pkg/docker/Makefile6
-rw-r--r--pkg/npm/Makefile10
-rw-r--r--pkg/rpm/Makefile5
-rw-r--r--src/nodejs/unit-http/unit.h2
-rw-r--r--src/nxt_main.h5
-rw-r--r--src/nxt_unit.h2
-rw-r--r--version5
13 files changed, 43 insertions, 43 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} .
diff --git a/configure b/configure
index 13f2db6b..335a8c88 100755
--- a/configure
+++ b/configure
@@ -25,6 +25,7 @@ NXT_AUTOTEST=$NXT_BUILD_DIR/autotest
NXT_AUTOCONF_ERR=$NXT_BUILD_DIR/autoconf.err
NXT_AUTOCONF_DATA=$NXT_BUILD_DIR/autoconf.data
NXT_AUTO_CONFIG_H=$NXT_BUILD_DIR/nxt_auto_config.h
+NXT_VERSION_H=$NXT_BUILD_DIR/nxt_version.h
NXT_MAKEFILE=$NXT_BUILD_DIR/Makefile
CC=${CC:-cc}
diff --git a/pkg/Makefile b/pkg/Makefile
index 6001a034..7926606d 100644
--- a/pkg/Makefile
+++ b/pkg/Makefile
@@ -1,8 +1,8 @@
#!/usr/bin/make
-VERSION ?= $(shell grep 'define NXT_VERSION' ../src/nxt_main.h \
- | sed -e 's/^.*"\(.*\)".*/\1/')
+include ../version
+VERSION ?= $(NXT_VERSION)
RELEASE ?= 1
default:
diff --git a/pkg/deb/Makefile b/pkg/deb/Makefile
index 1a16b6ee..29792f90 100644
--- a/pkg/deb/Makefile
+++ b/pkg/deb/Makefile
@@ -1,11 +1,10 @@
#!/usr/bin/make
-DEFAULT_VERSION := $(shell grep 'define NXT_VERSION' ../../src/nxt_main.h \
- | sed -e 's/^.*"\(.*\)".*/\1/')
+include ../../version
DEFAULT_RELEASE := 1
-VERSION ?= $(DEFAULT_VERSION)
+VERSION ?= $(NXT_VERSION)
RELEASE ?= $(DEFAULT_RELEASE)
SRCDIR= unit-$(VERSION)
diff --git a/pkg/docker/Makefile b/pkg/docker/Makefile
index 140ac5b3..cf6de78d 100644
--- a/pkg/docker/Makefile
+++ b/pkg/docker/Makefile
@@ -1,10 +1,10 @@
#!/usr/bin/make
-DEFAULT_VERSION := $(shell grep 'define NXT_VERSION' ../../src/nxt_main.h \
- | sed -e 's/^.*"\(.*\)".*/\1/')
+include ../../version
+
DEFAULT_RELEASE := 1
-VERSION ?= $(DEFAULT_VERSION)
+VERSION ?= $(NXT_VERSION)
RELEASE ?= $(DEFAULT_RELEASE)
CODENAME := stretch
diff --git a/pkg/npm/Makefile b/pkg/npm/Makefile
index dfa9ccdc..8636dd0b 100644
--- a/pkg/npm/Makefile
+++ b/pkg/npm/Makefile
@@ -1,13 +1,9 @@
#!/usr/bin/make
-DEFAULT_VERSION := $(shell grep 'define NXT_VERSION' ../../src/nxt_main.h \
- | sed -e 's/^.*"\(.*\)".*/\1/')
+include ../../version
-DEFAULT_VERNUM := $(shell grep 'define NXT_VERNUM' ../../src/nxt_main.h \
- | sed -e 's/[^0-9]//g')
-
-VERSION ?= $(DEFAULT_VERSION)
-VERNUM ?= $(DEFAULT_VERNUM)
+VERSION ?= $(NXT_VERSION)
+VERNUM ?= $(NXT_VERNUM)
NPM ?= npm
default:
diff --git a/pkg/rpm/Makefile b/pkg/rpm/Makefile
index fdc31302..2157e808 100644
--- a/pkg/rpm/Makefile
+++ b/pkg/rpm/Makefile
@@ -1,11 +1,10 @@
#!/usr/bin/make
-DEFAULT_VERSION := $(shell grep 'define NXT_VERSION' ../../src/nxt_main.h \
- | sed -e 's/^.*"\(.*\)".*/\1/')
+include ../../version
DEFAULT_RELEASE := 1
-VERSION ?= $(DEFAULT_VERSION)
+VERSION ?= $(NXT_VERSION)
RELEASE ?= $(DEFAULT_RELEASE)
ifeq ($(shell rpm --eval "%{?rhel}"), 6)
diff --git a/src/nodejs/unit-http/unit.h b/src/nodejs/unit-http/unit.h
index 8baeb967..db85e85c 100644
--- a/src/nodejs/unit-http/unit.h
+++ b/src/nodejs/unit-http/unit.h
@@ -15,7 +15,7 @@ extern "C" {
#include "version.h"
#include <nxt_unit.h>
-#if NXT_UNIT_VERNUM != NXT_NODE_VERNUM
+#if NXT_VERNUM != NXT_NODE_VERNUM
#error "libunit version mismatch."
#endif
diff --git a/src/nxt_main.h b/src/nxt_main.h
index dc821e07..23c55002 100644
--- a/src/nxt_main.h
+++ b/src/nxt_main.h
@@ -9,10 +9,7 @@
#include <nxt_auto_config.h>
-
-
-#define NXT_VERSION "1.8"
-#define NXT_VERNUM 10800
+#include <nxt_version.h>
#define NXT_SERVER "Unit/" NXT_VERSION
diff --git a/src/nxt_unit.h b/src/nxt_unit.h
index a3fcc541..532de20d 100644
--- a/src/nxt_unit.h
+++ b/src/nxt_unit.h
@@ -11,7 +11,7 @@
#include <sys/types.h>
#include <string.h>
-#include "nxt_unit_version.h"
+#include "nxt_version.h"
#include "nxt_unit_typedefs.h"
diff --git a/version b/version
new file mode 100644
index 00000000..36e0b1b3
--- /dev/null
+++ b/version
@@ -0,0 +1,5 @@
+
+# Copyright (C) NGINX, Inc.
+
+NXT_VERSION=1.8
+NXT_VERNUM=10800