summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAlexander Borisov <alexander.borisov@nginx.com>2018-12-19 15:56:54 +0300
committerAlexander Borisov <alexander.borisov@nginx.com>2018-12-19 15:56:54 +0300
commitc55f329ecf8d32bad0d5bc2aae1da1522b3a92f8 (patch)
tree5b9c5aaf624e9feec60dd332aa32ec414c88c234
parentab461437b5714d75e710febe3b44da49ebfe83fc (diff)
downloadunit-c55f329ecf8d32bad0d5bc2aae1da1522b3a92f8.tar.gz
unit-c55f329ecf8d32bad0d5bc2aae1da1522b3a92f8.tar.bz2
libunit: added generation of version header file.
-rw-r--r--auto/make14
-rw-r--r--auto/modules/nodejs5
-rw-r--r--src/nodejs/unit-http/binding.gyp2
-rw-r--r--src/nxt_unit.h2
4 files changed, 18 insertions, 5 deletions
diff --git a/auto/make b/auto/make
index 5bbca9e4..4f716b93 100644
--- a/auto/make
+++ b/auto/make
@@ -82,6 +82,14 @@ $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)
@@ -288,7 +296,8 @@ 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 \$(DESTDIR)$NXT_INCDIR/
+ src/nxt_unit_typedefs.h $NXT_BUILD_DIR/nxt_unit_version.h \
+ \$(DESTDIR)$NXT_INCDIR/
libunit-uninstall:
rm -f \$(DESTDIR)$NXT_LIBDIR/$NXT_LIB_UNIT_STATIC
@@ -298,7 +307,8 @@ libunit-uninstall:
\$(DESTDIR)$NXT_INCDIR/nxt_unit_request.h \
\$(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_typedefs.h \
+ \$(DESTDIR)$NXT_INCDIR/nxt_unit_version.h
@rmdir -p \$(DESTDIR)$NXT_INCDIR 2>/dev/null || true
END
diff --git a/auto/modules/nodejs b/auto/modules/nodejs
index 96ef6b98..d140eff1 100644
--- a/auto/modules/nodejs
+++ b/auto/modules/nodejs
@@ -123,8 +123,9 @@ fi
NXT_NODE_TMP=${NXT_BUILD_DIR}/src/${NXT_NODE}/unit-http
NXT_NODE_TARBALL=${NXT_BUILD_DIR}/${NXT_NODE}-unit-http.tar.gz
-NXT_NODE_EXPORTS="export UNIT_SRC_PATH=${PWD}/src && \
- export UNIT_LIB_STATIC_PATH=${PWD}/${NXT_BUILD_DIR}/libunit.a"
+NXT_NODE_EXPORTS="export UNIT_SRC_PATH=${PWD}/src \
+ && export UNIT_BUILD_PATH=${PWD}/${NXT_BUILD_DIR} \
+ && export UNIT_LIB_STATIC_PATH=${PWD}/${NXT_BUILD_DIR}/libunit.a"
if [ -n "$NXT_NODE_LOCAL" ]; then
NXT_NODE_INSTALL=local-install
diff --git a/src/nodejs/unit-http/binding.gyp b/src/nodejs/unit-http/binding.gyp
index 171c2eb7..ee09bfed 100644
--- a/src/nodejs/unit-http/binding.gyp
+++ b/src/nodejs/unit-http/binding.gyp
@@ -3,7 +3,7 @@
'target_name': "unit-http",
'sources': ["unit.cpp", "addon.cpp"],
'include_dirs': [
- "<!(echo $UNIT_SRC_PATH)"
+ "<!(echo $UNIT_SRC_PATH)", "<!(echo $UNIT_BUILD_PATH)"
],
'libraries': [
"<!(echo $UNIT_LIB_STATIC_PATH)"
diff --git a/src/nxt_unit.h b/src/nxt_unit.h
index 2806d035..a3fcc541 100644
--- a/src/nxt_unit.h
+++ b/src/nxt_unit.h
@@ -11,8 +11,10 @@
#include <sys/types.h>
#include <string.h>
+#include "nxt_unit_version.h"
#include "nxt_unit_typedefs.h"
+
enum {
NXT_UNIT_OK = 0,
NXT_UNIT_ERROR = 1,