Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move node version to a single static header file.

Some compile time variables like the cflags and prefix have been moved to
the node_config.h.in, in the anticipation that they will be removed at
somepoint.
  • Loading branch information...
commit 480164f923addd6d12f4d6808cbf7875cdd96c86 1 parent 99a5d1e
@pquerna pquerna authored ry committed
View
7 src/node_config.h.in
@@ -0,0 +1,7 @@
+#ifndef NODE_CONFIG_H
+#define NODE_CONFIG_H
+
+#define NODE_CFLAGS "@CCFLAGS@ @CPPFLAGS@ -I@PREFIX@/include/node"
+#define NODE_PREFIX "@PREFIX@"
+
+#endif /* NODE_CONFIG_H */
View
28 src/node_version.h
@@ -0,0 +1,28 @@
+
+#include "node_config.h"
+
+#ifndef NODE_VERSION_H
+#define NODE_VERSION_H
+
+#define NODE_MAJOR_VERSION 0
+#define NODE_MINOR_VERSION 1
+#define NODE_PATCH_VERSION 100
+
+#ifndef NODE_STRINGIFY
+#define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n)
+#define NODE_STRINGIFY_HELPER(n) #n
+#endif
+
+#define NODE_VERSION_STRING NODE_STRINGIFY(NODE_MAJOR_VERSION) "." \
+ NODE_STRINGIFY(NODE_MINOR_VERSION) "." \
+ NODE_STRINGIFY(NODE_PATCH_VERSION)
+
+#define NODE_VERSION "v" NODE_VERSION_STRING
+
+
+#define NODE_VERSION_AT_LEAST(major, minor, patch) \
+ (( (major) < NODE_MAJOR_VERSION \
+ || ((major) == NODE_MAJOR_VERSION && (minor) < NODE_MINOR_VERSION) \
+ || ((major) == NODE_MAJOR_VERSION && (minor) == NODE_MINOR_VERSION && (patch) <= NODE_PATCH_VERSION))
+
+#endif /* NODE_VERSION_H */
View
12 src/node_version.h.in
@@ -1,12 +0,0 @@
-#ifndef node_version_h
-#define node_version_h
-
-#ifdef NDEBUG
-# define NODE_VERSION "@VERSION@"
-#else
-# define NODE_VERSION "@VERSION@ (debug)"
-#endif
-#define NODE_CFLAGS "@CCFLAGS@ @CPPFLAGS@ -I@PREFIX@/include/node"
-#define NODE_PREFIX "@PREFIX@"
-
-#endif /* node_version_h */
View
26 wscript
@@ -7,7 +7,6 @@ from os.path import join, dirname, abspath
from logging import fatal
cwd = os.getcwd()
-VERSION="0.1.100"
APPNAME="node.js"
import js2c
@@ -507,38 +506,29 @@ def build(bld):
bld.install_files('${PREFIX}/lib', "build/default/libnode.*")
def subflags(program):
- if os.path.exists(join(cwd, ".git")):
- try:
- actual_version=cmd_output("git describe").strip()
- except:
- actual_version=VERSION+'+'
- else:
- actual_version=VERSION
-
x = { 'CCFLAGS' : " ".join(program.env["CCFLAGS"])
, 'CPPFLAGS' : " ".join(program.env["CPPFLAGS"])
, 'LIBFLAGS' : " ".join(program.env["LIBFLAGS"])
- , 'VERSION' : actual_version
, 'PREFIX' : program.env["PREFIX"]
}
return x
# process file.pc.in -> file.pc
- node_version = bld.new_task_gen('subst', before="cxx")
- node_version.source = 'src/node_version.h.in'
- node_version.target = 'src/node_version.h'
- node_version.dict = subflags(node)
- node_version.install_path = '${PREFIX}/include/node'
+ node_conf = bld.new_task_gen('subst', before="cxx")
+ node_conf.source = 'src/node_config.h.in'
+ node_conf.target = 'src/node_config.h'
+ node_conf.dict = subflags(node)
+ node_conf.install_path = '${PREFIX}/include/node'
if bld.env["USE_DEBUG"]:
node_g = node.clone("debug")
node_g.target = "node_g"
node_g.uselib += ' V8_G'
- node_version_g = node_version.clone("debug")
- node_version_g.dict = subflags(node_g)
- node_version_g.install_path = None
+ node_conf_g = node_conf.clone("debug")
+ node_conf_g.dict = subflags(node_g)
+ node_conf_g.install_path = None
# After creating the debug clone, append the V8 dep
node.uselib += ' V8'
Please sign in to comment.
Something went wrong with that request. Please try again.