[zlib-ng] Fix pkg-config file for windows (#39163)

Fix #39141. Fix the library name for `pkg-config` is `z-ng` but output
name is `zlib-ng[d].lib` for windows.
This commit is contained in:
WangWeiLin-MV 2024-06-11 06:50:07 +08:00 committed by GitHub
parent 856cd497b0
commit 0f6d405151
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 35 additions and 1 deletions

View File

@ -17,6 +17,34 @@ vcpkg_cmake_configure(
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
# Condition in `WIN32`, from https://github.com/zlib-ng/zlib-ng/blob/2.1.5/CMakeLists.txt#L1081-L1100
# (dynamic) for `zlib` or (static `MSVC) for `zlibstatic` or default `z`
# i.e. (windows) and not (static mingw) https://learn.microsoft.com/en-us/vcpkg/maintainers/variables#vcpkg_target_is_system
if(VCPKG_TARGET_IS_WINDOWS AND (NOT (VCPKG_LIBRARY_LINKAGE STREQUAL static AND VCPKG_TARGET_IS_MINGW)))
set(_port_suffix)
if(ZLIB_COMPAT)
set(_port_suffix "")
else()
set(_port_suffix "-ng")
endif()
set(_port_output_name)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(_port_output_name "zlib${_port_suffix}")
else()
set(_port_output_name "zlibstatic${_port_suffix}")
endif()
# CMAKE_DEBUG_POSTFIX from https://github.com/zlib-ng/zlib-ng/blob/2.1.5/CMakeLists.txt#L494
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/zlib${_port_suffix}.pc" " -lz${_port_suffix}" " -l${_port_output_name}")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/zlib${_port_suffix}.pc" " -lz${_port_suffix}" " -l${_port_output_name}d")
endif()
endif()
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share"

View File

@ -1,6 +1,7 @@
{
"name": "zlib-ng",
"version": "2.1.5",
"port-version": 1,
"description": "zlib replacement with optimizations for 'next generation' systems",
"homepage": "https://github.com/zlib-ng/zlib-ng",
"license": "Zlib",

View File

@ -9686,7 +9686,7 @@
},
"zlib-ng": {
"baseline": "2.1.5",
"port-version": 0
"port-version": 1
},
"zlmediakit": {
"baseline": "2024-03-30",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "3f7c39c070cb4f55a281ebe3a178b4f7e896dea8",
"version": "2.1.5",
"port-version": 1
},
{
"git-tree": "e612211a2cf602a9a95796202f9cba452c6f5ebc",
"version": "2.1.5",