From 2fe780b36c3f13891930786ed82d5c0a495a731c Mon Sep 17 00:00:00 2001 From: Jeroen Janssen Date: Fri, 22 Jul 2011 21:44:15 +0200 Subject: [PATCH] build: add wscript detection for node_version --- wscript | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/wscript b/wscript index 490bb0f9af83c3..ad279bae7919fe 100644 --- a/wscript +++ b/wscript @@ -204,6 +204,23 @@ def set_options(opt): , dest='dest_cpu' ) +def get_node_version(): + def get_define_value(lines, define): + for line in lines: + if define in line: + return line.split()[-1] #define + + lines = open("src/node_version.h").readlines() + node_major_version = get_define_value(lines, 'NODE_MAJOR_VERSION') + node_minor_version = get_define_value(lines, 'NODE_MINOR_VERSION') + node_patch_version = get_define_value(lines, 'NODE_PATCH_VERSION') + node_is_release = get_define_value(lines, 'NODE_VERSION_IS_RELEASE') + + return "%s.%s.%s%s" % ( node_major_version, + node_minor_version, + node_patch_version, + "-pre" if node_is_release == "0" else "" + ) @@ -897,7 +914,7 @@ def build(bld): , 'CPPFLAGS' : " ".join(program.env["CPPFLAGS"]).replace('"', '\\"') , 'LIBFLAGS' : " ".join(program.env["LIBFLAGS"]).replace('"', '\\"') , 'PREFIX' : safe_path(program.env["PREFIX"]) - , 'VERSION' : '0.5.2' # FIXME should not be hard-coded, see NODE_VERSION_STRING in src/node_version. + , 'VERSION' : get_node_version() } return x