From 78e771554cc37bc32a1ba631813aa5a41cc559f9 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 11 Jul 2015 19:03:44 +0200 Subject: build: fix version.h creation Previous code did not retrigger a relink when version.h changed since it didn't use a waf task. --- version.sh | 9 ++++++++- wscript | 14 ++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/version.sh b/version.sh index a3d753da44..a9dfb69620 100755 --- a/version.sh +++ b/version.sh @@ -11,7 +11,10 @@ for ac_option do extra="-$ac_arg" ;; --versionh=*) - version_h="$ac_arg" + version_h="$(pwd)/$ac_arg" + ;; + --cwd=*) + cwd="$ac_arg" ;; --print) print=yes @@ -24,6 +27,10 @@ for ac_option do esac done +if test "$cwd" ; then + cd "$cwd" +fi + # Extract revision number from file used by daily tarball snapshots # or from "git describe" output git_revision=$(cat snapshot_version 2> /dev/null) diff --git a/wscript b/wscript index 1cad348231..11a10a04b7 100644 --- a/wscript +++ b/wscript @@ -918,10 +918,16 @@ def configure(ctx): ctx.store_dependencies_lists() def __write_version__(ctx): - import subprocess - subprocess.call(["sh", "./version.sh", - "--versionh=" + ctx.bldnode.abspath() + "/version.h"], - cwd=ctx.srcnode.abspath()) + ctx.env.VERSIONH_ST = '--versionh="%s"' + ctx.env.CWD_ST = '--cwd="%s"' + ctx.env.VERSIONSH_CWD = [ctx.srcnode.abspath()] + + ctx( + source = 'version.sh', + target = 'version.h', + rule = 'sh ${SRC} ${CWD_ST:VERSIONSH_CWD} ${VERSIONH_ST:TGT}', + always = True, + update_outputs = True) def build(ctx): if ctx.options.variant not in ctx.all_envs: -- cgit v1.2.3