Commit ba965948 authored by Nedko Arnaudov's avatar Nedko Arnaudov
Browse files

Merge pull request #120 from lilrc/master

Fix svnversion.h generation
parents 40341d16 5db74402
......@@ -16,8 +16,9 @@ TEMP_FILE="${OUTPUT_FILE}.tmp"
#echo "$OUTPUT_FILE"
#echo "$TEMP_FILE"
OLDPWD=`pwd`
cd ..
# The script should reside in the toplevel source directory which sould contain
# all version control files.
cd `dirname ${0}`
if test $# -eq 2
then
......@@ -63,8 +64,6 @@ else
fi
fi
cd "${OLDPWD}"
rm "${TEMP_FILE}"
exit $?
......@@ -50,26 +50,6 @@ def display_feature(msg, build):
def print_error(msg):
print(Logs.colors.RED + msg + Logs.colors.NORMAL)
def create_svnversion_task(bld, header='svnversion.h', define=None):
cmd = '../svnversion_regenerate.sh ${TGT}'
if define:
cmd += " " + define
def post_run(self):
sg = Utils.h_file(self.outputs[0].abspath(self.env))
#print sg.encode('hex')
Build.bld.node_sigs[self.env.variant()][self.outputs[0].id] = sg
bld(
rule = cmd,
name = 'svnversion',
runnable_status = Task.RUN_ME,
before = 'c',
color = 'BLUE',
post_run = post_run,
target = [bld.path.find_or_declare(header)]
)
class AutoOption:
"""
This class is the foundation for the auto options. It adds an option
......@@ -621,11 +601,15 @@ def configure(conf):
conf.write_config_header('config.h', remove=False)
svnrev = None
if os.access('svnversion.h', os.R_OK):
data = file('svnversion.h').read()
try:
f = open('svnversion.h')
data = f.read()
m = re.match(r'^#define SVN_VERSION "([^"]*)"$', data)
if m != None:
svnrev = m.group(1)
f.close()
except FileNotFoundError:
pass
if Options.options.mixed == True:
conf.setenv(lib32, env=conf.env.derive())
......@@ -710,8 +694,6 @@ def build(bld):
print("make[1]: Entering directory `" + os.getcwd() + "/" + out2 + "'")
if not bld.variant:
if not os.access('svnversion.h', os.R_OK):
create_svnversion_task(bld)
if bld.env['BUILD_WITH_32_64'] == True:
waflib.Options.commands.append(bld.cmd + '_' + lib32)
......@@ -722,6 +704,26 @@ def build(bld):
# only the wscript in common/ knows how to handle variants
return
if not os.access('svnversion.h', os.R_OK):
def post_run(self):
sg = Utils.h_file(self.outputs[0].abspath(self.env))
#print sg.encode('hex')
Build.bld.node_sigs[self.env.variant()][self.outputs[0].id] = sg
script = bld.path.find_resource('svnversion_regenerate.sh')
script = script.abspath()
bld(
rule = '%s ${TGT}' % script,
name = 'svnversion',
runnable_status = Task.RUN_ME,
before = 'c cxx',
color = 'BLUE',
post_run = post_run,
source = ['svnversion_regenerate.sh'],
target = [bld.path.find_or_declare('svnversion.h')]
)
if bld.env['IS_LINUX']:
bld.add_subdirs('linux')
bld.add_subdirs('example-clients')
......@@ -809,6 +811,7 @@ def build(bld):
shutil.rmtree(html_build_dir)
Logs.pprint('CYAN', "Removing doxygen generated documentation done.")
def dist_hook():
os.remove('svnversion_regenerate.sh')
os.system('../svnversion_regenerate.sh svnversion.h')
def dist(ctx):
# This code blindly assumes it is working in the toplevel source directory.
if not os.path.exists('svnversion.h'):
os.system('./svnversion_regenerate.sh svnversion.h')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment