vcpkg/ports/zlib/portfile.cmake
Billy O'Neal e0a9559a9b
[zlib, minizip] Update to 1.2.13, and embed the ZLIB_DLL setting. (#27226)
* Don't use external ZLIB_DLL

* Update versions

* [minizip] Bump to zlib version

* Update versions

* [libkml] Fix mingw build

* [libkml] Modernize

* [libkml] Fix minizip dependency

* [libkml] No DLL

* Update versions

* [libkml] Update mingw patch

* Update versions

* Update versions

* [zlib] Update to 1.2.13

This picks up the official fix for CVE-2022-37434.

* Cherry pick installing the correct license from https://github.com/microsoft/vcpkg/pull/27242/

* Update version database.

* More version database.

* Also update minizip.

* Also guard ZLIB_DLL properties for BUILD_SHARED_LIBS.

* Version database.

* Fix minizip usage.

Co-authored-by: Kai Pastor <dg0yt@darc.de>
2022-10-25 10:24:48 -07:00

54 lines
2.1 KiB
CMake

# When this port is updated, the minizip port should be updated at the same time
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO madler/zlib
REF v1.2.13
SHA512 44b834fbfb50cca229209b8dbe1f96b258f19a49f5df23b80970b716371d856a4adf525edb4c6e0e645b180ea949cb90f5365a1d896160f297f56794dd888659
HEAD_REF master
PATCHES
0001-Prevent-invalid-inclusions-when-HAVE_-is-set-to-0.patch
0002-skip-building-examples.patch
0003-build-static-or-shared-not-both.patch
0004-android-and-mingw-fixes.patch
)
# This is generated during the cmake build
file(REMOVE "${SOURCE_PATH}/zconf.h")
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DSKIP_INSTALL_FILES=ON
OPTIONS_DEBUG
-DSKIP_INSTALL_HEADERS=ON
)
vcpkg_cmake_install()
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
# Install the pkgconfig file
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_replace_string("${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/zlib.pc" "-lz" "-lzlib")
endif()
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/zlib.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/lib/pkgconfig")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_replace_string("${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/zlib.pc" "-lz" "-lzlibd")
endif()
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/zlib.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig")
endif()
vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/zconf.h" "ifdef ZLIB_DLL" "if 0")
else()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/zconf.h" "ifdef ZLIB_DLL" "if 1")
endif()
file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)