summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xversion.sh9
-rw-r--r--wscript14
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: