diff options
| author | Long Nguyen <nguyen.long.908132@gmail.com> | 2020-08-11 05:32:23 +0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-10 15:32:23 -0700 |
| commit | fca18ba3572f8aebe3b8158c359db62a7e26134e (patch) | |
| tree | f12d1e430165e16fae868fdafc83c33ed686e2a6 | |
| parent | ffd6ae40d5220e6c9b89bf1eeeb1f2b1b774edce (diff) | |
| download | vcpkg-fca18ba3572f8aebe3b8158c359db62a7e26134e.tar.gz vcpkg-fca18ba3572f8aebe3b8158c359db62a7e26134e.zip | |
[zlib, libpng] Fix pkg-config for mingw (#12753)
* [zlib] Fix pkg-config for mingw
* [libpng] Fix pkg-config for mingw
| -rw-r--r-- | ports/libpng/CONTROL | 3 | ||||
| -rw-r--r-- | ports/libpng/pkgconfig.2.patch | 21 | ||||
| -rw-r--r-- | ports/libpng/portfile.cmake | 20 | ||||
| -rw-r--r-- | ports/zlib/CONTROL | 2 | ||||
| -rw-r--r-- | ports/zlib/add_debug_postfix_on_mingw.patch | 13 | ||||
| -rw-r--r-- | ports/zlib/portfile.cmake | 1 |
6 files changed, 45 insertions, 15 deletions
diff --git a/ports/libpng/CONTROL b/ports/libpng/CONTROL index f05692745..988f95ebf 100644 --- a/ports/libpng/CONTROL +++ b/ports/libpng/CONTROL @@ -1,5 +1,6 @@ Source: libpng -Version: 1.6.37-10 +Version: 1.6.37 +Port-Version: 11 Build-Depends: zlib Homepage: https://github.com/glennrp/libpng Description: libpng is a library implementing an interface for reading and writing PNG (Portable Network Graphics) format files. diff --git a/ports/libpng/pkgconfig.2.patch b/ports/libpng/pkgconfig.2.patch index 8deab06d2..99c1b1930 100644 --- a/ports/libpng/pkgconfig.2.patch +++ b/ports/libpng/pkgconfig.2.patch @@ -1,8 +1,8 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 6f85d17ef..8de0eb299 100644 ---- a/CMakeLists.txt +index 6451fcf..4090f42 100644 +--- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -814,20 +814,31 @@ endif() +@@ -821,20 +821,31 @@ endif() # Only do this on Windows for Cygwin - the files don't make much sense outside # of a UNIX look-alike. if(NOT WIN32 OR CYGWIN OR MINGW) @@ -11,22 +11,22 @@ index 6f85d17ef..8de0eb299 100644 - set(libdir ${CMAKE_INSTALL_FULL_LIBDIR}) - set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR}) - set(LIBS "-lz -lm") -+ set(LIBS "-lz") -+ if(NOT APPLE) -+ string(APPEND LIBS " -lm") -+ endif() - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY) - create_symlink(libpng.pc FILE ${PNGLIB_NAME}.pc) - - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in - ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY) - create_symlink(libpng-config FILE ${PNGLIB_NAME}-config) +- create_symlink(libpng-config FILE ${PNGLIB_NAME}-config) ++ set(LIBS "-lz") ++ if(NOT APPLE) ++ string(APPEND LIBS " -lm") ++ endif() +else() + if(CMAKE_BUILD_TYPE STREQUAL "DEBUG") -+ set(LIBS "-lzlibd") ++ set(LIBS "-lzlibd") + else() -+ set(LIBS "-lzlib") ++ set(LIBS "-lzlib") + endif() endif() @@ -41,6 +41,7 @@ index 6f85d17ef..8de0eb299 100644 + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in + ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY) ++create_symlink(libpng-config FILE ${PNGLIB_NAME}-config) + # SET UP LINKS if(PNG_SHARED) diff --git a/ports/libpng/portfile.cmake b/ports/libpng/portfile.cmake index d8c7f7193..d366283b1 100644 --- a/ports/libpng/portfile.cmake +++ b/ports/libpng/portfile.cmake @@ -86,7 +86,11 @@ if(EXISTS ${_file}) else() string(REGEX REPLACE "-lpng16(d)?" "-lpng16d" _contents "${_contents}") endif() - string(REPLACE "-lzlib" "-lzlibd" _contents "${_contents}") + if(VCPKG_TARGET_IS_MINGW) + string(REPLACE "-lz" "-lzlibd" _contents "${_contents}") + else() + string(REPLACE "-lzlib" "-lzlibd" _contents "${_contents}") + endif() file(WRITE "${_file}" "${_contents}") endif() set(_file "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpng.pc") @@ -97,7 +101,11 @@ if(EXISTS ${_file}) else() string(REGEX REPLACE "-lpng16(d)?" "-lpng16d" _contents "${_contents}") endif() - string(REPLACE "-lzlib" "-lzlibd" _contents "${_contents}") + if(VCPKG_TARGET_IS_MINGW) + string(REPLACE "-lz" "-lzlibd" _contents "${_contents}") + else() + string(REPLACE "-lzlib" "-lzlibd" _contents "${_contents}") + endif() file(WRITE "${_file}" "${_contents}") endif() if(VCPKG_TARGET_IS_WINDOWS) @@ -105,16 +113,22 @@ if(VCPKG_TARGET_IS_WINDOWS) if(EXISTS ${_file}) file(READ "${_file}" _contents) string(REPLACE "-lpng16" "-llibpng16" _contents "${_contents}") + if(VCPKG_TARGET_IS_MINGW) + string(REPLACE "-lz" "-lzlib" _contents "${_contents}") + endif() file(WRITE "${_file}" "${_contents}") endif() set(_file "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libpng.pc") if(EXISTS ${_file}) file(READ "${_file}" _contents) string(REPLACE "-lpng16" "-llibpng16" _contents "${_contents}") + if(VCPKG_TARGET_IS_MINGW) + string(REPLACE "-lz" "-lzlib" _contents "${_contents}") + endif() file(WRITE "${_file}" "${_contents}") endif() endif() -vcpkg_fixup_pkgconfig() +vcpkg_fixup_pkgconfig(SYSTEM_LIBRARIES m) vcpkg_copy_pdbs() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) diff --git a/ports/zlib/CONTROL b/ports/zlib/CONTROL index b02b948ad..3196577b5 100644 --- a/ports/zlib/CONTROL +++ b/ports/zlib/CONTROL @@ -1,5 +1,5 @@ Source: zlib Version: 1.2.11 -Port-Version: 7 +Port-Version: 8 Homepage: https://www.zlib.net/ Description: A compression library diff --git a/ports/zlib/add_debug_postfix_on_mingw.patch b/ports/zlib/add_debug_postfix_on_mingw.patch new file mode 100644 index 000000000..22172ccfc --- /dev/null +++ b/ports/zlib/add_debug_postfix_on_mingw.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0fe939d..e4fc213 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -59,7 +59,7 @@ endif() + # + check_include_file(unistd.h Z_HAVE_UNISTD_H) + +-if(MSVC) ++if(WIN32) + set(CMAKE_DEBUG_POSTFIX "d") + add_definitions(-D_CRT_SECURE_NO_DEPRECATE) + add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) diff --git a/ports/zlib/portfile.cmake b/ports/zlib/portfile.cmake index c05e7e252..14faef4c8 100644 --- a/ports/zlib/portfile.cmake +++ b/ports/zlib/portfile.cmake @@ -12,6 +12,7 @@ vcpkg_extract_source_archive_ex( REF ${VERSION} PATCHES "cmake_dont_build_more_than_needed.patch" + "add_debug_postfix_on_mingw.patch" ) # This is generated during the cmake build |
