From f8d51951c05462f98ab120573bb8b58d15943c66 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Fri, 21 Jul 2017 05:23:07 +0200 Subject: 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 --- CMakeScripts/Dist.cmake | 24 ++++++++++++++++++++++++ CMakeScripts/inkscape-version.cmake | 11 ++++++----- 2 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 CMakeScripts/Dist.cmake (limited to 'CMakeScripts') 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 -- cgit v1.2.3 From 1a8cb62b8ce5077c99054c1f5a3236e12694e1c7 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Fri, 21 Jul 2017 05:26:40 +0200 Subject: cmake: Add 'dist' target to create Windows binary archive - 'dist-win-7z' allows to create a binary distribution archive compressed with 7z format - 'dist-win-7z-fast' has slightly worse compression but is considerably faster --- CMakeScripts/Dist.cmake | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'CMakeScripts') diff --git a/CMakeScripts/Dist.cmake b/CMakeScripts/Dist.cmake index 21d233d87..061e187af 100644 --- a/CMakeScripts/Dist.cmake +++ b/CMakeScripts/Dist.cmake @@ -22,3 +22,41 @@ add_custom_target(dist 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) + + + +# ----------------------------------------------------------------------------- +# 'dist-win' - Windows Targets +# ----------------------------------------------------------------------------- +if(WIN32) + if(HAVE_MINGW64) + set(bitness "x64") + else() + set(bitness "x86") + endif() + set(INKSCAPE_DIST_PREFIX ${INKSCAPE_DIST_PREFIX}-${bitness}) + + # ----------------------------------------------------------------------------- + # 'dist-win-7z' - generate binary 7z archive for Windows + # ----------------------------------------------------------------------------- + + find_program(7z 7z PATHS "C:\\Program Files\\7-Zip" + "C:\\Program Files (x86)\\7-Zip") + if(NOT 7z) + set(7z echo "Could not find '7z'. Please add it to your search path." && exit 1 &&) + endif() + + # default target with very good but slow compression (needs approx. 10 GB RAM) + add_custom_target(dist-win-7z + COMMAND ${7z} a -mx9 -md512m -mfb256 + "${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.7z" + "${CMAKE_INSTALL_PREFIX}") + + # fast target with moderate compression + add_custom_target(dist-win-7z-fast + COMMAND ${7z} a + "${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.7z" + "${CMAKE_INSTALL_PREFIX}") + + add_dependencies(dist-win-7z install/strip) + add_dependencies(dist-win-7z-fast install/strip) -- cgit v1.2.3 From d791282ea1f8e216eda65753485b6bd7fca5ce2f Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 23 Jul 2017 00:30:07 +0200 Subject: cmake: Add 'dist' target to create Windows .exe installer - 'dist-win-exe' allows to create a Windows .exe installer using NSIS - 'dist-win-exe-fast' has a bad compression ratio but is much faster and can be used for testing purposes --- CMakeScripts/Dist.cmake | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'CMakeScripts') diff --git a/CMakeScripts/Dist.cmake b/CMakeScripts/Dist.cmake index 061e187af..2d9d3835c 100644 --- a/CMakeScripts/Dist.cmake +++ b/CMakeScripts/Dist.cmake @@ -60,3 +60,31 @@ if(WIN32) add_dependencies(dist-win-7z install/strip) add_dependencies(dist-win-7z-fast install/strip) + + + # ----------------------------------------------------------------------------- + # 'dist-win-exe' - generate .exe installer (NSIS) for Windows + # ----------------------------------------------------------------------------- + + find_program (makensis makensis PATHS "C:\\Program Files\\NSIS" + "C:\\Program Files (x86)\\NSIS") + if(NOT makensis) + set(makensis echo "Could not find 'makensis'. Please add it to your search path." && exit 1 &&) + endif() + + # default target with good but slow compression + add_custom_target(dist-win-exe + COMMAND ${makensis} /D"INKSCAPE_DIST_DIR=${CMAKE_INSTALL_PREFIX}" + /D"OutFile=${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.exe" + "${CMAKE_SOURCE_DIR}/packaging/win32/inkscape.nsi") + + # fast target with low compression for testing + add_custom_target(dist-win-exe-fast + COMMAND ${makensis} /X"SetCompressor /FINAL /SOLID bzip2" + /D"INKSCAPE_DIST_DIR=${CMAKE_INSTALL_PREFIX}" + /D"OutFile=${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.exe" + "${CMAKE_SOURCE_DIR}/packaging/win32/inkscape.nsi") + + add_dependencies(dist-win-exe install/strip) + add_dependencies(dist-win-exe-fast install/strip) +endif() -- cgit v1.2.3 From ea172cdb15ba9780da806b5190c9dbb0a74231bd Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 23 Jul 2017 03:07:03 +0200 Subject: cmake: Add 'dist' target to create Windows .msi installer - 'dist-win-msi' allows to create a Windows .msi installer using WiX - 'dist-win-msi-fast' has a no compression but is much faster and can be used for testing purposes --- CMakeScripts/Dist.cmake | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) (limited to 'CMakeScripts') diff --git a/CMakeScripts/Dist.cmake b/CMakeScripts/Dist.cmake index 2d9d3835c..32e3f5a4f 100644 --- a/CMakeScripts/Dist.cmake +++ b/CMakeScripts/Dist.cmake @@ -39,7 +39,6 @@ if(WIN32) # ----------------------------------------------------------------------------- # 'dist-win-7z' - generate binary 7z archive for Windows # ----------------------------------------------------------------------------- - find_program(7z 7z PATHS "C:\\Program Files\\7-Zip" "C:\\Program Files (x86)\\7-Zip") if(NOT 7z) @@ -61,11 +60,9 @@ if(WIN32) add_dependencies(dist-win-7z install/strip) add_dependencies(dist-win-7z-fast install/strip) - # ----------------------------------------------------------------------------- # 'dist-win-exe' - generate .exe installer (NSIS) for Windows # ----------------------------------------------------------------------------- - find_program (makensis makensis PATHS "C:\\Program Files\\NSIS" "C:\\Program Files (x86)\\NSIS") if(NOT makensis) @@ -87,4 +84,48 @@ if(WIN32) add_dependencies(dist-win-exe install/strip) add_dependencies(dist-win-exe-fast install/strip) + + # ----------------------------------------------------------------------------- + # 'dist-win-msi' - generate .exe installer (NSIS) for Windows + # ----------------------------------------------------------------------------- + find_program (candle candle PATHS "C:\\Program Files\\WiX Toolset v3.10\\bin" + "C:\\Program Files (x86)\\WiX Toolset v3.10\\bin") + find_program (light light PATHS "C:\\Program Files\\WiX Toolset v3.10\\bin" + "C:\\Program Files (x86)\\WiX Toolset v3.10\\bin") + if(NOT candle) + set(candle echo "Could not find 'candle' (part of WiX Toolset). Please add it to your search path." && exit 1 &&) + endif() + if(NOT light) + set(light echo "Could not find 'light' (part of WiX Toolset). Please add it to your search path." && exit 1 &&) + endif() + + # default target with fair but slow compression + add_custom_target(dist-win-msi + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/packaging/wix ${CMAKE_BINARY_DIR}/wix + COMMAND cd wix + COMMAND ${CMAKE_COMMAND} -E env INKSCAPE_DIST_PATH=${CMAKE_INSTALL_PREFIX} + python ${CMAKE_SOURCE_DIR}/packaging/wix/files.py + COMMAND ${CMAKE_COMMAND} -E env INKSCAPE_DIST_PATH=${CMAKE_INSTALL_PREFIX} + python ${CMAKE_SOURCE_DIR}/packaging/wix/version.py + COMMAND ${candle} inkscape.wxs -ext WiXUtilExtension + COMMAND ${candle} files.wxs + COMMAND ${light} -ext WixUIExtension -ext WiXUtilExtension inkscape.wixobj files.wixobj + -o ${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.msi) + + # moderately fast target with no compression for testing + add_custom_target(dist-win-msi-fast + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/packaging/wix ${CMAKE_BINARY_DIR}/wix + COMMAND cd wix + COMMAND sed -i 's/CompressionLevel="high"/CompressionLevel="none"/' inkscape.wxs + COMMAND ${CMAKE_COMMAND} -E env INKSCAPE_DIST_PATH=${CMAKE_INSTALL_PREFIX} + python ${CMAKE_SOURCE_DIR}/packaging/wix/files.py + COMMAND ${CMAKE_COMMAND} -E env INKSCAPE_DIST_PATH=${CMAKE_INSTALL_PREFIX} + python ${CMAKE_SOURCE_DIR}/packaging/wix/version.py + COMMAND ${candle} inkscape.wxs -ext WiXUtilExtension + COMMAND ${candle} files.wxs + COMMAND ${light} -ext WixUIExtension -ext WiXUtilExtension inkscape.wixobj files.wixobj + -o ${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.msi) + + add_dependencies(dist-win-msi install/strip) + add_dependencies(dist-win-msi-fast install/strip) endif() -- cgit v1.2.3 From 2049765ec47898149310368efbe8b58b813cb20d Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 23 Jul 2017 03:34:28 +0200 Subject: cmake: Add 'dist-win-all' target This creates all currently supported forms of distribution: - .7z archive - .exe installer - .msi installer --- CMakeScripts/Dist.cmake | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'CMakeScripts') diff --git a/CMakeScripts/Dist.cmake b/CMakeScripts/Dist.cmake index 32e3f5a4f..eece0122d 100644 --- a/CMakeScripts/Dist.cmake +++ b/CMakeScripts/Dist.cmake @@ -128,4 +128,9 @@ if(WIN32) add_dependencies(dist-win-msi install/strip) add_dependencies(dist-win-msi-fast install/strip) + + # ----------------------------------------------------------------------------- + # 'dist-win-all' - generate all 'dist' targets for Windows + # ----------------------------------------------------------------------------- + add_custom_target(dist-win-all DEPENDS dist-win-7z dist-win-exe dist-win-msi) endif() -- cgit v1.2.3 From 3bd48d3cd23247a09ddce6b64cd4922ef1639108 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 23 Jul 2017 03:35:19 +0200 Subject: delete old 7z archive, otherwise we try to add to it --- CMakeScripts/Dist.cmake | 2 ++ 1 file changed, 2 insertions(+) (limited to 'CMakeScripts') diff --git a/CMakeScripts/Dist.cmake b/CMakeScripts/Dist.cmake index eece0122d..f54deabc4 100644 --- a/CMakeScripts/Dist.cmake +++ b/CMakeScripts/Dist.cmake @@ -47,12 +47,14 @@ if(WIN32) # default target with very good but slow compression (needs approx. 10 GB RAM) add_custom_target(dist-win-7z + COMMAND ${CMAKE_COMMAND} -E remove "${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.7z" COMMAND ${7z} a -mx9 -md512m -mfb256 "${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.7z" "${CMAKE_INSTALL_PREFIX}") # fast target with moderate compression add_custom_target(dist-win-7z-fast + COMMAND ${CMAKE_COMMAND} -E remove "${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.7z" COMMAND ${7z} a "${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.7z" "${CMAKE_INSTALL_PREFIX}") -- cgit v1.2.3 From ece9cc31854c0eab7b3073fd9ee1e109bf283f92 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 23 Jul 2017 20:37:44 +0200 Subject: cmake/MSYS2: install only required library translations Exclude translations for which Inkscape does not provide a transltation --- CMakeScripts/InstallMSYS2.cmake | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'CMakeScripts') diff --git a/CMakeScripts/InstallMSYS2.cmake b/CMakeScripts/InstallMSYS2.cmake index 3bad4b839..5ad3b9d3e 100644 --- a/CMakeScripts/InstallMSYS2.cmake +++ b/CMakeScripts/InstallMSYS2.cmake @@ -143,12 +143,16 @@ if(WIN32) DESTINATION share/icons) # translations for libraries (we usually shouldn't need many) - install(DIRECTORY ${MINGW_PATH}/share/locale - DESTINATION share - FILES_MATCHING - PATTERN "*glib20.mo" - PATTERN "*gtk30.mo" - PATTERN "*gtkspell3.mo") + file(GLOB inkscape_translations RELATIVE ${CMAKE_SOURCE_DIR}/po/ ${CMAKE_SOURCE_DIR}/po/*.po) + foreach(translation ${inkscape_translations}) + get_filename_component(translation ${translation} NAME_WE) + install(DIRECTORY ${MINGW_PATH}/share/locale/${translation} + DESTINATION share/locale + FILES_MATCHING + PATTERN "*glib20.mo" + PATTERN "*gtk30.mo" + PATTERN "*gtkspell3.mo") + endforeach() install(DIRECTORY ${MINGW_PATH}/share/poppler DESTINATION share) -- cgit v1.2.3 From e6f64503b09d71e8d6c08d1956637d4f15a2dbd7 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Mon, 24 Jul 2017 21:41:12 +0200 Subject: CI/AppVeyor: Use dist-win targets and create installers on tag Use a globbing expression to get WiX location as it's dependent on the version installed. Add note about the .msi installer still not being created properly and wix exiting with an error code (mostly to make CI happy). Somebody should figure this out eventually but the .msi format cost me too many hours of my life already... --- CMakeScripts/Dist.cmake | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'CMakeScripts') diff --git a/CMakeScripts/Dist.cmake b/CMakeScripts/Dist.cmake index f54deabc4..9b40d36c8 100644 --- a/CMakeScripts/Dist.cmake +++ b/CMakeScripts/Dist.cmake @@ -6,9 +6,6 @@ set(INKSCAPE_DIST_PREFIX "${PROJECT_NAME}-${INKSCAPE_VERSION}") 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() # ----------------------------------------------------------------------------- @@ -29,6 +26,9 @@ add_custom_target(dist # 'dist-win' - Windows Targets # ----------------------------------------------------------------------------- if(WIN32) + if(INKSCAPE_REVISION_DATE AND INKSCAPE_REVISION_HASH) + set(INKSCAPE_DIST_PREFIX ${INKSCAPE_DIST_PREFIX}_${INKSCAPE_REVISION_DATE}_${INKSCAPE_REVISION_HASH}) + endif() if(HAVE_MINGW64) set(bitness "x64") else() @@ -39,8 +39,8 @@ if(WIN32) # ----------------------------------------------------------------------------- # 'dist-win-7z' - generate binary 7z archive for Windows # ----------------------------------------------------------------------------- - find_program(7z 7z PATHS "C:\\Program Files\\7-Zip" - "C:\\Program Files (x86)\\7-Zip") + find_program(7z 7z PATHS "C:/Program Files/7-Zip" + "C:/Program Files (x86)/7-Zip") if(NOT 7z) set(7z echo "Could not find '7z'. Please add it to your search path." && exit 1 &&) endif() @@ -65,8 +65,8 @@ if(WIN32) # ----------------------------------------------------------------------------- # 'dist-win-exe' - generate .exe installer (NSIS) for Windows # ----------------------------------------------------------------------------- - find_program (makensis makensis PATHS "C:\\Program Files\\NSIS" - "C:\\Program Files (x86)\\NSIS") + find_program (makensis makensis PATHS "C:/Program Files/NSIS" + "C:/Program Files (x86)/NSIS") if(NOT makensis) set(makensis echo "Could not find 'makensis'. Please add it to your search path." && exit 1 &&) endif() @@ -90,10 +90,10 @@ if(WIN32) # ----------------------------------------------------------------------------- # 'dist-win-msi' - generate .exe installer (NSIS) for Windows # ----------------------------------------------------------------------------- - find_program (candle candle PATHS "C:\\Program Files\\WiX Toolset v3.10\\bin" - "C:\\Program Files (x86)\\WiX Toolset v3.10\\bin") - find_program (light light PATHS "C:\\Program Files\\WiX Toolset v3.10\\bin" - "C:\\Program Files (x86)\\WiX Toolset v3.10\\bin") + file(GLOB wix_dirs "C:/Program Files/WiX Toolset*/bin") + file(GLOB wix_dirs_x86 "C:/Program Files (x86)/WiX Toolset*/bin") + find_program (candle candle PATHS ${wix_dirs} ${wix_dirs_x86}) + find_program (light light PATHS ${wix_dirs} ${wix_dirs_x86}) if(NOT candle) set(candle echo "Could not find 'candle' (part of WiX Toolset). Please add it to your search path." && exit 1 &&) endif() @@ -112,7 +112,8 @@ if(WIN32) COMMAND ${candle} inkscape.wxs -ext WiXUtilExtension COMMAND ${candle} files.wxs COMMAND ${light} -ext WixUIExtension -ext WiXUtilExtension inkscape.wixobj files.wixobj - -o ${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.msi) + -o ${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.msi + || echo "WiX exited with non-zero exit code (which is a known issue and usually does not prevent creation of an installer). If you can, please fix it, though!") # moderately fast target with no compression for testing add_custom_target(dist-win-msi-fast @@ -126,7 +127,8 @@ if(WIN32) COMMAND ${candle} inkscape.wxs -ext WiXUtilExtension COMMAND ${candle} files.wxs COMMAND ${light} -ext WixUIExtension -ext WiXUtilExtension inkscape.wixobj files.wixobj - -o ${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.msi) + -o ${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.msi + || echo "WiX exited with non-zero exit code (which is a known issue and usually does not prevent creation of an installer). If you can, please fix it, though!") add_dependencies(dist-win-msi install/strip) add_dependencies(dist-win-msi-fast install/strip) -- cgit v1.2.3