summaryrefslogtreecommitdiffstats
path: root/CMakeScripts
diff options
context:
space:
mode:
authorEduard Braun <eduard.braun2@gmx.de>2017-07-21 03:23:07 +0000
committerEduard Braun <eduard.braun2@gmx.de>2017-07-23 01:49:14 +0000
commitf8d51951c05462f98ab120573bb8b58d15943c66 (patch)
treeca79dc588dba8adb1bee76c11cd8387ffc8689ca /CMakeScripts
parentDrop ChangeLog (diff)
downloadinkscape-f8d51951c05462f98ab120573bb8b58d15943c66.tar.gz
inkscape-f8d51951c05462f98ab120573bb8b58d15943c66.zip
cmake: Prepare script for 'dist'-like targets
'dist' is the same as before only difference: add date and commit hash for development and pre-release
Diffstat (limited to 'CMakeScripts')
-rw-r--r--CMakeScripts/Dist.cmake24
-rw-r--r--CMakeScripts/inkscape-version.cmake11
2 files changed, 30 insertions, 5 deletions
diff --git a/CMakeScripts/Dist.cmake b/CMakeScripts/Dist.cmake
new file mode 100644
index 000000000..21d233d87
--- /dev/null
+++ b/CMakeScripts/Dist.cmake
@@ -0,0 +1,24 @@
+# dist targets for various platforms
+
+set(INKSCAPE_DIST_PREFIX "${PROJECT_NAME}-${INKSCAPE_VERSION}")
+
+# get INKSCAPE_REVISION of the source
+set(INKSCAPE_SOURCE_DIR ${CMAKE_SOURCE_DIR})
+include(CMakeScripts/inkscape-version.cmake)
+
+if(INKSCAPE_VERSION_SUFFIX AND INKSCAPE_REVISION_DATE AND INKSCAPE_REVISION_HASH)
+ set(INKSCAPE_DIST_PREFIX ${INKSCAPE_DIST_PREFIX}_${INKSCAPE_REVISION_DATE}_${INKSCAPE_REVISION_HASH})
+endif()
+
+
+# -----------------------------------------------------------------------------
+# 'dist' - generate source release tarball
+# -----------------------------------------------------------------------------
+
+add_custom_target(dist
+ COMMAND sed -i "s/unknown/${INKSCAPE_REVISION}/" CMakeScripts/inkscape-version.cmake
+ && tar cfz ${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.tar.gz ${CMAKE_SOURCE_DIR}/doc --exclude=".*" --exclude-vcs-ignores
+ || git checkout ${CMAKE_SOURCE_DIR}/CMakeScripts/inkscape-version.cmake
+ COMMAND git checkout ${CMAKE_SOURCE_DIR}/CMakeScripts/inkscape-version.cmake # duplicate to make sure we actually revert in case of error
+ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
+ VERBATIM)
diff --git a/CMakeScripts/inkscape-version.cmake b/CMakeScripts/inkscape-version.cmake
index 7d6533a72..163490764 100644
--- a/CMakeScripts/inkscape-version.cmake
+++ b/CMakeScripts/inkscape-version.cmake
@@ -1,8 +1,9 @@
# This is called by cmake as an extermal process from
# ./src/CMakeLists.txt and creates inkscape-version.cpp
#
-# It's also included directly in ./CMakeLists.txt to
-# determine INKSCAPE_REVISION for the 'dist' target
+# 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}
@@ -13,13 +14,13 @@ set(INKSCAPE_REVISION "unknown")
if(EXISTS ${INKSCAPE_SOURCE_DIR}/.git)
execute_process(COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${INKSCAPE_SOURCE_DIR}
- OUTPUT_VARIABLE INKSCAPE_REV_HASH
+ 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_REV_DATE
+ OUTPUT_VARIABLE INKSCAPE_REVISION_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE)
- set(INKSCAPE_REVISION "${INKSCAPE_REV_HASH}, ${INKSCAPE_REV_DATE}")
+ set(INKSCAPE_REVISION "${INKSCAPE_REVISION_HASH}, ${INKSCAPE_REVISION_DATE}")
execute_process(COMMAND
git status -s ${INKSCAPE_SOURCE_DIR}/src