diff options
| author | Eduard Braun <eduard.braun2@gmx.de> | 2017-07-23 01:49:44 +0000 |
|---|---|---|
| committer | Eduard Braun <eduard.braun2@gmx.de> | 2017-07-23 01:56:45 +0000 |
| commit | 15411fb26adad78f71e27146be8b8d1b1a18c0f6 (patch) | |
| tree | 2552c47bdc1919ff2b86e0b5c066a93e7da916ef | |
| parent | Drop ChangeLog (diff) | |
| parent | sync detail fields of .exe and .msi installers (diff) | |
| download | inkscape-15411fb26adad78f71e27146be8b8d1b1a18c0f6.tar.gz inkscape-15411fb26adad78f71e27146be8b8d1b1a18c0f6.zip | |
cmake/packaging: add 'dist' targets for Windows
These allow to automatically create binary distributions for Windows.
Available targets:
- dist-win-7z (.7z binary archive)
- dist-win-exe (.exe installer using NSIS)
- dist-win-msi (.msi installer using WiX Toolset)
- dist-win-all (executes all of the above - in parallel!)
The three individual targets may also be suffixed with '-fast' which
use a faster/no compression algorithm intended for testing purposes
| -rw-r--r-- | CMakeLists.txt | 14 | ||||
| -rw-r--r-- | CMakeScripts/Dist.cmake | 138 | ||||
| -rw-r--r-- | CMakeScripts/inkscape-version.cmake | 11 | ||||
| -rw-r--r-- | packaging/win32/inkscape.nsi | 4 | ||||
| -rwxr-xr-x | packaging/wix/files.py | 5 | ||||
| -rw-r--r-- | packaging/wix/inkscape.wxs | 4 |
6 files changed, 153 insertions, 23 deletions
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..f54deabc4 --- /dev/null +++ b/CMakeScripts/Dist.cmake @@ -0,0 +1,138 @@ +# 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) + + + +# ----------------------------------------------------------------------------- +# '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 ${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}") + + 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) + + # ----------------------------------------------------------------------------- + # '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) + + # ----------------------------------------------------------------------------- + # '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() 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 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 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)+ "<Component Id='component" + _id + "' Guid='" + str(uuid.uuid4()) + "' DiskId='1' Win64='$(var.Win64)'>\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)+ "<File Id='file" + _id + "' Name='" + file + "' DiskId='1' Source='" + file_key + "' KeyPath='yes' />\n") wxs.write(indent(level)+ "</Component>\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 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 @@ <?include version.wxi?>
<!-- change Product Id for every new version and subversion, do not change UpgradeCode -->
- <Product Name="$(var.FullProductName)" Id='81922150-317e-4bb0-a31d-ff1c14f707c5' UpgradeCode='4d5fedaa-84a0-48be-bd2a-08246398361a' Language='1033' Codepage='1252' Version='$(var.ProductVersion)' Manufacturer='inkscape.org'>
+ <Product Name="$(var.FullProductName)" Id='81922150-317e-4bb0-a31d-ff1c14f707c5' UpgradeCode='4d5fedaa-84a0-48be-bd2a-08246398361a' Language='1033' Codepage='1252' Version='$(var.ProductVersion)' Manufacturer='Inkscape project'>
- <Package Id='*' Keywords='Installer' Description="Inkscape Installer" Comments='inkscape is registered trademark of inkscape.org' Manufacturer='inkscape.org' InstallerVersion='$(var.InstallerVersion)' Platform='$(var.Platform)' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
+ <Package Id='*' Keywords='SVG, vector graphics' Description="Installer for Inkscape vector graphics editor" Comments='Licensed under the GNU GPL' Manufacturer='Inkscape project' InstallerVersion='$(var.InstallerVersion)' Platform='$(var.Platform)' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
<Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" CompressionLevel="high"/>
<Property Id='DiskPrompt' Value="inkscape Installation [1]" />
|
