aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/libusbmuxd
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/libusbmuxd
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/libusbmuxd')
-rw-r--r--vcpkg/ports/libusbmuxd/001_fix_win32_defs.patch13
-rw-r--r--vcpkg/ports/libusbmuxd/002_fix_struct_pack.patch50
-rw-r--r--vcpkg/ports/libusbmuxd/003_fix_msvc.patch37
-rw-r--r--vcpkg/ports/libusbmuxd/004_fix_api.patch22
-rw-r--r--vcpkg/ports/libusbmuxd/005_fix_tools_msvc.patch42
-rw-r--r--vcpkg/ports/libusbmuxd/CMakeLists.txt117
-rw-r--r--vcpkg/ports/libusbmuxd/exports.def21
-rw-r--r--vcpkg/ports/libusbmuxd/portfile.cmake47
-rw-r--r--vcpkg/ports/libusbmuxd/usage4
-rw-r--r--vcpkg/ports/libusbmuxd/vcpkg.json30
10 files changed, 383 insertions, 0 deletions
diff --git a/vcpkg/ports/libusbmuxd/001_fix_win32_defs.patch b/vcpkg/ports/libusbmuxd/001_fix_win32_defs.patch
new file mode 100644
index 0000000..952a9dc
--- /dev/null
+++ b/vcpkg/ports/libusbmuxd/001_fix_win32_defs.patch
@@ -0,0 +1,13 @@
+diff --git a/include/usbmuxd-proto.h b/include/usbmuxd-proto.h
+index a2a731e..38473f5 100644
+--- a/include/usbmuxd-proto.h
++++ b/include/usbmuxd-proto.h
+@@ -26,7 +26,7 @@
+ #include <stdint.h>
+ #define USBMUXD_PROTOCOL_VERSION 0
+
+-#if defined(WIN32) || defined(__CYGWIN__)
++#if defined(_WIN32) || defined(__CYGWIN__)
+ #define USBMUXD_SOCKET_PORT 27015
+ #else
+ #define USBMUXD_SOCKET_FILE "/var/run/usbmuxd"
diff --git a/vcpkg/ports/libusbmuxd/002_fix_struct_pack.patch b/vcpkg/ports/libusbmuxd/002_fix_struct_pack.patch
new file mode 100644
index 0000000..0dfd27f
--- /dev/null
+++ b/vcpkg/ports/libusbmuxd/002_fix_struct_pack.patch
@@ -0,0 +1,50 @@
+diff --git a/include/usbmuxd-proto.h b/include/usbmuxd-proto.h
+index 38473f5..d004232 100644
+--- a/include/usbmuxd-proto.h
++++ b/include/usbmuxd-proto.h
+@@ -57,28 +57,30 @@ enum usbmuxd_msgtype {
+ MESSAGE_PLIST = 8,
+ };
+
++#pragma pack(push, 1)
++
+ struct usbmuxd_header {
+ uint32_t length; // length of message, including header
+ uint32_t version; // protocol version
+ uint32_t message; // message type
+ uint32_t tag; // responses to this query will echo back this tag
+-} __attribute__((__packed__));
++};
+
+ struct usbmuxd_result_msg {
+ struct usbmuxd_header header;
+ uint32_t result;
+-} __attribute__((__packed__));
++};
+
+ struct usbmuxd_connect_request {
+ struct usbmuxd_header header;
+ uint32_t device_id;
+ uint16_t port; // TCP port number
+ uint16_t reserved; // set to zero
+-} __attribute__((__packed__));
++};
+
+ struct usbmuxd_listen_request {
+ struct usbmuxd_header header;
+-} __attribute__((__packed__));
++};
+
+ struct usbmuxd_device_record {
+ uint32_t device_id;
+@@ -86,7 +88,9 @@ struct usbmuxd_device_record {
+ char serial_number[256];
+ uint16_t padding;
+ uint32_t location;
+-} __attribute__((__packed__));
++};
++
++#pragma pack(pop)
+
+ #ifdef __cplusplus
+ }
diff --git a/vcpkg/ports/libusbmuxd/003_fix_msvc.patch b/vcpkg/ports/libusbmuxd/003_fix_msvc.patch
new file mode 100644
index 0000000..e285d22
--- /dev/null
+++ b/vcpkg/ports/libusbmuxd/003_fix_msvc.patch
@@ -0,0 +1,37 @@
+diff --git a/src/libusbmuxd.c b/src/libusbmuxd.c
+index 95e322f..c5c8f09 100644
+--- a/src/libusbmuxd.c
++++ b/src/libusbmuxd.c
+@@ -49,7 +49,9 @@
+ #define ECONNREFUSED 107
+ #endif
+
++#ifndef _MSC_VER
+ #include <unistd.h>
++#endif
+ #include <signal.h>
+
+ #ifdef WIN32
+@@ -91,6 +93,10 @@ static char* stpncpy(char *dst, const char *src, size_t len)
+ }
+ #endif
+
++#ifdef _MSC_VER
++#define strcasecmp _stricmp
++#endif
++
+ #include <plist/plist.h>
+ #define PLIST_CLIENT_VERSION_STRING PACKAGE_STRING
+ #define PLIST_LIBUSBMUX_VERSION 3
+@@ -1590,7 +1596,11 @@ USBMUXD_API int usbmuxd_send(int sfd, const char *data, uint32_t len, uint32_t *
+ num_sent = socket_send(sfd, (void*)data, len);
+ if (num_sent < 0) {
+ *sent_bytes = 0;
++#ifdef WIN32
++ num_sent = WSAGetLastError();
++#else
+ num_sent = errno;
++#endif
+ LIBUSBMUXD_DEBUG(1, "%s: Error %d when sending: %s\n", __func__, num_sent, strerror(num_sent));
+ return -num_sent;
+ }
diff --git a/vcpkg/ports/libusbmuxd/004_fix_api.patch b/vcpkg/ports/libusbmuxd/004_fix_api.patch
new file mode 100644
index 0000000..c06e19d
--- /dev/null
+++ b/vcpkg/ports/libusbmuxd/004_fix_api.patch
@@ -0,0 +1,22 @@
+diff --git a/src/libusbmuxd.c b/src/libusbmuxd.c
+index c5c8f09..edab706 100644
+--- a/src/libusbmuxd.c
++++ b/src/libusbmuxd.c
+@@ -29,14 +29,10 @@
+ #include <stdio.h>
+ #include <string.h>
+
+-#ifdef WIN32
+- #define USBMUXD_API __declspec( dllexport )
++#if !defined(_WIN32) && !defined(LIBUSBMUXD_STATIC)
++#define USBMUXD_API __attribute__((visibility("default")))
+ #else
+- #ifdef HAVE_FVISIBILITY
+- #define USBMUXD_API __attribute__((visibility("default")))
+- #else
+- #define USBMUXD_API
+- #endif
++#define USBMUXD_API
+ #endif
+
+ #ifndef EPROTO
diff --git a/vcpkg/ports/libusbmuxd/005_fix_tools_msvc.patch b/vcpkg/ports/libusbmuxd/005_fix_tools_msvc.patch
new file mode 100644
index 0000000..2804e61
--- /dev/null
+++ b/vcpkg/ports/libusbmuxd/005_fix_tools_msvc.patch
@@ -0,0 +1,42 @@
+diff --git a/tools/inetcat.c b/tools/inetcat.c
+index f70215b..748db15 100644
+--- a/tools/inetcat.c
++++ b/tools/inetcat.c
+@@ -33,7 +33,9 @@
+ #include <string.h>
+ #include <fcntl.h>
+ #include <stddef.h>
++#ifndef _MSC_VER
+ #include <unistd.h>
++#endif
+ #include <errno.h>
+ #include <getopt.h>
+ #ifdef WIN32
+@@ -50,6 +52,13 @@
+ #include "usbmuxd.h"
+ #include <libimobiledevice-glue/socket.h>
+
++#ifdef _MSC_VER
++#include <BaseTsd.h>
++typedef SSIZE_T ssize_t;
++#define STDIN_FILENO _fileno(stdin)
++#define STDOUT_FILENO _fileno(stdout)
++#endif
++
+ static int debug_level = 0;
+
+ static size_t read_data_socket(int fd, uint8_t* buf, size_t bufsize)
+diff --git a/tools/iproxy.c b/tools/iproxy.c
+index d5f66b6..6510cb8 100644
+--- a/tools/iproxy.c
++++ b/tools/iproxy.c
+@@ -34,7 +34,9 @@
+ #include <string.h>
+ #include <fcntl.h>
+ #include <stddef.h>
++#ifndef _MSC_VER
+ #include <unistd.h>
++#endif
+ #include <errno.h>
+ #include <getopt.h>
+ #ifdef WIN32
diff --git a/vcpkg/ports/libusbmuxd/CMakeLists.txt b/vcpkg/ports/libusbmuxd/CMakeLists.txt
new file mode 100644
index 0000000..cfe8eae
--- /dev/null
+++ b/vcpkg/ports/libusbmuxd/CMakeLists.txt
@@ -0,0 +1,117 @@
+cmake_minimum_required(VERSION 3.15)
+project(libusbmuxd C)
+
+option(BUILD_TOOLS "Build tools." OFF)
+
+include(GNUInstallDirs)
+
+file(GLOB_RECURSE LIBUSBMUXD_HEADER include/*.h)
+file(GLOB_RECURSE LIBUSBMUXD_SOURCE src/*.c)
+
+set(DEFINITIONS)
+
+list(APPEND DEFINITIONS -DPACKAGE_STRING="2.0.2")
+
+if(BUILD_SHARED_LIBS)
+ if(WIN32)
+ list(APPEND LIBUSBMUXD_SOURCE exports.def)
+ endif()
+else()
+ list(APPEND DEFINITIONS -DLIBUSBMUXD_STATIC)
+endif()
+
+if(UNIX)
+ list(APPEND DEFINITIONS -DHAVE_GETIFADDRS)
+ list(APPEND DEFINITIONS -DHAVE_STPNCPY)
+endif()
+
+if(WIN32)
+ list(APPEND DEFINITIONS -D_CRT_SECURE_NO_WARNINGS)
+ list(APPEND DEFINITIONS -DWIN32_LEAN_AND_MEAN)
+ list(APPEND DEFINITIONS -DWIN32)
+endif()
+
+find_package(unofficial-libplist CONFIG REQUIRED)
+find_package(unofficial-libimobiledevice-glue CONFIG REQUIRED)
+
+add_library(libusbmuxd ${LIBUSBMUXD_SOURCE})
+target_include_directories(libusbmuxd PUBLIC
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
+ "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
+)
+target_compile_definitions(libusbmuxd PRIVATE ${DEFINITIONS})
+target_link_libraries(libusbmuxd
+ PRIVATE
+ unofficial::libplist::libplist
+ unofficial::libimobiledevice-glue::libimobiledevice-glue
+)
+set_target_properties(libusbmuxd PROPERTIES OUTPUT_NAME usbmuxd-2.0)
+
+if(WIN32)
+ target_link_libraries(libusbmuxd PRIVATE Ws2_32)
+endif()
+
+install(TARGETS libusbmuxd EXPORT unofficial-libusbmuxd)
+
+install(
+ EXPORT unofficial-libusbmuxd
+ FILE unofficial-libusbmuxd-config.cmake
+ DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/unofficial-libusbmuxd"
+ NAMESPACE unofficial::libusbmuxd::
+)
+
+install(
+ FILES ${LIBUSBMUXD_HEADER}
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
+)
+
+set(LIBPLIST_VERSION 2.0)
+set(LIMD_GLUE_VERSION 1.0)
+set(PACKAGE_NAME libusbmuxd)
+set(PACKAGE_VERSION 2.0)
+set(prefix "")
+set(exec_prefix "\${prefix}")
+set(libdir "\${prefix}/lib")
+set(includedir "\${prefix}/include")
+
+configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/src/libusbmuxd-2.0.pc.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/libusbmuxd-2.0.pc"
+ @ONLY
+)
+install(
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/libusbmuxd-2.0.pc"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
+)
+
+if(BUILD_TOOLS)
+ if(WIN32)
+ find_package(unofficial-getopt-win32 REQUIRED)
+ endif()
+
+ function(add_tool name source)
+ add_executable("${name}" "${source}")
+ target_compile_definitions("${name}" PRIVATE
+ -DPACKAGE_VERSION="2.0.2"
+ -DPACKAGE_URL="https://github.com/libimobiledevice/libusbmuxd"
+ -DPACKAGE_BUGREPORT="https://github.com/libimobiledevice/libusbmuxd/issues"
+ )
+ target_link_libraries("${name}" PRIVATE libusbmuxd unofficial::libimobiledevice-glue::libimobiledevice-glue)
+ if(WIN32)
+ target_compile_definitions("${name}" PRIVATE
+ -D_CRT_SECURE_NO_WARNINGS
+ -DWIN32_LEAN_AND_MEAN
+ -DWIN32
+ )
+ target_link_libraries("${name}" PRIVATE unofficial::getopt-win32::getopt Ws2_32)
+ endif()
+ endfunction(add_tool)
+
+ add_tool(inetcat "tools/inetcat.c")
+ add_tool(iproxy "tools/iproxy.c")
+
+ install(
+ TARGETS inetcat iproxy
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ )
+endif()
diff --git a/vcpkg/ports/libusbmuxd/exports.def b/vcpkg/ports/libusbmuxd/exports.def
new file mode 100644
index 0000000..a89e7e7
--- /dev/null
+++ b/vcpkg/ports/libusbmuxd/exports.def
@@ -0,0 +1,21 @@
+EXPORTS
+ usbmuxd_events_subscribe
+ usbmuxd_events_unsubscribe
+ usbmuxd_subscribe
+ usbmuxd_unsubscribe
+ usbmuxd_get_device_list
+ usbmuxd_device_list_free
+ usbmuxd_get_device_by_udid
+ usbmuxd_get_device
+ usbmuxd_connect
+ usbmuxd_disconnect
+ usbmuxd_send
+ usbmuxd_recv_timeout
+ usbmuxd_recv
+ usbmuxd_read_buid
+ usbmuxd_read_pair_record
+ usbmuxd_save_pair_record_with_device_id
+ usbmuxd_save_pair_record
+ usbmuxd_delete_pair_record
+ libusbmuxd_set_use_inotify
+ libusbmuxd_set_debug_level
diff --git a/vcpkg/ports/libusbmuxd/portfile.cmake b/vcpkg/ports/libusbmuxd/portfile.cmake
new file mode 100644
index 0000000..3bd300e
--- /dev/null
+++ b/vcpkg/ports/libusbmuxd/portfile.cmake
@@ -0,0 +1,47 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO libimobiledevice/libusbmuxd
+ REF 8d30a559cf0585625d9d05dc8ce0dd495b1de4f4 # commits on 2023-06-21
+ SHA512 ace920d13908c12afcc9182776a668f6876b2f037b21a151c1dca897aa24bc24cb41898471cd258487963772963753457be5efba2657571cf2c07c8225b68a5f
+ HEAD_REF master
+ PATCHES
+ 001_fix_win32_defs.patch
+ 002_fix_struct_pack.patch
+ 003_fix_msvc.patch
+ 004_fix_api.patch
+ 005_fix_tools_msvc.patch
+)
+
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/exports.def" 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 inetcat iproxy AUTO_CLEAN)
+endif()
+
+file(READ "${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}/unofficial-${PORT}-config.cmake" cmake_config)
+file(WRITE "${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}/unofficial-${PORT}-config.cmake"
+"include(CMakeFindDependencyMacro)
+find_dependency(unofficial-libplist CONFIG)
+find_dependency(unofficial-libimobiledevice-glue CONFIG)
+${cmake_config}
+")
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
+file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
diff --git a/vcpkg/ports/libusbmuxd/usage b/vcpkg/ports/libusbmuxd/usage
new file mode 100644
index 0000000..2f98e1d
--- /dev/null
+++ b/vcpkg/ports/libusbmuxd/usage
@@ -0,0 +1,4 @@
+libusbmuxd provides CMake targets:
+
+ find_package(unofficial-libusbmuxd CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE unofficial::libusbmuxd::libusbmuxd)
diff --git a/vcpkg/ports/libusbmuxd/vcpkg.json b/vcpkg/ports/libusbmuxd/vcpkg.json
new file mode 100644
index 0000000..78a75a3
--- /dev/null
+++ b/vcpkg/ports/libusbmuxd/vcpkg.json
@@ -0,0 +1,30 @@
+{
+ "name": "libusbmuxd",
+ "version-date": "2023-06-21",
+ "port-version": 1,
+ "description": "A client library to multiplex connections from and to iOS devices",
+ "homepage": "https://libimobiledevice.org/",
+ "license": "LGPL-2.1-or-later",
+ "supports": "!uwp",
+ "dependencies": [
+ "libimobiledevice-glue",
+ "libplist",
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "features": {
+ "tools": {
+ "description": "build command line tool",
+ "supports": "!android & !ios & !xbox",
+ "dependencies": [
+ "getopt"
+ ]
+ }
+ }
+}