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 --- CMakeLists.txt | 14 ++------------ CMakeScripts/Dist.cmake | 24 ++++++++++++++++++++++++ CMakeScripts/inkscape-version.cmake | 11 ++++++----- 3 files changed, 32 insertions(+), 17 deletions(-) create mode 100644 CMakeScripts/Dist.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d90d1349..42d4bbe6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -161,19 +161,9 @@ if (ENABLE_BINRELOC) endif() # ----------------------------------------------------------------------------- -# Dist Target +# Dist Targets # ----------------------------------------------------------------------------- -set(INKSCAPE_SOURCE_DIR ${CMAKE_SOURCE_DIR}) -include(CMakeScripts/inkscape-version.cmake) - -set(INKSCAPE_DIST_PREFIX "${PROJECT_NAME}-${INKSCAPE_VERSION}") -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) +include(CMakeScripts/Dist.cmake) # ----------------------------------------------------------------------------- # Uninstall Target 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(+) 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 ++++++++++++++++++++++++++++ packaging/win32/inkscape.nsi | 4 ++-- 2 files changed, 30 insertions(+), 2 deletions(-) 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() diff --git a/packaging/win32/inkscape.nsi b/packaging/win32/inkscape.nsi index fb83c3ed5..7ef5bfcc9 100644 --- a/packaging/win32/inkscape.nsi +++ b/packaging/win32/inkscape.nsi @@ -19,7 +19,7 @@ ; Unicode, compression and admin requirement {{{2 Unicode true SetCompressor /SOLID lzma -SetCompressorDictSize 32 +SetCompressorDictSize 64 RequestExecutionLevel admin ; Include required files {{{2 @@ -299,7 +299,7 @@ Section "$(Core)" SecCore ; Mandatory Inkscape core files section {{{ File /a ${INKSCAPE_DIST_DIR}\NEWS File /a ${INKSCAPE_DIST_DIR}\gspawn-win${BITNESS}-helper.exe File /a ${INKSCAPE_DIST_DIR}\gspawn-win${BITNESS}-helper-console.exe - File /a ${INKSCAPE_DIST_DIR}\README + File /a ${INKSCAPE_DIST_DIR}\README.md File /a ${INKSCAPE_DIST_DIR}\TRANSLATORS !insertmacro UNINSTALL.LOG_CLOSE_INSTALL -- 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 ++++++++++++++++++++++++++++++++++++++++++++--- packaging/wix/files.py | 5 +++-- 2 files changed, 47 insertions(+), 5 deletions(-) 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() diff --git a/packaging/wix/files.py b/packaging/wix/files.py index 70e5f29c0..dd5d72381 100755 --- a/packaging/wix/files.py +++ b/packaging/wix/files.py @@ -40,16 +40,17 @@ def directory(root, breadcrumb, level, exclude=[]): files = [ f for f in os.listdir(root) if os.path.isfile(os.path.join(root,f)) and f not in exclude] for file in files: file_key = os.path.join(root, file) + file_key = file_key.replace('/', '\\') # for usage from MSYS2 shell _id = '_%06d' % (len(file_ids.keys()) + 1) file_ids[file_key] = 'component' + _id wxs.write(indent(level)+ "\n") if file == 'inkscape.exe': - # we refenrence inkscape.exe in inkscape.wxs + # we reference inkscape.exe in inkscape.wxs _id = '_inkscape_exe' wxs.write(indent(level + 1)+ "\n") wxs.write(indent(level)+ "\n") - # then all directories + # then all directories dirs = [ f for f in os.listdir(root) if os.path.isdir(os.path.join(root,f)) ] for dir in dirs: directory_key = breadcrumb + '__' + dir -- 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(+) 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(+) 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 63886f85e5993f7b6ef6b5590a3a412f3cadee15 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 23 Jul 2017 03:48:04 +0200 Subject: sync detail fields of .exe and .msi installers --- packaging/wix/inkscape.wxs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/wix/inkscape.wxs b/packaging/wix/inkscape.wxs index 40b07941b..3dad2ca4c 100644 --- a/packaging/wix/inkscape.wxs +++ b/packaging/wix/inkscape.wxs @@ -3,9 +3,9 @@ - + - + -- cgit v1.2.3