From 1e7c1dda26caa47693620afd834013c7c3fae3a7 Mon Sep 17 00:00:00 2001 From: Don Olmstead Date: Fri, 15 Nov 2024 16:40:47 -0800 Subject: [PATCH 1/2] [lcms] Update to v2.16 Use the meson build. Remove obsolete patches and CMake build. --- ports/lcms/CMakeLists.txt | 55 ------------------- ports/lcms/fix-shared-library.patch | 6 +-- ports/lcms/lcms-config.cmake | 11 ++++ ports/lcms/lcms2-config.cmake | 25 +++++++++ ports/lcms/portfile.cmake | 65 ++++++++++++++++------- ports/lcms/remove-register.patch | 13 ----- ports/lcms/remove_library_directive.patch | 10 ---- ports/lcms/usage | 8 +-- ports/lcms/vcpkg.json | 29 +++++++--- 9 files changed, 111 insertions(+), 111 deletions(-) delete mode 100644 ports/lcms/CMakeLists.txt create mode 100644 ports/lcms/lcms-config.cmake create mode 100644 ports/lcms/lcms2-config.cmake delete mode 100644 ports/lcms/remove-register.patch delete mode 100644 ports/lcms/remove_library_directive.patch diff --git a/ports/lcms/CMakeLists.txt b/ports/lcms/CMakeLists.txt deleted file mode 100644 index fa36d43233495c..00000000000000 --- a/ports/lcms/CMakeLists.txt +++ /dev/null @@ -1,55 +0,0 @@ -cmake_minimum_required(VERSION 3.5) - -project(little-cms) - -file(GLOB SRCS src/*.c) - -add_library(lcms2 ${SRCS} src/lcms2.def) - -if(BUILD_SHARED_LIBS) - target_compile_definitions(lcms2 PRIVATE CMS_DLL_BUILD) - target_compile_definitions(lcms2 PUBLIC CMS_DLL) -endif() -target_compile_definitions(lcms2 PRIVATE UNICODE _UNICODE) -target_compile_definitions(lcms2 PUBLIC CMS_NO_REGISTER_KEYWORD) - -target_include_directories(lcms2 PUBLIC $ $) -set_target_properties(lcms2 PROPERTIES PUBLIC_HEADER "${CMAKE_CURRENT_LIST_DIR}/include/lcms2.h;${CMAKE_CURRENT_LIST_DIR}/include/lcms2_plugin.h") - -# Generate pkg-config file -SET(PACKAGE "lcms2") -# Read VERSION from file configure -file(READ "${CMAKE_CURRENT_LIST_DIR}/configure" lcms2_configure) -string(REGEX MATCH "PACKAGE_VERSION='(([0-9]+)\\.([0-9]+))'" _ ${lcms2_configure}) -set(VERSION "${CMAKE_MATCH_1}") -SET(prefix "${CMAKE_INSTALL_PREFIX}") -SET(exec_prefix "\${prefix}") -SET(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") -SET(includedir "\${prefix}/include") -CONFIGURE_FILE(lcms2.pc.in "${PROJECT_BINARY_DIR}/lcms2.pc" @ONLY) - -install(TARGETS lcms2 - EXPORT lcms2Config - RUNTIME DESTINATION "bin" - LIBRARY DESTINATION "lib" - ARCHIVE DESTINATION "lib" - PUBLIC_HEADER DESTINATION "include" -) - -INSTALL(FILES ${PROJECT_BINARY_DIR}/lcms2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) - -install(EXPORT lcms2Config - DESTINATION "share/lcms2" - NAMESPACE lcms2:: -) - -# Backwards compatibility for previous vcpkg users -add_library(lcms INTERFACE) -target_link_libraries(lcms INTERFACE lcms2) - - -install(TARGETS lcms EXPORT lcms-targets) -install(EXPORT lcms-targets - DESTINATION "share/lcms" - NAMESPACE lcms:: -) diff --git a/ports/lcms/fix-shared-library.patch b/ports/lcms/fix-shared-library.patch index 4b8a4c7fedd273..ea8113b519063c 100644 --- a/ports/lcms/fix-shared-library.patch +++ b/ports/lcms/fix-shared-library.patch @@ -1,12 +1,12 @@ diff --git a/include/lcms2.h b/include/lcms2.h -index fd4ac7c..a99bdd2 100644 +index 7c72047..6306027 100644 --- a/include/lcms2.h +++ b/include/lcms2.h -@@ -227,6 +227,7 @@ typedef int cmsBool; +@@ -230,6 +230,7 @@ typedef int cmsBool; // Calling convention -- this is hardly platform and compiler dependent +#define CMS_DLL - #ifdef CMS_IS_WINDOWS_ + #if defined(CMS_IS_WINDOWS_) && !defined(__GNUC__) # if defined(CMS_DLL) || defined(CMS_DLL_BUILD) # ifdef __BORLANDC__ diff --git a/ports/lcms/lcms-config.cmake b/ports/lcms/lcms-config.cmake new file mode 100644 index 00000000000000..525d268a8c05b6 --- /dev/null +++ b/ports/lcms/lcms-config.cmake @@ -0,0 +1,11 @@ +if(NOT TARGET lcms::lcms) + include(CMakeFindDependencyMacro) + find_dependency(lcms2 CONFIG) + + # Create imported target lcms::lcms + add_library(lcms::lcms INTERFACE IMPORTED) + + set_target_properties(lcms::lcms PROPERTIES + INTERFACE_LINK_LIBRARIES "lcms2::lcms2" + ) +endif() diff --git a/ports/lcms/lcms2-config.cmake b/ports/lcms/lcms2-config.cmake new file mode 100644 index 00000000000000..593ac71a448dbe --- /dev/null +++ b/ports/lcms/lcms2-config.cmake @@ -0,0 +1,25 @@ +if(NOT TARGET lcms2::lcms2) + get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) + get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) + get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) + + add_library(lcms2::lcms2 UNKNOWN IMPORTED) + + set_target_properties(lcms2::lcms2 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include" + ) + + find_library(LCMS2_LIBRARY_DEBUG NAMES lcms2 PATHS "${_IMPORT_PREFIX}/debug" PATH_SUFFIXES lib NO_DEFAULT_PATH) + if(EXISTS "${LCMS2_LIBRARY_DEBUG}") + set_property(TARGET lcms2::lcms2 APPEND PROPERTY IMPORTED_CONFIGURATIONS "Debug") + set_target_properties(lcms2::lcms2 PROPERTIES IMPORTED_LOCATION_DEBUG "${LCMS2_LIBRARY_DEBUG}") + endif() + + find_library(LCMS2_LIBRARY_RELEASE NAMES lcms2 PATHS "${_IMPORT_PREFIX}/" PATH_SUFFIXES lib NO_DEFAULT_PATH) + if(EXISTS "${LCMS2_LIBRARY_RELEASE}") + set_property(TARGET lcms2::lcms2 APPEND PROPERTY IMPORTED_CONFIGURATIONS "Release") + set_target_properties(lcms2::lcms2 PROPERTIES IMPORTED_LOCATION_RELEASE "${LCMS2_LIBRARY_RELEASE}") + endif() + + unset(_IMPORT_PREFIX) +endif() diff --git a/ports/lcms/portfile.cmake b/ports/lcms/portfile.cmake index 59da3111d43b95..5ecf0b9e187146 100644 --- a/ports/lcms/portfile.cmake +++ b/ports/lcms/portfile.cmake @@ -1,36 +1,61 @@ -vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION} - if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) set(SHARED_LIBRARY_PATCH "fix-shared-library.patch") endif() +vcpkg_download_distfile(ADD_MISSING_EXPORT_PATCH + URLS https://github.com/mm2/Little-CMS/commit/f7b3c637c20508655f8b49935a4b556d52937b69.diff?full_index=1 + FILENAME Add-missing-export.patch + SHA512 4a78f55c07fe5cef5fb9174d466672371283301df89e2825fc47d9fd4c526b291dce11d3896401a3284f4e2093e285c9e5ccbe0011e132576d189e70f66a1325 +) + vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO mm2/Little-CMS REF "lcms${VERSION}" - SHA512 fc45f2ce0bf752313369786b65b92443ef6d9ed7e264e22cfe2a4732b370f6bb6e5573b646d0e8edf1b0bf9b9bc5137c98aed5929ba75acdf157d2764bd838fa + SHA512 c0d857123a0168cb76b5944a20c9e3de1cbe74e2b509fb72a54f74543e9c173474f09d50c495b0a0a295a3c2b47c5fa54a330d057e1a59b5a7e36d3f5a7f81b2 HEAD_REF master PATCHES - remove_library_directive.patch ${SHARED_LIBRARY_PATCH} - remove-register.patch + ${ADD_MISSING_EXPORT_PATCH} ) -file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") - -vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_PATH}") -vcpkg_cmake_install() +if("fastfloat" IN_LIST FEATURES) + list(APPEND OPTIONS -Dfastfloat=true) +else() + list(APPEND OPTIONS -Dfastfloat=false) +endif() +if("threaded" IN_LIST FEATURES) + list(APPEND OPTIONS -Dthreaded=true) +else() + list(APPEND OPTIONS -Dthreaded=false) +endif() +if("tools" IN_LIST FEATURES) + list(APPEND OPTIONS -Dutils=true) +else() + list(APPEND OPTIONS -Dutils=false) +endif() -vcpkg_copy_pdbs() -vcpkg_cmake_config_fixup(PACKAGE_NAME lcms2) -vcpkg_cmake_config_fixup() # provides old PACKAGE_NAME lcms +vcpkg_configure_meson( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${OPTIONS} + -Dsamples=false +) +vcpkg_install_meson() vcpkg_fixup_pkgconfig() -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") -file(WRITE "${CURRENT_PACKAGES_DIR}/share/lcms/lcms-config.cmake" [[ -include(CMakeFindDependencyMacro) -find_dependency(lcms2 CONFIG) -include(${CMAKE_CURRENT_LIST_DIR}/lcms-targets.cmake) -]]) - -file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) + +if("tools" IN_LIST FEATURES) + vcpkg_copy_tools( + TOOL_NAMES jpgicc linkicc psicc tificc transicc + AUTO_CLEAN + ) +endif() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/man") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/lcms-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/lcms2-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/lcms2") file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/lcms/remove-register.patch b/ports/lcms/remove-register.patch deleted file mode 100644 index ae2f3bd73e1a98..00000000000000 --- a/ports/lcms/remove-register.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/include/lcms2.h b/include/lcms2.h -index fd4ac7c..b5532a9 100644 ---- a/include/lcms2.h -+++ b/include/lcms2.h -@@ -152,7 +152,7 @@ typedef double cmsFloat64Number; - #endif - - // Handle "register" keyword --#if defined(CMS_NO_REGISTER_KEYWORD) -+#if __cplusplus >= 201703L || defined(CMS_NO_REGISTER_KEYWORD) - # define CMSREGISTER - #else - # define CMSREGISTER register diff --git a/ports/lcms/remove_library_directive.patch b/ports/lcms/remove_library_directive.patch deleted file mode 100644 index 0ecd52cc311333..00000000000000 --- a/ports/lcms/remove_library_directive.patch +++ /dev/null @@ -1,10 +0,0 @@ -diff --git a/src/lcms2.def b/src/lcms2.def -index f3e4779..9bf2a4f 100644 ---- a/src/lcms2.def -+++ b/src/lcms2.def -@@ -1,5 +1,3 @@ --LIBRARY LCMS2.DLL -- - EXPORTS - - _cms15Fixed16toDouble = _cms15Fixed16toDouble diff --git a/ports/lcms/usage b/ports/lcms/usage index 1b37c7f74304db..16749e447b4979 100644 --- a/ports/lcms/usage +++ b/ports/lcms/usage @@ -1,4 +1,4 @@ -The package lcms provides CMake targets: - - find_package(lcms2 CONFIG REQUIRED) - target_link_libraries(main PRIVATE lcms2::lcms2) +The package lcms provides CMake targets: + + find_package(lcms2 CONFIG REQUIRED) + target_link_libraries(main PRIVATE lcms2::lcms2) diff --git a/ports/lcms/vcpkg.json b/ports/lcms/vcpkg.json index 1712ca154d1867..c485b4830111b3 100644 --- a/ports/lcms/vcpkg.json +++ b/ports/lcms/vcpkg.json @@ -1,17 +1,34 @@ { "name": "lcms", - "version": "2.14", + "version": "2.16", "description": "Little CMS.", "homepage": "https://github.com/mm2/Little-CMS", "license": "MIT", "dependencies": [ { - "name": "vcpkg-cmake", + "name": "vcpkg-tool-meson", "host": true + } + ], + "features": { + "fastfloat": { + "description": "Build the fast float plugin", + "supports": "!(x86 & windows)", + "license": "GPL-3.0-or-later" }, - { - "name": "vcpkg-cmake-config", - "host": true + "threaded": { + "description": "Build the multi threaded plugin", + "license": "GPL-3.0-or-later" + }, + "tools": { + "description": "Build the utilities", + "dependencies": [ + "libjpeg-turbo", + { + "name": "tiff", + "default-features": false + } + ] } - ] + } } From 7ee9fb210fd25d5767362edf57f5ac3fe2dcc2b5 Mon Sep 17 00:00:00 2001 From: Don Olmstead Date: Fri, 22 Nov 2024 15:49:08 -0800 Subject: [PATCH 2/2] [lcms] Update to v2.16 --- versions/baseline.json | 2 +- versions/l-/lcms.json | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/versions/baseline.json b/versions/baseline.json index 854199b4eb07f8..373e96dd19f6c0 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4217,7 +4217,7 @@ "port-version": 6 }, "lcms": { - "baseline": "2.14", + "baseline": "2.16", "port-version": 0 }, "leaf": { diff --git a/versions/l-/lcms.json b/versions/l-/lcms.json index 53489bdfe89df6..9bbbac01095743 100644 --- a/versions/l-/lcms.json +++ b/versions/l-/lcms.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "56716c0c80ad895686bca248c062b95ad4f89f8d", + "version": "2.16", + "port-version": 0 + }, { "git-tree": "d5fb3c46f4b60d45e67444591a83d80c08100871", "version": "2.14",