diff --git a/wscript b/wscript index 38b3821796..71ca144120 100644 --- a/wscript +++ b/wscript @@ -3,9 +3,11 @@ import platform import re import Options import sys, os, shutil +from Utils import cmd_output from os.path import join, dirname, abspath from logging import fatal +cwd = os.getcwd() VERSION="0.1.13" APPNAME="node.js" @@ -13,7 +15,6 @@ import js2c srcdir = '.' blddir = 'build' -cwd = os.getcwd() def set_options(opt): # the gcc module provides a --debug-level option @@ -342,15 +343,21 @@ def build(bld): node.chmod = 0755 def subflags(program): + if os.path.exists(join(cwd, ".git")): + actual_version=cmd_output("git-describe").strip() + else: + actual_version=VERSION + x = { 'CCFLAGS' : " ".join(program.env["CCFLAGS"]) , 'CPPFLAGS' : " ".join(program.env["CPPFLAGS"]) , 'LIBFLAGS' : " ".join(program.env["LIBFLAGS"]) - , 'VERSION' : VERSION + , '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'