build: fix version.h creation

Previous code did not retrigger a relink when version.h changed since it
didn't use a waf task.
This commit is contained in:
Stefano Pigozzi 2015-07-11 19:03:44 +02:00
parent 4a4f788a68
commit 78e771554c
2 changed files with 18 additions and 5 deletions

View File

@ -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)

14
wscript
View File

@ -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: