From 480164f923addd6d12f4d6808cbf7875cdd96c86 Mon Sep 17 00:00:00 2001 From: Paul Querna Date: Mon, 12 Jul 2010 23:59:57 -0700 Subject: [PATCH] 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. --- src/node_config.h.in | 7 +++++++ src/node_version.h | 28 ++++++++++++++++++++++++++++ src/node_version.h.in | 12 ------------ wscript | 26 ++++++++------------------ 4 files changed, 43 insertions(+), 30 deletions(-) create mode 100644 src/node_config.h.in create mode 100644 src/node_version.h delete mode 100644 src/node_version.h.in diff --git a/src/node_config.h.in b/src/node_config.h.in new file mode 100644 index 0000000000..94b9b3cffd --- /dev/null +++ b/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 */ diff --git a/src/node_version.h b/src/node_version.h new file mode 100644 index 0000000000..3b0fce808a --- /dev/null +++ b/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 */ diff --git a/src/node_version.h.in b/src/node_version.h.in deleted file mode 100644 index 4263594212..0000000000 --- a/src/node_version.h.in +++ /dev/null @@ -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 */ diff --git a/wscript b/wscript index 8cb3cb48e0..d537fd1b5a 100644 --- a/wscript +++ b/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'