From fc54955667ee1365b00fc491af3bd1dddecb7b9d Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Fri, 14 Apr 2023 23:14:37 +0200 Subject: [PATCH] [ktx] Update and fixes (#30804) * [ktx] Update and fixes * Fix quirks --- ports/ktx/0003-libtool.patch | 22 -------------------- ports/ktx/0003-mkversion.patch | 13 ++++++++++++ ports/ktx/0004-quirks.patch | 21 +++++++++++++++++++ ports/ktx/portfile.cmake | 38 ++++++++++++++-------------------- ports/ktx/vcpkg.json | 18 +++++++++------- versions/baseline.json | 4 ++-- versions/k-/ktx.json | 5 +++++ 7 files changed, 68 insertions(+), 53 deletions(-) delete mode 100644 ports/ktx/0003-libtool.patch create mode 100644 ports/ktx/0003-mkversion.patch create mode 100644 ports/ktx/0004-quirks.patch diff --git a/ports/ktx/0003-libtool.patch b/ports/ktx/0003-libtool.patch deleted file mode 100644 index 1736d8f4b25..00000000000 --- a/ports/ktx/0003-libtool.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index bc679fd1..13052501 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -826,7 +826,7 @@ set(CLI OFF) # Only build as library not the CLI astcencoder - add_subdirectory(lib/astc-encoder) - set_property(TARGET ${ASTC_LIB_TARGET} PROPERTY POSITION_INDEPENDENT_CODE ON) - --if(KTX_FEATURE_STATIC_LIBRARY AND NOT WIN32 AND NOT EMSCRIPTEN) -+if(KTX_FEATURE_STATIC_LIBRARY AND APPLE) - # Make a single static library to simplify linking. - add_dependencies(ktx ${ASTC_LIB_TARGET}) - add_custom_command( TARGET ktx -@@ -856,7 +856,7 @@ if(KTX_FEATURE_DOC) - endif() - - set(KTX_INSTALL_TARGETS ktx) --if(KTX_FEATURE_STATIC_LIBRARY AND (WIN32 OR EMSCRIPTEN)) -+if(KTX_FEATURE_STATIC_LIBRARY AND NOT APPLE) - list(APPEND KTX_INSTALL_TARGETS ${ASTC_LIB_TARGET}) - endif() - diff --git a/ports/ktx/0003-mkversion.patch b/ports/ktx/0003-mkversion.patch new file mode 100644 index 00000000000..ee8b3c4afb9 --- /dev/null +++ b/ports/ktx/0003-mkversion.patch @@ -0,0 +1,13 @@ +diff --git a/cmake/version.cmake b/cmake/version.cmake +index 9a90622..0fc3521 100644 +--- a/cmake/version.cmake ++++ b/cmake/version.cmake +@@ -176,7 +176,7 @@ function( create_version_header dest_path target ) + add_custom_command( + OUTPUT ${version_h_output} + # On Windows this command has to be invoked by a shell in order to work +- COMMAND ${BASH_EXECUTABLE} -c "\"./mkversion\" \"-o\" \"version.h\" \"${dest_path}\"" ++ COMMAND "${BASH_EXECUTABLE}" -- ./mkversion -o version.h "${dest_path}" + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + COMMENT "Generate ${version_h_output}" + VERBATIM diff --git a/ports/ktx/0004-quirks.patch b/ports/ktx/0004-quirks.patch new file mode 100644 index 00000000000..14783cb665d --- /dev/null +++ b/ports/ktx/0004-quirks.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 068c6bb..84fa624 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -215,7 +215,7 @@ if(MSVC) + # With /W4 VS2015 (V19.0) issues many warnings that VS2017 & 2019 don't + # so only increase warning level for recent versions. + add_compile_options($<$:/W4>) +- add_compile_options( $,/Gz,/O2> ) ++ add_compile_options( $,,/O2> ) + elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" + OR ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") + add_compile_options(-Wall -Wextra) +@@ -801,6 +801,7 @@ if(EMSCRIPTEN) + endif() + + add_library( objUtil STATIC ++ EXCLUDE_FROM_ALL + utils/argparser.cpp + utils/argparser.h + utils/ktxapp.h diff --git a/ports/ktx/portfile.cmake b/ports/ktx/portfile.cmake index c1e508c0af0..c6c0e25ea1c 100644 --- a/ports/ktx/portfile.cmake +++ b/ports/ktx/portfile.cmake @@ -1,50 +1,50 @@ -set(PORT_VERSION 4.1.0-rc3) - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO KhronosGroup/KTX-Software - REF f8dc35f0c22b38064c4d1f05830cea69c79f0d38 #v${PORT_VERSION} - SHA512 9af28506141f7f016ef6295ee980907024c591a0ba4704c90713ecdb3accbd82363b42829efadaa3897e154250123bf52152a6f0751166bea84cf6e0f4bd5e79 + REF "v${VERSION}" + SHA512 bb8f728009ba7e15eecd2d9eb7985883a6a85f4ea8fccfa7f25a5567240980d1eb8bcde67d90e56e5c93de910d1bc93704bc5cbd390a8cb660051a698d7fd573 HEAD_REF master - FILE_DISAMBIGUATOR 1 PATCHES 0001-Use-vcpkg-zstd.patch 0002-Fix-versioning.patch - 0003-libtool.patch + 0003-mkversion.patch + 0004-quirks.patch ) +file(REMOVE "${SOURCE_PATH}/other_include/zstd_errors.h") +vcpkg_list(SET OPTIONS) if(VCPKG_TARGET_IS_WINDOWS) vcpkg_acquire_msys(MSYS_ROOT PACKAGES bash DIRECT_PACKAGES # Required for "getopt" - "https://repo.msys2.org/msys/x86_64/util-linux-2.35.2-1-x86_64.pkg.tar.zst" - ff951c2cd96d0fda87bacb505c93e4aa1f9aeb35f829c52b5a7862d05e167f69605a4927a0e7197b5ee2b2fa5cb56619ad7a6ba293ede4765fdcacedf2ed35da - ) + "https://repo.msys2.org/msys/x86_64/util-linux-2.35.2-3-x86_64.pkg.tar.zst" + da26540881cd5734072717133307e5d1a27a60468d3656885507833b80f24088c5382eaa0234b30bdd9e8484a6638b4514623f5327f10b19eed36f12158e8edb + ) vcpkg_add_to_path("${MSYS_ROOT}/usr/bin") - - file(REMOVE - "${SOURCE_PATH}/other_include/zstd.h" - "${SOURCE_PATH}/other_include/zstd_errors.h") + vcpkg_list(APPEND OPTIONS "-DBASH_EXECUTABLE=${MSYS_ROOT}/usr/bin/bash.exe") endif() string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" ENABLE_STATIC) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES - tools KTX_FEATURE_TOOLS - vulkan KTX_FEATURE_VULKAN + tools KTX_FEATURE_TOOLS + vulkan KTX_FEATURE_VULKAN ) vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS - -DKTX_VERSION_FULL=v${PORT_VERSION} + -DKTX_VERSION_FULL=v${VERSION} -DKTX_FEATURE_TESTS=OFF -DKTX_FEATURE_LOADTEST_APPS=OFF -DKTX_FEATURE_STATIC_LIBRARY=${ENABLE_STATIC} ${FEATURE_OPTIONS} + ${OPTIONS} + # Do not regenerate headers (needs more dependencies) + -DCMAKE_DISABLE_FIND_PACKAGE_Vulkan=1 DISABLE_PARALLEL_CONFIGURE ) @@ -61,18 +61,12 @@ if(tools IN_LIST FEATURES) ktx2check AUTO_CLEAN ) - vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT}) endif() vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/ktx) file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") -if("${VCPKG_LIBRARY_LINKAGE}" STREQUAL "static") - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin") - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin") -endif() - configure_file("${SOURCE_PATH}/LICENSE.md" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY) file(GLOB LICENSE_FILES "${SOURCE_PATH}/LICENSES/*") file(COPY ${LICENSE_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSES") diff --git a/ports/ktx/vcpkg.json b/ports/ktx/vcpkg.json index 8ee67f89612..b2005357fe6 100644 --- a/ports/ktx/vcpkg.json +++ b/ports/ktx/vcpkg.json @@ -1,11 +1,13 @@ { "name": "ktx", - "version-semver": "4.1.0-rc3", - "port-version": 1, - "description": "A small library of functions for writing and reading KTX files, and instantiating OpenGL®, OpenGL ES™️ and Vulkan® textures from them", + "version-semver": "4.1.0", + "description": [ + "The Khronos KTX library and tools.", + "Functions for writing and reading KTX files, and instantiating OpenGL®, OpenGL ES™️ and Vulkan® textures from them." + ], "homepage": "https://github.com/KhronosGroup/KTX-Software", - "license": "Apache-2.0", - "supports": "!(uwp | x86 | (arm & !arm64))", + "license": null, + "supports": "arm64 | x64 | !windows", "dependencies": [ { "name": "vcpkg-cmake", @@ -19,10 +21,12 @@ ], "features": { "tools": { - "description": "Build tools" + "description": "Build tools", + "supports": "!android" }, "vulkan": { - "description": "Build Vulkan support" + "description": "Build Vulkan support", + "supports": "!emscripten" } } } diff --git a/versions/baseline.json b/versions/baseline.json index 05119dfb1e8..14c34bb67a1 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3661,8 +3661,8 @@ "port-version": 1 }, "ktx": { - "baseline": "4.1.0-rc3", - "port-version": 1 + "baseline": "4.1.0", + "port-version": 0 }, "kubazip": { "baseline": "0.2.4", diff --git a/versions/k-/ktx.json b/versions/k-/ktx.json index 763dec938dc..fa5bc1fe9f2 100644 --- a/versions/k-/ktx.json +++ b/versions/k-/ktx.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "74b3fa8f53d6a1d173c09c2f87f865125717d894", + "version-semver": "4.1.0", + "port-version": 0 + }, { "git-tree": "b347df16db358ecb56e49c982c9a48f732f5da2f", "version-semver": "4.1.0-rc3",