mirror of https://github.com/nodejs/node.git
build: add wscript detection for node_version
parent
3eb246485a
commit
2fe780b36c
19
wscript
19
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 <NAME> <VALUE>
|
||||
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue