vcpkg/ports/graphicsmagick/portfile.cmake
David Ludwig d68cc287f9 [GraphicsMagick] bug-fix: image files won't load (#4215)
* [GraphicsMagick] bug-fix: image files won't load

GM (GraphicsMagick) was failing to load image files, notably PNG or JPEG
images, as it was being compiled with support for 'GraphicsMagick
Modules'.  These are files with names specific to GM, and of the format,
'IM_*.dll'.  vcpkg's install process was not setting these up.  This
patch makes sure that when GM is built, it embed's GM's own
image-loading code into graphicsmagick.dll.

* [vcpkg_extract_source_archive_ex] Add PATCHES argument

* [openmesh] Use direct download instead of gitlab

* [blaze] Use PATCHES argument

* [graphicsmagick] Use vcpkg_extract_source_archive_ex
2018-09-04 16:20:46 -07:00

51 lines
2.1 KiB
CMake

include(vcpkg_common_functions)
set(GM_VERSION 1.3.30)
vcpkg_download_distfile(ARCHIVE
URLS "https://sourceforge.net/projects/graphicsmagick/files/graphicsmagick/${GM_VERSION}/GraphicsMagick-${GM_VERSION}-windows-source.7z"
FILENAME "GraphicsMagick-${GM_VERSION}-windows-source.7z"
SHA512 9e4cfff57ae547f133e6208033213d3aa790cd8c95a061c101c63b8ae8896e7504d02f302efdd20ff24f72c07760a0a5e2b32e21fe454717ed1deb2edeef159c
)
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
REF "${GM_VERSION}"
PATCHES
# GM always requires a dynamic BZIP2. This patch makes this dependent if _DLL is defined
dynamic_bzip2.patch
# Bake GM's own modules into the .dll itself. This fixes a bug whereby
# 'vcpkg install graphicsmagick' did not lead to a copy of GM that could
# load either PNG or JPEG files (due to missing GM Modules, with names
# matching "IM_*.DLL").
disable_graphicsmagick_modules.patch
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/magick_types.h DESTINATION ${SOURCE_PATH}/magick)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS_DEBUG
-DINSTALL_HEADERS=OFF
)
vcpkg_install_cmake()
# copy license
file(COPY ${SOURCE_PATH}/Copyright.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/graphicsmagick)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/graphicsmagick/Copyright.txt ${CURRENT_PACKAGES_DIR}/share/graphicsmagick/copyright)
# copy config
file(COPY ${SOURCE_PATH}/config/colors.mgk DESTINATION ${CURRENT_PACKAGES_DIR}/share/graphicsmagick/config)
file(COPY ${SOURCE_PATH}/config/log.mgk DESTINATION ${CURRENT_PACKAGES_DIR}/share/graphicsmagick/config)
file(COPY ${SOURCE_PATH}/config/modules.mgk DESTINATION ${CURRENT_PACKAGES_DIR}/share/graphicsmagick/config)
file(READ ${SOURCE_PATH}/config/type-windows.mgk.in TYPE_MGK)
string(REPLACE "@windows_font_dir@" "$ENV{SYSTEMROOT}/Fonts/" TYPE_MGK "${TYPE_MGK}")
file(WRITE ${CURRENT_PACKAGES_DIR}/share/graphicsmagick/config/type.mgk "${TYPE_MGK}")
vcpkg_copy_pdbs()