Skip to content

Commit d979ac9

Browse files
committed
Put git revision into version string
1 parent 78d06ee commit d979ac9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

wscript

+9-2
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@ import platform
33
import re
44
import Options
55
import sys, os, shutil
6+
from Utils import cmd_output
67
from os.path import join, dirname, abspath
78
from logging import fatal
89

10+
cwd = os.getcwd()
911
VERSION="0.1.13"
1012
APPNAME="node.js"
1113

1214
import js2c
1315

1416
srcdir = '.'
1517
blddir = 'build'
16-
cwd = os.getcwd()
1718

1819
def set_options(opt):
1920
# the gcc module provides a --debug-level option
@@ -342,15 +343,21 @@ def build(bld):
342343
node.chmod = 0755
343344

344345
def subflags(program):
346+
if os.path.exists(join(cwd, ".git")):
347+
actual_version=cmd_output("git-describe").strip()
348+
else:
349+
actual_version=VERSION
350+
345351
x = { 'CCFLAGS' : " ".join(program.env["CCFLAGS"])
346352
, 'CPPFLAGS' : " ".join(program.env["CPPFLAGS"])
347353
, 'LIBFLAGS' : " ".join(program.env["LIBFLAGS"])
348-
, 'VERSION' : VERSION
354+
, 'VERSION' : actual_version
349355
, 'PREFIX' : program.env["PREFIX"]
350356
}
351357
return x
352358

353359
# process file.pc.in -> file.pc
360+
354361
node_version = bld.new_task_gen('subst', before="cxx")
355362
node_version.source = 'src/node_version.h.in'
356363
node_version.target = 'src/node_version.h'

0 commit comments

Comments
 (0)