diff --git a/ports/libplist/004_fix_tools_msvc.patch b/ports/libplist/004_fix_tools_msvc.patch new file mode 100644 index 00000000000000..38910012c3406b --- /dev/null +++ b/ports/libplist/004_fix_tools_msvc.patch @@ -0,0 +1,18 @@ +diff --git a/tools/plistutil.c b/tools/plistutil.c +index 8121a7d..98b440e 100644 +--- a/tools/plistutil.c ++++ b/tools/plistutil.c +@@ -32,10 +32,13 @@ + #include + #include + #include ++#ifndef _MSC_VER + #include ++#endif + + #ifdef _MSC_VER + #pragma warning(disable:4996) ++#define STDIN_FILENO _fileno(stdin) + #endif + + typedef struct _options diff --git a/ports/libplist/CMakeLists.txt b/ports/libplist/CMakeLists.txt index 8e696233af23d1..970334396833f6 100644 --- a/ports/libplist/CMakeLists.txt +++ b/ports/libplist/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.15) project(libplist C CXX) +option(BUILD_TOOLS "Build tools." OFF) + include(GNUInstallDirs) file(GLOB_RECURSE LIBCNARY_SOURCE libcnary/node.c libcnary/node_list.c) @@ -26,13 +28,11 @@ if(WIN32) endif() add_library(libplist ${LIBPLIST_SOURCE} ${LIBCNARY_SOURCE}) -target_include_directories(libplist - PRIVATE - "$" - "$" - "$" - PUBLIC - "$" +target_include_directories(libplist PUBLIC + "$" + "$" + "$" + "$" ) target_compile_definitions(libplist PRIVATE ${DEFINITIONS}) set_target_properties(libplist PROPERTIES OUTPUT_NAME plist-2.0) @@ -41,13 +41,11 @@ if(UNIX AND NOT APPLE) endif() add_library(libplist++ STATIC ${LIBPLISTPP_SOURCE} ${LIBCNARY_SOURCE}) -target_include_directories(libplist++ - PRIVATE - "$" - "$" - "$" - PUBLIC - "$" +target_include_directories(libplist++ PUBLIC + "$" + "$" + "$" + "$" ) target_compile_definitions(libplist++ PRIVATE ${DEFINITIONS}) target_link_libraries(libplist++ PUBLIC libplist) @@ -85,3 +83,21 @@ foreach(PLIST_PKGCONFIG libplist-2.0.pc libplist++-2.0.pc) DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" ) endforeach() + +if(BUILD_TOOLS) + add_executable(plistutil "tools/plistutil.c") + target_compile_definitions(plistutil PRIVATE + -DPACKAGE_VERSION="2.3.0" + -DPACKAGE_URL="https://github.com/libimobiledevice/libplist" + -DPACKAGE_BUGREPORT="https://github.com/libimobiledevice/libplist/issues" + ) + if(NOT BUILD_SHARED_LIBS) + target_compile_definitions(plistutil PRIVATE -DLIBPLIST_STATIC) + endif() + target_link_libraries(plistutil PRIVATE libplist) + + install( + TARGETS plistutil + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + ) +endif() diff --git a/ports/libplist/portfile.cmake b/ports/libplist/portfile.cmake index 85166c85e4ae41..d29483de63365d 100644 --- a/ports/libplist/portfile.cmake +++ b/ports/libplist/portfile.cmake @@ -8,17 +8,28 @@ vcpkg_from_github( 001_fix_static_build.patch 002_fix_api.patch 003_fix_msvc.patch + 004_fix_tools_msvc.patch ) file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + tools BUILD_TOOLS +) + vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${FEATURE_OPTIONS} ) vcpkg_cmake_install() vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-${PORT}) vcpkg_fixup_pkgconfig() +if("tools" IN_LIST FEATURES) + vcpkg_copy_tools(TOOL_NAMES plistutil AUTO_CLEAN) +endif() if (VCPKG_LIBRARY_LINKAGE STREQUAL "static") vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/plist/plist.h" diff --git a/ports/libplist/vcpkg.json b/ports/libplist/vcpkg.json index 8c310d0f1dcd32..f7dec85483505c 100644 --- a/ports/libplist/vcpkg.json +++ b/ports/libplist/vcpkg.json @@ -1,6 +1,7 @@ { "name": "libplist", "version-date": "2023-06-15", + "port-version": 1, "description": "A library to handle Apple Property List format in binary or XML", "homepage": "https://libimobiledevice.org/", "license": "LGPL-2.1-or-later", @@ -13,5 +14,11 @@ "name": "vcpkg-cmake-config", "host": true } - ] + ], + "features": { + "tools": { + "description": "build command line tool", + "supports": "!android & !ios & !xbox" + } + } } diff --git a/versions/baseline.json b/versions/baseline.json index e8fa6ce84d44e8..da016d6cc2cb41 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4498,7 +4498,7 @@ }, "libplist": { "baseline": "2023-06-15", - "port-version": 0 + "port-version": 1 }, "libpmemobj-cpp": { "baseline": "1.13.0", diff --git a/versions/l-/libplist.json b/versions/l-/libplist.json index 92e2e65145197b..d502fdd3737d73 100644 --- a/versions/l-/libplist.json +++ b/versions/l-/libplist.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "c0550bd82aaa3f3ae23f9b481285c6cb9f92b44c", + "version-date": "2023-06-15", + "port-version": 1 + }, { "git-tree": "8a79aaf94792ae73eea5094eebac773fe6705b54", "version-date": "2023-06-15",