diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2015-07-11 19:03:44 +0200 |
---|---|---|
committer | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2015-07-12 10:09:49 +0200 |
commit | 78e771554cc37bc32a1ba631813aa5a41cc559f9 (patch) | |
tree | 594d3a52586d99320d696719f4080dcbd37ee5b0 | |
parent | 4a4f788a68a0ca73dcc3eed6ccd0533be4912b20 (diff) | |
download | mpv-78e771554cc37bc32a1ba631813aa5a41cc559f9.tar.bz2 mpv-78e771554cc37bc32a1ba631813aa5a41cc559f9.tar.xz |
build: fix version.h creation
Previous code did not retrigger a relink when version.h changed since it
didn't use a waf task.
-rwxr-xr-x | version.sh | 9 | ||||
-rw-r--r-- | 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) @@ -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: |