summaryrefslogtreecommitdiffstats
path: root/CMakeScripts/inkscape-version.cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:29:01 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:29:01 +0000
commit35a96bde514a8897f6f0fcc41c5833bf63df2e2a (patch)
tree657d15a03cc46bd099fc2c6546a7a4ad43815d9f /CMakeScripts/inkscape-version.cmake
parentInitial commit. (diff)
downloadinkscape-35a96bde514a8897f6f0fcc41c5833bf63df2e2a.tar.xz
inkscape-35a96bde514a8897f6f0fcc41c5833bf63df2e2a.zip
Adding upstream version 1.0.2.upstream/1.0.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'CMakeScripts/inkscape-version.cmake')
-rw-r--r--CMakeScripts/inkscape-version.cmake46
1 files changed, 46 insertions, 0 deletions
diff --git a/CMakeScripts/inkscape-version.cmake b/CMakeScripts/inkscape-version.cmake
new file mode 100644
index 0000000..2f24fa8
--- /dev/null
+++ b/CMakeScripts/inkscape-version.cmake
@@ -0,0 +1,46 @@
+# This is called by cmake as an extermal process from
+# ./src/CMakeLists.txt and creates inkscape-version.cpp
+#
+# It's also included directly in ./CMakeScripts/Dist.cmake to
+# determine INKSCAPE_REVISION, INKSCAPE_REVISION_HASH and INKSCAPE_REVISION_DATE
+# for the 'dist' targets
+#
+# These variables are defined by the caller, matching the CMake equivilents.
+# - ${INKSCAPE_SOURCE_DIR}
+# - ${INKSCAPE_BINARY_DIR}
+
+set(INKSCAPE_REVISION "e86c870879, 2021-01-15")
+
+if(EXISTS ${INKSCAPE_SOURCE_DIR}/.git)
+ execute_process(COMMAND git rev-parse --short HEAD
+ WORKING_DIRECTORY ${INKSCAPE_SOURCE_DIR}
+ OUTPUT_VARIABLE INKSCAPE_REVISION_HASH
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND git log -n 1 --pretty=%cd --date=short
+ WORKING_DIRECTORY ${INKSCAPE_SOURCE_DIR}
+ OUTPUT_VARIABLE INKSCAPE_REVISION_DATE
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ set(INKSCAPE_REVISION "${INKSCAPE_REVISION_HASH}, ${INKSCAPE_REVISION_DATE}")
+
+ execute_process(COMMAND
+ git status -s ${INKSCAPE_SOURCE_DIR}/src
+ WORKING_DIRECTORY ${INKSCAPE_SOURCE_DIR}
+ OUTPUT_VARIABLE INKSCAPE_SOURCE_MODIFIED
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(NOT INKSCAPE_SOURCE_MODIFIED STREQUAL "")
+ set(INKSCAPE_REVISION "${INKSCAPE_REVISION}, custom")
+ endif()
+elseif(EXISTS ${INKSCAPE_SOURCE_DIR}/debian/git-build-recipe.manifest)
+ # workaround for debian packaging in ppa (where we have no repo)
+ # TODO: figure out how to match this to standard build environments
+ execute_process(COMMAND sed -n "s/.*deb-version\\s*//p" git-build-recipe.manifest
+ WORKING_DIRECTORY ${INKSCAPE_SOURCE_DIR}/debian
+ OUTPUT_VARIABLE DEB_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ set(INKSCAPE_REVISION "${DEB_VERSION}")
+endif()
+
+if(NOT "${INKSCAPE_BINARY_DIR}" STREQUAL "")
+ message("revision is " ${INKSCAPE_REVISION})
+ configure_file(${INKSCAPE_BINARY_DIR}/src/inkscape-version.cpp.in ${INKSCAPE_BINARY_DIR}/src/inkscape-version.cpp)
+endif()