[zlib] Add pkgconfig file (#12133)

* [zlib] Add pkgconfig file

Install the zlib.pc file, which is generated during the CMake build.
Fix the pkgconfig file under Windows, where the lib is called zlib
instead of libz and add the postfix 'd' in case of a Windows debug
build.

* Check VCPKG_BUILD_TYPE to handle release/debug

* Simplify check of VCPKG_BUILD_TYPE to handle release/debug

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>

* Update PR according to review comments

- Remove include(vcpkg_common_functions)
- Comment out vcpkg_test_cmake(PACKAGE_NAME ZLIB MODULE)

* Update ports/zlib/portfile.cmake

* Update ports/zlib/CONTROL

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
Co-authored-by: Phoebe <20694052+PhoebeHui@users.noreply.github.com>
This commit is contained in:
Wolfgang Stöggl 2020-07-16 22:53:55 +02:00 committed by GitHub
parent 6bf5adff93
commit 273b5eddaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 5 deletions

View File

@ -1,4 +1,5 @@
Source: zlib
Version: 1.2.11-6
Version: 1.2.11
Port-Version: 7
Homepage: https://www.zlib.net/
Description: A compression library

View File

@ -1,5 +1,3 @@
include(vcpkg_common_functions)
set(VERSION 1.2.11)
vcpkg_download_distfile(ARCHIVE_FILE
@ -31,10 +29,26 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/zlib RENAME copyright)
# 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()
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
vcpkg_copy_pdbs()
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
vcpkg_test_cmake(PACKAGE_NAME ZLIB MODULE)
# vcpkg_test_cmake(PACKAGE_NAME ZLIB MODULE)