From 16fc24d042913e0e1b9c5867b2403c266c33ae4f Mon Sep 17 00:00:00 2001 From: "xiaozhuai, Weihang Ding" <798047000@qq.com> Date: Wed, 14 Dec 2022 11:13:11 +0800 Subject: [PATCH] [libplist & libusbmuxd & libimobiledevice] Support build on macos & linux (#28022) * [libplist & libusbmuxd & libimobiledevice] Support build on macos & linux * update version database --- ports/ideviceinstaller/vcpkg.json | 7 ++++--- ports/libimobiledevice/CMakeLists.txt | 8 +++++--- ports/libimobiledevice/vcpkg.json | 2 ++ ports/libirecovery/vcpkg.json | 7 ++++--- ports/libplist/CMakeLists.txt | 4 ++++ ports/libplist/fix_static_build.patch | 22 ++++++++++++++++++++++ ports/libplist/portfile.cmake | 17 ++++++++--------- ports/libplist/vcpkg.json | 11 +++++++++-- ports/libusbmuxd/CMakeLists.txt | 4 ++++ ports/libusbmuxd/portfile.cmake | 7 +++---- ports/libusbmuxd/vcpkg.json | 11 ++++++++--- ports/usbmuxd/vcpkg.json | 6 ++++-- scripts/ci.baseline.txt | 4 ---- versions/baseline.json | 12 ++++++------ versions/i-/ideviceinstaller.json | 5 +++++ versions/l-/libimobiledevice.json | 5 +++++ versions/l-/libirecovery.json | 5 +++++ versions/l-/libplist.json | 5 +++++ versions/l-/libusbmuxd.json | 5 +++++ versions/u-/usbmuxd.json | 5 +++++ 20 files changed, 113 insertions(+), 39 deletions(-) create mode 100644 ports/libplist/fix_static_build.patch diff --git a/ports/ideviceinstaller/vcpkg.json b/ports/ideviceinstaller/vcpkg.json index 0d10509af8..dcdca8861d 100644 --- a/ports/ideviceinstaller/vcpkg.json +++ b/ports/ideviceinstaller/vcpkg.json @@ -1,9 +1,10 @@ { "name": "ideviceinstaller", - "version-string": "1.1.2.23", - "port-version": 3, + "version": "1.1.2.23", + "port-version": 4, "description": "Manage apps of iOS devices", - "supports": "!(windows & arm64)", + "license": "LGPL-2.1-only", + "supports": "windows & !arm64", "dependencies": [ "libimobiledevice", "libzip" diff --git a/ports/libimobiledevice/CMakeLists.txt b/ports/libimobiledevice/CMakeLists.txt index 176eb89336..ab9866a4a0 100644 --- a/ports/libimobiledevice/CMakeLists.txt +++ b/ports/libimobiledevice/CMakeLists.txt @@ -3,7 +3,7 @@ project(libimobiledevice C) # find dependencies find_library(libplist NAMES plist plist-2.0 libplist libplist-2.0 REQUIRED) -find_library(libusbmuxd libusbmuxd REQUIRED) +find_library(libusbmuxd NAMES usbmuxd libusbmuxd REQUIRED) find_package(OpenSSL REQUIRED) find_path(dirent_INCLUDE_DIR dirent.h) if (WIN32) @@ -20,13 +20,15 @@ file(GLOB_RECURSE IMOBDEV_PRIVATE_HDR src/*.h) file(GLOB_RECURSE IMOBDEV_SRC src/*.c) add_library(libimobiledevice ${IMOBDEV_SRC} ${IMOBDEV_PUBLIC_HDR} ${IMOBDEV_PUBLIC_SUB_HDR} ${IMOBDEV_PRIVATE_HDR} ${IMOBDEV_COMMON_HDR} ${IMOBDEV_COMMON_SRC}) -set_target_properties(libimobiledevice PROPERTIES OUTPUT_NAME libimobiledevice-1.0) +set_target_properties(libimobiledevice PROPERTIES OUTPUT_NAME imobiledevice-1.0) target_include_directories(libimobiledevice PRIVATE ${dirent_INCLUDE_DIR} include .) target_compile_definitions(libimobiledevice PRIVATE -DHAVE_OPENSSL) target_link_libraries(libimobiledevice PRIVATE ${libplist} ${libusbmuxd} ${getopt} OpenSSL::SSL OpenSSL::Crypto) if (WIN32) target_link_libraries(libimobiledevice PRIVATE Ws2_32) -else() +endif() +if (UNIX) + target_compile_definitions(libimobiledevice PRIVATE -DHAVE_STPCPY -DHAVE_VASPRINTF -DHAVE_ASPRINTF -DHAVE_GETIFADDRS) endif() # install diff --git a/ports/libimobiledevice/vcpkg.json b/ports/libimobiledevice/vcpkg.json index 48e63449b7..75a8ad7c75 100644 --- a/ports/libimobiledevice/vcpkg.json +++ b/ports/libimobiledevice/vcpkg.json @@ -1,8 +1,10 @@ { "name": "libimobiledevice", "version": "1.3.17", + "port-version": 1, "description": "A cross-platform protocol library to communicate with iOS devices", "homepage": "http://www.libimobiledevice.org", + "license": "LGPL-2.1-only", "dependencies": [ "dirent", "getopt", diff --git a/ports/libirecovery/vcpkg.json b/ports/libirecovery/vcpkg.json index f02d8db585..8298c88ab5 100644 --- a/ports/libirecovery/vcpkg.json +++ b/ports/libirecovery/vcpkg.json @@ -1,9 +1,10 @@ { "name": "libirecovery", - "version-string": "1.0.25", - "port-version": 4, + "version": "1.0.25", + "port-version": 5, "description": "Library and utility to talk to iBoot/iBSS via USB on Mac OS X, Windows, and Linux", - "supports": "!(windows & arm64)", + "license": "LGPL-2.1-only", + "supports": "windows & !arm64", "dependencies": [ "getopt", "libusbmuxd", diff --git a/ports/libplist/CMakeLists.txt b/ports/libplist/CMakeLists.txt index 9feb69746c..800f46283b 100644 --- a/ports/libplist/CMakeLists.txt +++ b/ports/libplist/CMakeLists.txt @@ -46,6 +46,10 @@ if(WIN32 AND BUILD_SHARED_LIBS) target_compile_options(plist++ PRIVATE -W3 -WX- -sdl-) target_compile_definitions(plist++ PRIVATE -DLIBPLIST_EXPORTS) endif() +if(NOT BUILD_SHARED_LIBS) + target_compile_definitions(plist PRIVATE -DLIBPLIST_STATIC_LIBRARY) +endif() + target_link_libraries(plist++ PRIVATE plist) install( diff --git a/ports/libplist/fix_static_build.patch b/ports/libplist/fix_static_build.patch new file mode 100644 index 0000000000..eeedef8cab --- /dev/null +++ b/ports/libplist/fix_static_build.patch @@ -0,0 +1,22 @@ +diff --git a/src/plist.c b/src/plist.c +index 57f0be4..cbe10ad 100644 +--- a/src/plist.c ++++ b/src/plist.c +@@ -62,6 +62,8 @@ static void internal_plist_deinit(void) + plist_xml_deinit(); + } + ++#ifndef LIBPLIST_STATIC_LIBRARY ++ + #ifdef WIN32 + + typedef volatile struct { +@@ -116,6 +118,8 @@ static void __attribute__((destructor)) libplist_deinitialize(void) + + #endif + ++#endif ++ + #ifndef HAVE_MEMMEM + // see https://sourceware.org/legacy-ml/libc-alpha/2007-12/msg00000.html + diff --git a/ports/libplist/portfile.cmake b/ports/libplist/portfile.cmake index 2cad077a6f..c057cc218b 100644 --- a/ports/libplist/portfile.cmake +++ b/ports/libplist/portfile.cmake @@ -1,22 +1,21 @@ -vcpkg_check_linkage(ONLY_DYNAMIC_CRT ONLY_DYNAMIC_LIBRARY) - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO libimobiledevice-win32/libplist - REF bbba7cabb78aad180a7a982ada5e1f21ff0ba873 # v1.3.6 + REF bbba7cabb78aad180a7a982ada5e1f21ff0ba873 # v1.3.6 SHA512 4cd59ed87c647259d0da99a20a05e01aa880f01f6b5cecd29e4247029a3d29f0f68b4552571eb3fd3c5549b4cb357801ffe43338b8ff34d44d6be5393d2e6b9d HEAD_REF msvc-master - PATCHES dllexport.patch + PATCHES + dllexport.patch + fix_static_build.patch ) -configure_file(${CURRENT_PORT_DIR}/CMakeLists.txt ${SOURCE_PATH}/CMakeLists.txt COPYONLY) +configure_file("${CURRENT_PORT_DIR}/CMakeLists.txt" "${SOURCE_PATH}/CMakeLists.txt" COPYONLY) -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" ) -vcpkg_install_cmake() +vcpkg_cmake_install() vcpkg_copy_pdbs() vcpkg_fixup_pkgconfig() diff --git a/ports/libplist/vcpkg.json b/ports/libplist/vcpkg.json index 752fd8b26c..459a3df20a 100644 --- a/ports/libplist/vcpkg.json +++ b/ports/libplist/vcpkg.json @@ -1,7 +1,14 @@ { "name": "libplist", "version": "1.3.6", - "port-version": 1, + "port-version": 2, "description": "A library to handle Apple Property List format in binary or XML", - "homepage": "https://libimobiledevice.org/" + "homepage": "https://libimobiledevice.org/", + "license": "LGPL-2.1-only", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + } + ] } diff --git a/ports/libusbmuxd/CMakeLists.txt b/ports/libusbmuxd/CMakeLists.txt index 254a70d7e4..b075a8a7d7 100644 --- a/ports/libusbmuxd/CMakeLists.txt +++ b/ports/libusbmuxd/CMakeLists.txt @@ -14,12 +14,16 @@ file(GLOB_RECURSE IDVCACTV_PUBLIC_HDR include/*.h) file(GLOB_RECURSE IDVCACTV_SRC src/*.c) add_library(libusbmuxd ${IDVCACTV_TOOLS_HDR} ${IDVCACTV_TOOLS_SRC} ${IDVCACTV_SRC} ${IDVCACTV_PUBLIC_HDR}) +set_target_properties(libusbmuxd PROPERTIES OUTPUT_NAME usbmuxd) target_include_directories(libusbmuxd PRIVATE ${libplist_INCLUDES} include common) target_compile_definitions(libusbmuxd PRIVATE -DPACKAGE_STRING="1.2.77") if (WIN32) target_compile_definitions(libusbmuxd PRIVATE -DWIN32) target_link_libraries(libusbmuxd PRIVATE Ws2_32) endif() +if (UNIX) + target_compile_definitions(libusbmuxd PRIVATE -DHAVE_STPNCPY) +endif() target_link_libraries(libusbmuxd PRIVATE ${libplist}) # install diff --git a/ports/libusbmuxd/portfile.cmake b/ports/libusbmuxd/portfile.cmake index 92a82472db..38fbca4f9e 100644 --- a/ports/libusbmuxd/portfile.cmake +++ b/ports/libusbmuxd/portfile.cmake @@ -9,12 +9,11 @@ vcpkg_from_github( configure_file(${CURRENT_PORT_DIR}/CMakeLists.txt ${SOURCE_PATH}/CMakeLists.txt COPYONLY) -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" ) -vcpkg_install_cmake() +vcpkg_cmake_install() vcpkg_copy_pdbs() vcpkg_fixup_pkgconfig() diff --git a/ports/libusbmuxd/vcpkg.json b/ports/libusbmuxd/vcpkg.json index 894b846af2..5ad272b736 100644 --- a/ports/libusbmuxd/vcpkg.json +++ b/ports/libusbmuxd/vcpkg.json @@ -1,10 +1,15 @@ { "name": "libusbmuxd", "version": "1.2.219", - "port-version": 2, + "port-version": 3, "description": "A client library to multiplex connections from and to iOS devices", - "supports": "!(uwp | linux | osx)", + "license": "LGPL-2.1-only", + "supports": "!uwp", "dependencies": [ - "libplist" + "libplist", + { + "name": "vcpkg-cmake", + "host": true + } ] } diff --git a/ports/usbmuxd/vcpkg.json b/ports/usbmuxd/vcpkg.json index 7f660afafd..72ddfb602f 100644 --- a/ports/usbmuxd/vcpkg.json +++ b/ports/usbmuxd/vcpkg.json @@ -1,9 +1,11 @@ { "name": "usbmuxd", - "version-string": "1.2.235", - "port-version": 1, + "version": "1.2.235", + "port-version": 2, "description": "A socket daemon to multiplex connections from and to iOS devices", "homepage": "http://www.libimobiledevice.org", + "license": "LGPL-2.1-only", + "supports": "windows & !arm64", "dependencies": [ "libimobiledevice", "libusb", diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index e5e4503d36..5fbf492203 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -512,10 +512,6 @@ libtomcrypt:arm-uwp=fail libusb:arm-uwp=fail libusb:x64-uwp=fail libusb:arm64-windows=fail -libusbmuxd:arm-uwp=fail -libusbmuxd:x64-uwp=fail -libusbmuxd:x64-linux=fail -libusbmuxd:x64-osx=fail libusb-win32:arm-uwp=fail libusb-win32:x64-linux=fail libusb-win32:x64-osx=fail diff --git a/versions/baseline.json b/versions/baseline.json index 8277f254c4..83fc8b63c9 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2970,7 +2970,7 @@ }, "ideviceinstaller": { "baseline": "1.1.2.23", - "port-version": 3 + "port-version": 4 }, "idevicerestore": { "baseline": "1.0.12", @@ -3878,11 +3878,11 @@ }, "libimobiledevice": { "baseline": "1.3.17", - "port-version": 0 + "port-version": 1 }, "libirecovery": { "baseline": "1.0.25", - "port-version": 4 + "port-version": 5 }, "libjpeg-turbo": { "baseline": "2.1.4", @@ -4102,7 +4102,7 @@ }, "libplist": { "baseline": "1.3.6", - "port-version": 1 + "port-version": 2 }, "libpmemobj-cpp": { "baseline": "1.13.0", @@ -4358,7 +4358,7 @@ }, "libusbmuxd": { "baseline": "1.2.219", - "port-version": 2 + "port-version": 3 }, "libuuid": { "baseline": "1.0.3", @@ -7726,7 +7726,7 @@ }, "usbmuxd": { "baseline": "1.2.235", - "port-version": 1 + "port-version": 2 }, "usd": { "baseline": "20.08", diff --git a/versions/i-/ideviceinstaller.json b/versions/i-/ideviceinstaller.json index 666d716a5f..dfcc843b27 100644 --- a/versions/i-/ideviceinstaller.json +++ b/versions/i-/ideviceinstaller.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "82bc629affc514c34b77216d2a00cfbbcf1f2220", + "version": "1.1.2.23", + "port-version": 4 + }, { "git-tree": "38626b7d6489e6842528257d8a38b2dd31627720", "version-string": "1.1.2.23", diff --git a/versions/l-/libimobiledevice.json b/versions/l-/libimobiledevice.json index c249e19627..53866053dc 100644 --- a/versions/l-/libimobiledevice.json +++ b/versions/l-/libimobiledevice.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "0f57daa63ba49e977a8e72eea7d3615cdda07648", + "version": "1.3.17", + "port-version": 1 + }, { "git-tree": "5bf3d6cdc93021dcc048d73d7153aebecd91c47e", "version": "1.3.17", diff --git a/versions/l-/libirecovery.json b/versions/l-/libirecovery.json index d24780b0d3..a1fd2eebb6 100644 --- a/versions/l-/libirecovery.json +++ b/versions/l-/libirecovery.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "586b5bd01468f7690094397c1b3f8fed0456d65e", + "version": "1.0.25", + "port-version": 5 + }, { "git-tree": "1396dbed8e08ee556ad00ce3a67ba0de7c7b6298", "version-string": "1.0.25", diff --git a/versions/l-/libplist.json b/versions/l-/libplist.json index 7cc0698650..5c5d1a0c59 100644 --- a/versions/l-/libplist.json +++ b/versions/l-/libplist.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "e18bc499ccc42a248f2d88c1f5614d4f4314f4eb", + "version": "1.3.6", + "port-version": 2 + }, { "git-tree": "75eb83284f3361bf04af84e67e0ed0439432c3f5", "version": "1.3.6", diff --git a/versions/l-/libusbmuxd.json b/versions/l-/libusbmuxd.json index 06351ca95d..520deb97c4 100644 --- a/versions/l-/libusbmuxd.json +++ b/versions/l-/libusbmuxd.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "82278a08f20aabe20c5ba0981de631ad6f9df469", + "version": "1.2.219", + "port-version": 3 + }, { "git-tree": "2d6ac12d94326fae11d86e39030433003251aa62", "version": "1.2.219", diff --git a/versions/u-/usbmuxd.json b/versions/u-/usbmuxd.json index 04dc3433b1..ee07e21d44 100644 --- a/versions/u-/usbmuxd.json +++ b/versions/u-/usbmuxd.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "53c6e0e8c2a4f5db93d2a41d51d2aa8ba68b8e7e", + "version": "1.2.235", + "port-version": 2 + }, { "git-tree": "072dd356dfeda50c73780a204db5f5f6224cd35c", "version-string": "1.2.235",