summaryrefslogtreecommitdiff
path: root/src/buildtool
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2022-06-27 12:31:46 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2022-06-27 12:31:46 +0200
commit7285a806b5187fdbb08aed5ef921dbafc6cd8fb0 (patch)
treebd65211fd21d9318b6b7670875b378daa52401cf /src/buildtool
parent46f5fdee03f690541ce56b0670eb7d86d36f6a3d (diff)
downloadjustbuild-7285a806b5187fdbb08aed5ef921dbafc6cd8fb0.tar.gz
just version information: support VERSION_EXTRA_SUFFIX
... which, if defined, is appended to the suffix string. In this way, versions can be forked, e.g., if non-upstream changes are included.
Diffstat (limited to 'src/buildtool')
-rw-r--r--src/buildtool/main/TARGETS35
-rw-r--r--src/buildtool/main/version.cpp3
2 files changed, 29 insertions, 9 deletions
diff --git a/src/buildtool/main/TARGETS b/src/buildtool/main/TARGETS
index 4fd16a86..5b7ff0e5 100644
--- a/src/buildtool/main/TARGETS
+++ b/src/buildtool/main/TARGETS
@@ -30,19 +30,36 @@
}
, "version":
{ "type": ["@", "rules", "CC", "library"]
- , "arguments_config": ["SOURCE_DATE_EPOCH"]
+ , "arguments_config": ["SOURCE_DATE_EPOCH", "VERSION_EXTRA_SUFFIX"]
, "name": ["version"]
, "hdrs": ["version.hpp"]
, "srcs": ["version.cpp"]
, "local defines":
- { "type": "if"
- , "cond": {"type": "var", "name": "SOURCE_DATE_EPOCH"}
- , "then":
- [ { "type": "join"
- , "$1":
- [ "SOURCE_DATE_EPOCH="
- , { "type": "json_encode"
- , "$1": {"type": "var", "name": "SOURCE_DATE_EPOCH"}
+ { "type": "++"
+ , "$1":
+ [ { "type": "if"
+ , "cond": {"type": "var", "name": "SOURCE_DATE_EPOCH"}
+ , "then":
+ [ { "type": "join"
+ , "$1":
+ [ "SOURCE_DATE_EPOCH="
+ , { "type": "json_encode"
+ , "$1": {"type": "var", "name": "SOURCE_DATE_EPOCH"}
+ }
+ ]
+ }
+ ]
+ }
+ , { "type": "if"
+ , "cond": {"type": "var", "name": "VERSION_EXTRA_SUFFIX"}
+ , "then":
+ [ { "type": "join"
+ , "$1":
+ [ "VERSION_EXTRA_SUFFIX="
+ , { "type": "json_encode"
+ , "$1": {"type": "var", "name": "VERSION_EXTRA_SUFFIX"}
+ }
+ ]
}
]
}
diff --git a/src/buildtool/main/version.cpp b/src/buildtool/main/version.cpp
index 3bd37f2a..09e55f96 100644
--- a/src/buildtool/main/version.cpp
+++ b/src/buildtool/main/version.cpp
@@ -8,6 +8,9 @@ auto version() -> std::string {
std::size_t minor = 1;
std::size_t revision = 0;
std::string suffix = "+devel";
+#ifdef VERSION_EXTRA_SUFFIX
+ suffix += VERSION_EXTRA_SUFFIX;
+#endif
nlohmann::json version_info = {{"version", {major, minor, revision}},
{"suffix", suffix}};