From 24ae27eb23c105fdb631120aa1a46958cb0337af Mon Sep 17 00:00:00 2001 From: Frank <65999885+FrankXie05@users.noreply.github.com> Date: Fri, 1 Dec 2023 17:57:19 +0800 Subject: [PATCH] [libexif] Change to the official build system (#32114) * [vtk] Fix the dependency curl of proj * version * [libexif] Change to the official build system * add port-version * version * revert * libexif * version * default feature nls * version * update * format * version * revert * vdb * version --- ports/libexif/CMakeLists.txt | 158 ------------------ ports/libexif/add-missing-_stdint-h.patch | 7 - ports/libexif/config.h.cmake | 96 ----------- ports/libexif/fix-ssize.patch | 16 ++ ports/libexif/libexif.def | 136 --------------- ports/libexif/portfile.cmake | 31 ++-- ports/libexif/unofficial-libexif-config.cmake | 28 ++++ ports/libexif/vcpkg.json | 21 ++- versions/baseline.json | 2 +- versions/l-/libexif.json | 5 + 10 files changed, 91 insertions(+), 409 deletions(-) delete mode 100644 ports/libexif/CMakeLists.txt delete mode 100644 ports/libexif/add-missing-_stdint-h.patch delete mode 100644 ports/libexif/config.h.cmake create mode 100644 ports/libexif/fix-ssize.patch delete mode 100644 ports/libexif/libexif.def create mode 100644 ports/libexif/unofficial-libexif-config.cmake diff --git a/ports/libexif/CMakeLists.txt b/ports/libexif/CMakeLists.txt deleted file mode 100644 index be7e4ed752..0000000000 --- a/ports/libexif/CMakeLists.txt +++ /dev/null @@ -1,158 +0,0 @@ -cmake_minimum_required(VERSION 3.0) -project(libexif LANGUAGES C) - -set(PACKAGE "libexif") - -option(ENABLE_NLS "Enable NLS" OFF) - -set(HEADERS - libexif/_stdint.h - libexif/exif.h - libexif/exif-byte-order.h - libexif/exif-content.h - libexif/exif-data.h - libexif/exif-data-type.h - libexif/exif-entry.h - libexif/exif-format.h - libexif/exif-gps-ifd.h - libexif/exif-ifd.h - libexif/exif-loader.h - libexif/exif-log.h - libexif/exif-mem.h - libexif/exif-mnote-data.h - libexif/exif-mnote-data-priv.h - libexif/exif-system.h - libexif/exif-tag.h - libexif/exif-utils.h -) - -set(SOURCES - libexif/exif-byte-order.c - libexif/exif-content.c - libexif/exif-data.c - libexif/exif-entry.c - libexif/exif-format.c - libexif/exif-gps-ifd.c - libexif/exif-ifd.c - libexif/exif-loader.c - libexif/exif-log.c - libexif/exif-mem.c - libexif/exif-mnote-data.c - libexif/exif-tag.c - libexif/exif-utils.c -) - -set(HEADERS_APPLE - libexif/apple/exif-mnote-data-apple.h - libexif/apple/mnote-apple-entry.h - libexif/apple/mnote-apple-tag.h -) - -set(SOURCES_APPLE - libexif/apple/exif-mnote-data-apple.c - libexif/apple/mnote-apple-entry.c - libexif/apple/mnote-apple-tag.c -) - -set(HEADERS_CANON - libexif/canon/exif-mnote-data-canon.h - libexif/canon/mnote-canon-entry.h - libexif/canon/mnote-canon-tag.h -) - -set(SOURCES_CANON - libexif/canon/exif-mnote-data-canon.c - libexif/canon/mnote-canon-entry.c - libexif/canon/mnote-canon-tag.c -) - -set(HEADERS_FUJI - libexif/fuji/exif-mnote-data-fuji.h - libexif/fuji/mnote-fuji-entry.h - libexif/fuji/mnote-fuji-tag.h -) - -set(SOURCES_FUJI - libexif/fuji/exif-mnote-data-fuji.c - libexif/fuji/mnote-fuji-entry.c - libexif/fuji/mnote-fuji-tag.c -) - -set(HEADERS_OLYMPUS - libexif/olympus/exif-mnote-data-olympus.h - libexif/olympus/mnote-olympus-entry.h - libexif/olympus/mnote-olympus-tag.h -) - -set(SOURCES_OLYMPUS - libexif/olympus/exif-mnote-data-olympus.c - libexif/olympus/mnote-olympus-entry.c - libexif/olympus/mnote-olympus-tag.c -) - -set(HEADERS_PENTAX - libexif/pentax/exif-mnote-data-pentax.h - libexif/pentax/mnote-pentax-entry.h - libexif/pentax/mnote-pentax-tag.h -) - -set(SOURCES_PENTAX - libexif/pentax/exif-mnote-data-pentax.c - libexif/pentax/mnote-pentax-entry.c - libexif/pentax/mnote-pentax-tag.c -) - -if(MSVC) - set(SOURCES_MSVC "libexif.def") -endif() - -add_library(libexif - ${SOURCES} - ${SOURCES_APPLE} - ${SOURCES_CANON} - ${SOURCES_FUJI} - ${SOURCES_OLYMPUS} - ${SOURCES_PENTAX} - ${SOURCES_MSVC} -) - -target_include_directories(libexif PRIVATE .) -target_include_directories(libexif PRIVATE ${CMAKE_BINARY_DIR}) -target_compile_definitions(libexif PRIVATE -D_CRT_SECURE_NO_WARNINGS) -target_compile_definitions(libexif PRIVATE -DGETTEXT_PACKAGE="${PACKAGE}") - -include(CheckFunctionExists) -include(CheckIncludeFile) - -check_function_exists(dcgettext HAVE_DCGETTEXT) -check_function_exists(gettext HAVE_DCGETTEXT) -check_function_exists(iconv HAVE_DCGETTEXT) -check_function_exists(localtime_r HAVE_DCGETTEXT) - -check_include_file(dlfcn.h HAVE_DLFCN_H) -check_include_file(inttypes.h HAVE_INTTYPES_H) -check_include_file(memory.h HAVE_MEMORY_H) -check_include_file(stdint.h HAVE_STDINT_H) -check_include_file(stdlib.h HAVE_STDLIB_H) -check_include_file(strings.h HAVE_STRINGS_H) -check_include_file(string.h HAVE_STRING_H) -check_include_file(sys/stat.h HAVE_SYS_STAT_H) -check_include_file(sys/stat.h HAVE_SYS_STAT_H) -check_include_file(sys/types.h HAVE_SYS_TYPES_H) -check_include_file(unistd.h HAVE_UNISTD_H) - -configure_file(config.h.cmake config.h) - -install( - TARGETS libexif - RUNTIME DESTINATION bin - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib -) - -install(FILES ${HEADERS} DESTINATION include/libexif) -install(FILES ${HEADERS_APPLE} DESTINATION include/libexif/apple) -install(FILES ${HEADERS_CANON} DESTINATION include/libexif/canon) -install(FILES ${HEADERS_FUJI} DESTINATION include/libexif/fuji) -install(FILES ${HEADERS_OLYMPUS} DESTINATION include/libexif/olympus) -install(FILES ${HEADERS_PENTAX} DESTINATION include/libexif/pentax) diff --git a/ports/libexif/add-missing-_stdint-h.patch b/ports/libexif/add-missing-_stdint-h.patch deleted file mode 100644 index 1c4c95d1c2..0000000000 --- a/ports/libexif/add-missing-_stdint-h.patch +++ /dev/null @@ -1,7 +0,0 @@ -diff --git a/libexif/_stdint.h b/libexif/_stdint.h -new file mode 100644 -index 0000000..9a6118b ---- /dev/null -+++ b/libexif/_stdint.h -@@ -0,0 +1 @@ -+#include diff --git a/ports/libexif/config.h.cmake b/ports/libexif/config.h.cmake deleted file mode 100644 index 4dfbdb1b00..0000000000 --- a/ports/libexif/config.h.cmake +++ /dev/null @@ -1,96 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if translation of program messages to the user's native - language is requested. */ -#cmakedefine ENABLE_NLS - -/* Define if the GNU dcgettext() function is already present or preinstalled. - */ -#cmakedefine HAVE_DCGETTEXT - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_DLFCN_H - -/* Define if the GNU gettext() function is already present or preinstalled. */ -#cmakedefine HAVE_GETTEXT - -/* Define if you have the iconv() function. */ -#cmakedefine HAVE_ICONV - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_INTTYPES_H - -/* Define to 1 if you have the `localtime_r' function. */ -#cmakedefine HAVE_LOCALTIME_R - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_MEMORY_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_UNISTD_H - -/* Define as const if the declaration of iconv() needs const. */ -#cmakedefine ICONV_CONST - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#cmakedefine LT_OBJDIR - -/* Name of package */ -#cmakedefine PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#cmakedefine PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#cmakedefine PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#cmakedefine PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#cmakedefine PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#cmakedefine PACKAGE_URL - -/* Define to the version of this package. */ -#cmakedefine PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#cmakedefine STDC_HEADERS - -/* Version number of package */ -#cmakedefine VERSION - -/* Define to empty if `const' does not conform to ANSI C. */ -#cmakedefine const - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#cmakedefine inline -#endif - -#ifdef _MSC_VER -#include -typedef SSIZE_T ssize_t; -#endif \ No newline at end of file diff --git a/ports/libexif/fix-ssize.patch b/ports/libexif/fix-ssize.patch new file mode 100644 index 0000000000..afcd87cf72 --- /dev/null +++ b/ports/libexif/fix-ssize.patch @@ -0,0 +1,16 @@ +diff --git a/libexif/exif-loader.c b/libexif/exif-loader.c +index ad4ae96..8a24ef6 100644 +--- a/libexif/exif-loader.c ++++ b/libexif/exif-loader.c +@@ -19,6 +19,11 @@ + */ + + #include ++#ifdef _WIN32 ++#include ++#define ssize_t ptrdiff_t ++#endif ++ + + #include + #include diff --git a/ports/libexif/libexif.def b/ports/libexif/libexif.def deleted file mode 100644 index 7013674a8f..0000000000 --- a/ports/libexif/libexif.def +++ /dev/null @@ -1,136 +0,0 @@ -EXPORTS - exif_array_set_byte_order - exif_byte_order_get_name - exif_content_add_entry - exif_content_dump - exif_content_fix - exif_content_foreach_entry - exif_content_free - exif_content_get_entry - exif_content_get_ifd - exif_content_log - exif_content_new - exif_content_new_mem - exif_content_ref - exif_content_remove_entry - exif_content_unref - exif_data_dump - exif_data_fix - exif_data_foreach_content - exif_data_free - exif_data_get_byte_order - exif_data_get_data_type - exif_data_get_log - exif_data_get_mnote_data - exif_data_load_data - exif_data_log - exif_data_new - exif_data_new_from_data - exif_data_new_from_file - exif_data_new_mem - exif_data_option_get_description - exif_data_option_get_name - exif_data_ref - exif_data_save_data - exif_data_set_byte_order - exif_data_set_data_type - exif_data_set_option - exif_data_unref - exif_data_unset_option - exif_entry_dump - exif_entry_fix - exif_entry_free - exif_entry_get_value - exif_entry_initialize - exif_entry_new - exif_entry_new_mem - exif_entry_ref - exif_entry_unref - exif_format_get_name - exif_format_get_size - exif_get_gps_tag_info - exif_get_long - exif_get_rational - exif_get_short - exif_get_slong - exif_get_srational - exif_get_sshort - exif_ifd_get_name - exif_loader_get_buf - exif_loader_get_data - exif_loader_log - exif_loader_new - exif_loader_new_mem - exif_loader_ref - exif_loader_reset - exif_loader_unref - exif_loader_write - exif_loader_write_file - exif_log - exif_log_code_get_message - exif_log_code_get_title - exif_log_free - exif_log_new - exif_log_new_mem - exif_log_ref - exif_log_set_func - exif_log_unref - exif_logv - exif_mem_alloc - exif_mem_free - exif_mem_new - exif_mem_new_default - exif_mem_realloc - exif_mem_ref - exif_mem_unref - exif_mnote_data_apple_new - exif_mnote_data_canon_new - exif_mnote_data_construct - exif_mnote_data_count - exif_mnote_data_get_description - exif_mnote_data_get_id - exif_mnote_data_get_name - exif_mnote_data_get_title - exif_mnote_data_get_value - exif_mnote_data_load - exif_mnote_data_log - exif_mnote_data_olympus_new - exif_mnote_data_pentax_new - exif_mnote_data_ref - exif_mnote_data_save - exif_mnote_data_set_byte_order - exif_mnote_data_set_offset - exif_mnote_data_unref - exif_set_long - exif_set_rational - exif_set_short - exif_set_slong - exif_set_srational - exif_set_sshort - exif_tag_from_name - exif_tag_get_description - exif_tag_get_description_in_ifd - exif_tag_get_name - exif_tag_get_name_in_ifd - exif_tag_get_support_level_in_ifd - exif_tag_get_title - exif_tag_get_title_in_ifd - exif_tag_table_count - exif_tag_table_get_name - exif_tag_table_get_tag - mnote_apple_entry_get_value - mnote_apple_tag_get_description - mnote_apple_tag_get_name - mnote_apple_tag_get_title - mnote_canon_entry_get_value - mnote_canon_tag_get_description - mnote_canon_tag_get_name - mnote_canon_tag_get_title - mnote_olympus_entry_get_value - mnote_olympus_tag_get_description - mnote_olympus_tag_get_name - mnote_olympus_tag_get_title - mnote_pentax_entry_get_value - mnote_pentax_tag_get_description - mnote_pentax_tag_get_name - mnote_pentax_tag_get_title \ No newline at end of file diff --git a/ports/libexif/portfile.cmake b/ports/libexif/portfile.cmake index 83fc06ec89..30a0355acb 100644 --- a/ports/libexif/portfile.cmake +++ b/ports/libexif/portfile.cmake @@ -1,24 +1,35 @@ + vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO libexif/libexif - REF v0.6.24 + REF "v${VERSION}" SHA512 eac1b5220ca0e02370837a0d78a6d38e91c5afa0956d4196b26a8d2a8a2c5dea18d58c0e473285f278653c3863923241651b7dff4d007cc46385eb29ea188330 HEAD_REF master PATCHES - add-missing-_stdint-h.patch + fix-ssize.patch ) -file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") -file(COPY "${CMAKE_CURRENT_LIST_DIR}/config.h.cmake" DESTINATION "${SOURCE_PATH}") -file(COPY "${CMAKE_CURRENT_LIST_DIR}/libexif.def" DESTINATION "${SOURCE_PATH}") +vcpkg_list(SET options) +if("nls" IN_LIST FEATURES) + vcpkg_list(APPEND options "--enable-nls") +else() + set(ENV{AUTOPOINT} true) # true, the program + vcpkg_list(APPEND options "--disable-nls") +endif() -vcpkg_cmake_configure( +vcpkg_configure_make( SOURCE_PATH "${SOURCE_PATH}" + AUTOCONFIG + OPTIONS + ${options} + --enable-internal-docs=no + --enable-ship-binaries=no ) -vcpkg_cmake_install() -vcpkg_copy_pdbs() +vcpkg_install_make() +vcpkg_fixup_pkgconfig() -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/unofficial-libexif-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") -file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING") diff --git a/ports/libexif/unofficial-libexif-config.cmake b/ports/libexif/unofficial-libexif-config.cmake new file mode 100644 index 0000000000..80ae7915e1 --- /dev/null +++ b/ports/libexif/unofficial-libexif-config.cmake @@ -0,0 +1,28 @@ + +if(NOT TARGET unofficial::libexif::libexif) + add_library(unofficial::libexif::libexif UNKNOWN IMPORTED) + get_filename_component(z_vcpkg_LIBEXIF_root "${CMAKE_CURRENT_LIST_FILE}" PATH) + get_filename_component(z_vcpkg_LIBEXIF_root "${z_vcpkg_libexif_root}" PATH) + get_filename_component(z_vcpkg_LIBEXIF_root "${z_vcpkg_libexif_root}" PATH) + set_target_properties(unofficial::libexif::libexif PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${z_vcpkg_libexif_root}/include" + ) + find_library(Z_VCPKG_LIBEXIF_LIBRARY_RELEASE NAMES libexif PATHS "${z_vcpkg_LIBEXIF_root }/lib" NO_DEFAULT_PATH REQUIRED) + find_library(Z_VCPKG_LIBEXIF_LIBRARY_DEBUG NAMES libexif PATHS "${z_vcpkg_LIBEXIF_root }/debug/lib" NO_DEFAULT_PATH) + + if(EXISTS "${Z_VCPKG_LIBEXIF_LIBRARY_RELEASE}") + set_property(TARGET unofficial::libexif::libexif APPEND PROPERTY IMPORTED_CONFIGURATIONS "Release") + set_target_properties(unofficial::libexif::libexif PROPERTIES + IMPORTED_LOCATION_RELEASE "${Z_VCPKG_LIBEXIF_LIBRARY_RELEASE}" + ) + endif() + + if(EXISTS "${Z_VCPKG_LIBEXIF_LIBRARY_DEBUG}") + set_property(TARGET unofficial::libexif::libexif APPEND PROPERTY IMPORTED_CONFIGURATIONS "Debug") + set_target_properties(unofficial::libexif::libexif PROPERTIES + IMPORTED_LOCATION_DEBUG "${Z_VCPKG_LIBEXIF_LIBRARY_DEBUG}" + ) + endif() + + unset(z_vcpkg_LIBEXIF_root) +endif() diff --git a/ports/libexif/vcpkg.json b/ports/libexif/vcpkg.json index 77c7c25aed..80aa5fba2e 100644 --- a/ports/libexif/vcpkg.json +++ b/ports/libexif/vcpkg.json @@ -1,6 +1,7 @@ { "name": "libexif", "version": "0.6.24", + "port-version": 1, "description": "a library for parsing, editing, and saving EXIF data", "homepage": "https://libexif.github.io/", "license": "LGPL-2.1-or-later", @@ -10,5 +11,23 @@ "name": "vcpkg-cmake", "host": true } - ] + ], + "default-features": [ + "nls" + ], + "features": { + "nls": { + "description": "Enable native language support.", + "dependencies": [ + { + "name": "gettext", + "host": true, + "features": [ + "tools" + ] + }, + "gettext-libintl" + ] + } + } } diff --git a/versions/baseline.json b/versions/baseline.json index cfed05b01b..3eca02d825 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4262,7 +4262,7 @@ }, "libexif": { "baseline": "0.6.24", - "port-version": 0 + "port-version": 1 }, "libfabric": { "baseline": "1.13.2", diff --git a/versions/l-/libexif.json b/versions/l-/libexif.json index 40d2a2cbeb..9b612d7bfb 100644 --- a/versions/l-/libexif.json +++ b/versions/l-/libexif.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "40f7058e18a937bab35b7213595fc4eef5de7dec", + "version": "0.6.24", + "port-version": 1 + }, { "git-tree": "7194d724b7e14c0d3661153bc81f614a86276c6a", "version": "0.6.24",