Skip to content

Commit

Permalink
build: add wscript detection for node_version
Browse files Browse the repository at this point in the history
  • Loading branch information
japj authored and bnoordhuis committed Jul 23, 2011
1 parent 3eb2464 commit 2fe780b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion wscript
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
)



Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 2fe780b

Please sign in to comment.