From 5a7c56f93443afa55eb20babf8ddac8d8076f8df Mon Sep 17 00:00:00 2001 From: Osyotr Date: Mon, 18 Jul 2022 23:10:46 +0300 Subject: [PATCH] [zopfli] Fix x64-linux-dynamic build (#25824) Co-authored-by: Osyotr <8740768+Osyotr@users.noreply.github.com> --- ports/zopfli/portfile.cmake | 57 ++++++++++++++++--------------------- ports/zopfli/vcpkg.json | 17 +++++++++-- versions/baseline.json | 2 +- versions/z-/zopfli.json | 5 ++++ 4 files changed, 45 insertions(+), 36 deletions(-) diff --git a/ports/zopfli/portfile.cmake b/ports/zopfli/portfile.cmake index 7ce1dfeffb..d796980a8e 100644 --- a/ports/zopfli/portfile.cmake +++ b/ports/zopfli/portfile.cmake @@ -6,64 +6,57 @@ vcpkg_from_github( HEAD_REF master ) -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" OPTIONS -DZOPFLI_BUILD_INSTALL=ON ) -vcpkg_install_cmake() +vcpkg_cmake_install() vcpkg_copy_pdbs() -if (NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") - set(EXECUTABLE_SUFFIX ".exe") -else() - set(EXECUTABLE_SUFFIX "") -endif() - # Install tools -file(COPY ${CURRENT_PACKAGES_DIR}/bin/zopfli${EXECUTABLE_SUFFIX} - DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT}) -file(COPY ${CURRENT_PACKAGES_DIR}/bin/zopflipng${EXECUTABLE_SUFFIX} - DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT}) -vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT}) +file(COPY "${CURRENT_PACKAGES_DIR}/bin/zopfli${VCPKG_TARGET_EXECUTABLE_SUFFIX}" + DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}") +file(COPY "${CURRENT_PACKAGES_DIR}/bin/zopflipng${VCPKG_TARGET_EXECUTABLE_SUFFIX}" + DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}") +vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}") -if(VCPKG_LIBRARY_LINKAGE STREQUAL static) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) -else() - file(REMOVE - ${CURRENT_PACKAGES_DIR}/bin/zopfli${EXECUTABLE_SUFFIX} - ${CURRENT_PACKAGES_DIR}/bin/zopflipng${EXECUTABLE_SUFFIX} - ${CURRENT_PACKAGES_DIR}/debug/bin/zopfli${EXECUTABLE_SUFFIX} - ${CURRENT_PACKAGES_DIR}/debug/bin/zopflipng${EXECUTABLE_SUFFIX} - ) +file(REMOVE + "${CURRENT_PACKAGES_DIR}/bin/zopfli${VCPKG_TARGET_EXECUTABLE_SUFFIX}" + "${CURRENT_PACKAGES_DIR}/bin/zopflipng${VCPKG_TARGET_EXECUTABLE_SUFFIX}" + "${CURRENT_PACKAGES_DIR}/debug/bin/zopfli${VCPKG_TARGET_EXECUTABLE_SUFFIX}" + "${CURRENT_PACKAGES_DIR}/debug/bin/zopflipng${VCPKG_TARGET_EXECUTABLE_SUFFIX}" +) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static" OR NOT VCPKG_TARGET_IS_WINDOWS) + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") endif() -vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/Zopfli) +vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/Zopfli") -# vcpkg_fixup_cmake_targets can not handles this on UNIX currently. +# vcpkg_cmake_config_fixup can not handles this on UNIX currently. if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux" OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin") - vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/share/zopfli/ZopfliConfig-debug.cmake + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/zopfli/ZopfliConfig-debug.cmake" "\"\${_IMPORT_PREFIX}/debug/bin/zopfli\"" "\"\${_IMPORT_PREFIX}/tools/zopfli/zopfli\"" ) - vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/share/zopfli/ZopfliConfig-debug.cmake + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/zopfli/ZopfliConfig-debug.cmake" "\"\${_IMPORT_PREFIX}/debug/bin/zopflipng\"" "\"\${_IMPORT_PREFIX}/tools/zopfli/zopflipng\"" ) - vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/share/zopfli/ZopfliConfig-release.cmake + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/zopfli/ZopfliConfig-release.cmake" "\"\${_IMPORT_PREFIX}/bin/zopfli\"" "\"\${_IMPORT_PREFIX}/tools/zopfli/zopfli\"" ) - vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/share/zopfli/ZopfliConfig-release.cmake + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/zopfli/ZopfliConfig-release.cmake" "\"\${_IMPORT_PREFIX}/bin/zopflipng\"" "\"\${_IMPORT_PREFIX}/tools/zopfli/zopflipng\"" ) endif() -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") -configure_file(${SOURCE_PATH}/COPYING ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY) +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING") diff --git a/ports/zopfli/vcpkg.json b/ports/zopfli/vcpkg.json index 668234f532..f0f895ab32 100644 --- a/ports/zopfli/vcpkg.json +++ b/ports/zopfli/vcpkg.json @@ -1,7 +1,18 @@ { "name": "zopfli", - "version-string": "1.0.3", - "port-version": 1, + "version": "1.0.3", + "port-version": 2, "description": "Zopfli Compression Algorithm compression library programmed in C", - "homepage": "https://github.com/google/zopfli" + "homepage": "https://github.com/google/zopfli", + "license": "Apache-2.0", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] } diff --git a/versions/baseline.json b/versions/baseline.json index 2753a32a29..9367bd2d7f 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -7846,7 +7846,7 @@ }, "zopfli": { "baseline": "1.0.3", - "port-version": 1 + "port-version": 2 }, "zpp-bits": { "baseline": "4.4.4", diff --git a/versions/z-/zopfli.json b/versions/z-/zopfli.json index 4377026026..20f84d691e 100644 --- a/versions/z-/zopfli.json +++ b/versions/z-/zopfli.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "a0451fdd88ef4beba9c0f572d219c0148ac28a25", + "version": "1.0.3", + "port-version": 2 + }, { "git-tree": "e80818813d5dfa5b563c84485d4a0030ce90906a", "version-string": "1.0.3",