aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/libimobiledevice-glue
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/libimobiledevice-glue')
-rw-r--r--vcpkg/ports/libimobiledevice-glue/001_fix_win32_defs.patch57
-rw-r--r--vcpkg/ports/libimobiledevice-glue/002_fix_msvc.patch47
-rw-r--r--vcpkg/ports/libimobiledevice-glue/003_fix_static_build.patch19
-rw-r--r--vcpkg/ports/libimobiledevice-glue/004_fix_api.patch20
-rw-r--r--vcpkg/ports/libimobiledevice-glue/CMakeLists.txt77
-rw-r--r--vcpkg/ports/libimobiledevice-glue/exports.def81
-rw-r--r--vcpkg/ports/libimobiledevice-glue/portfile.cmake35
-rw-r--r--vcpkg/ports/libimobiledevice-glue/usage4
-rw-r--r--vcpkg/ports/libimobiledevice-glue/vcpkg.json18
9 files changed, 358 insertions, 0 deletions
diff --git a/vcpkg/ports/libimobiledevice-glue/001_fix_win32_defs.patch b/vcpkg/ports/libimobiledevice-glue/001_fix_win32_defs.patch
new file mode 100644
index 0000000..f0dd322
--- /dev/null
+++ b/vcpkg/ports/libimobiledevice-glue/001_fix_win32_defs.patch
@@ -0,0 +1,57 @@
+diff --git a/include/libimobiledevice-glue/socket.h b/include/libimobiledevice-glue/socket.h
+index 53f58b8..f3cc6c6 100644
+--- a/include/libimobiledevice-glue/socket.h
++++ b/include/libimobiledevice-glue/socket.h
+@@ -32,7 +32,7 @@ enum fd_mode {
+ };
+ typedef enum fd_mode fd_mode;
+
+-#ifdef WIN32
++#ifdef _WIN32
+ #include <winsock2.h>
+ #define SHUT_RD SD_READ
+ #define SHUT_WR SD_WRITE
+@@ -41,7 +41,7 @@ typedef enum fd_mode fd_mode;
+ #include <sys/socket.h>
+ #endif
+
+-#ifndef WIN32
++#ifndef _WIN32
+ int socket_create_unix(const char *filename);
+ int socket_connect_unix(const char *filename);
+ #endif
+diff --git a/include/libimobiledevice-glue/thread.h b/include/libimobiledevice-glue/thread.h
+index 2aadc6e..b5c2ac1 100644
+--- a/include/libimobiledevice-glue/thread.h
++++ b/include/libimobiledevice-glue/thread.h
+@@ -24,7 +24,7 @@
+
+ #include <stddef.h>
+
+-#ifdef WIN32
++#ifdef _WIN32
+ #include <windows.h>
+ typedef HANDLE THREAD_T;
+ typedef CRITICAL_SECTION mutex_t;
+@@ -61,7 +61,7 @@ int thread_alive(THREAD_T thread);
+
+ int thread_cancel(THREAD_T thread);
+
+-#ifdef WIN32
++#ifdef _WIN32
+ #undef HAVE_THREAD_CLEANUP
+ #else
+ #ifdef HAVE_PTHREAD_CANCEL
+diff --git a/include/libimobiledevice-glue/utils.h b/include/libimobiledevice-glue/utils.h
+index 1a21871..2421270 100644
+--- a/include/libimobiledevice-glue/utils.h
++++ b/include/libimobiledevice-glue/utils.h
+@@ -29,7 +29,7 @@
+ #include <config.h>
+ #endif
+
+-#ifdef WIN32
++#ifdef _WIN32
+ #include <windows.h>
+ #endif
+
diff --git a/vcpkg/ports/libimobiledevice-glue/002_fix_msvc.patch b/vcpkg/ports/libimobiledevice-glue/002_fix_msvc.patch
new file mode 100644
index 0000000..d8a8c98
--- /dev/null
+++ b/vcpkg/ports/libimobiledevice-glue/002_fix_msvc.patch
@@ -0,0 +1,47 @@
+diff --git a/src/socket.c b/src/socket.c
+index 4b8b857..4cf8a92 100644
+--- a/src/socket.c
++++ b/src/socket.c
+@@ -26,10 +26,12 @@
+ #include <stddef.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <unistd.h>
+ #include <errno.h>
+-#include <sys/time.h>
+ #include <sys/stat.h>
++#ifndef _MSC_VER
++#include <unistd.h>
++#include <sys/time.h>
++#endif
+ #ifdef WIN32
+ #include <winsock2.h>
+ #include <ws2tcpip.h>
+diff --git a/src/termcolors.c b/src/termcolors.c
+index 5c436f2..9a84ff2 100644
+--- a/src/termcolors.c
++++ b/src/termcolors.c
+@@ -28,7 +28,9 @@
+
+ #include <stdio.h>
+ #include <stdlib.h>
++#ifndef _MSC_VER
+ #include <unistd.h>
++#endif
+ #include <string.h>
+ #include <stdarg.h>
+
+diff --git a/src/utils.c b/src/utils.c
+index ad8e9c4..b9803ac 100644
+--- a/src/utils.c
++++ b/src/utils.c
+@@ -30,7 +30,9 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <time.h>
++#ifndef _MSC_VER
+ #include <sys/time.h>
++#endif
+ #include <inttypes.h>
+ #include <ctype.h>
+ #include <errno.h>
diff --git a/vcpkg/ports/libimobiledevice-glue/003_fix_static_build.patch b/vcpkg/ports/libimobiledevice-glue/003_fix_static_build.patch
new file mode 100644
index 0000000..4e587cf
--- /dev/null
+++ b/vcpkg/ports/libimobiledevice-glue/003_fix_static_build.patch
@@ -0,0 +1,19 @@
+diff --git a/src/glue.c b/src/glue.c
+index 7970679..bad3269 100644
+--- a/src/glue.c
++++ b/src/glue.c
+@@ -29,6 +29,8 @@
+ #include "common.h"
+ #include "libimobiledevice-glue/thread.h"
+
++#ifndef LIBIMOBILEDEVICEGLUE_STATIC // disable dll constructor
++
+ extern void term_colors_init();
+
+ static void internal_glue_init(void)
+@@ -78,3 +80,5 @@ BOOL WINAPI DllMain(HINSTANCE hModule, DWORD dwReason, LPVOID lpReserved)
+ #else
+ #warning No compiler support for constructor/destructor attributes, some features might not be available.
+ #endif
++
++#endif // disable dll constructor
diff --git a/vcpkg/ports/libimobiledevice-glue/004_fix_api.patch b/vcpkg/ports/libimobiledevice-glue/004_fix_api.patch
new file mode 100644
index 0000000..9eea958
--- /dev/null
+++ b/vcpkg/ports/libimobiledevice-glue/004_fix_api.patch
@@ -0,0 +1,20 @@
+diff --git a/src/common.h b/src/common.h
+index bd22e3d..144a799 100644
+--- a/src/common.h
++++ b/src/common.h
+@@ -25,14 +25,10 @@
+ #include <config.h>
+ #endif
+
+-#ifdef WIN32
+-#define LIBIMOBILEDEVICE_GLUE_API __declspec( dllexport )
+-#else
+-#ifdef HAVE_FVISIBILITY
++#if !defined(_WIN32) && !defined(LIBIMOBILEDEVICEGLUE_STATIC)
+ #define LIBIMOBILEDEVICE_GLUE_API __attribute__((visibility("default")))
+ #else
+ #define LIBIMOBILEDEVICE_GLUE_API
+ #endif
+-#endif
+
+ #endif
diff --git a/vcpkg/ports/libimobiledevice-glue/CMakeLists.txt b/vcpkg/ports/libimobiledevice-glue/CMakeLists.txt
new file mode 100644
index 0000000..56bbaab
--- /dev/null
+++ b/vcpkg/ports/libimobiledevice-glue/CMakeLists.txt
@@ -0,0 +1,77 @@
+cmake_minimum_required(VERSION 3.15)
+project(libimobiledevice-glue C CXX)
+
+include(GNUInstallDirs)
+
+file(GLOB_RECURSE LIBIMOBILEDEVICEGLUE_SOURCE src/*.c)
+
+set(DEFINITIONS)
+
+if(BUILD_SHARED_LIBS)
+ if(WIN32)
+ list(APPEND LIBIMOBILEDEVICEGLUE_SOURCE exports.def)
+ endif()
+else()
+ list(APPEND DEFINITIONS -DLIBIMOBILEDEVICEGLUE_STATIC)
+endif()
+
+if(UNIX)
+ list(APPEND DEFINITIONS -DHAVE_GETIFADDRS)
+endif()
+
+if(WIN32)
+ list(APPEND DEFINITIONS -D_CRT_SECURE_NO_WARNINGS)
+ list(APPEND DEFINITIONS -DWIN32)
+endif()
+
+find_package(unofficial-libplist CONFIG REQUIRED)
+
+add_library(libimobiledevice-glue ${LIBIMOBILEDEVICEGLUE_SOURCE})
+target_include_directories(libimobiledevice-glue
+ PRIVATE
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
+ PUBLIC
+ "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
+)
+target_compile_definitions(libimobiledevice-glue PRIVATE ${DEFINITIONS})
+target_link_libraries(libimobiledevice-glue
+ PUBLIC
+ unofficial::libplist::libplist
+)
+set_target_properties(libimobiledevice-glue PROPERTIES OUTPUT_NAME imobiledevice-glue-1.0)
+
+if(WIN32)
+ target_link_libraries(libimobiledevice-glue PRIVATE Ws2_32 Iphlpapi)
+endif()
+
+install(TARGETS libimobiledevice-glue EXPORT unofficial-libimobiledevice-glue)
+
+install(
+ EXPORT unofficial-libimobiledevice-glue
+ FILE unofficial-libimobiledevice-glue-config.cmake
+ DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/unofficial-libimobiledevice-glue"
+ NAMESPACE unofficial::libimobiledevice-glue::
+)
+
+install(
+ DIRECTORY "${CMAKE_SOURCE_DIR}/include/libimobiledevice-glue"
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
+)
+
+set(LIBPLIST_VERSION 2.0)
+set(PACKAGE_NAME libimobiledevice-glue)
+set(PACKAGE_VERSION 1.0)
+set(prefix "")
+set(exec_prefix "\${prefix}")
+set(libdir "\${prefix}/lib")
+set(includedir "\${prefix}/include")
+
+configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/src/libimobiledevice-glue-1.0.pc.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/libimobiledevice-glue-1.0.pc"
+ @ONLY
+)
+install(
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/libimobiledevice-glue-1.0.pc"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
+)
diff --git a/vcpkg/ports/libimobiledevice-glue/exports.def b/vcpkg/ports/libimobiledevice-glue/exports.def
new file mode 100644
index 0000000..03aca56
--- /dev/null
+++ b/vcpkg/ports/libimobiledevice-glue/exports.def
@@ -0,0 +1,81 @@
+EXPORTS
+
+ ; src/cbuf.c
+ char_buf_new
+ char_buf_free
+ char_buf_append
+
+ ; src/collention.c
+ collection_init
+ collection_free
+ collection_add
+ collection_remove
+ collection_count
+ collection_copy
+
+ ; opack.c
+ opack_encode_from_plist
+ opack_decode_to_plist
+
+ ; src/socket.c
+ socket_set_verbose
+ socket_addr_to_string
+ ;socket_create_unix
+ ;socket_connect_unix
+ socket_create
+ get_primary_mac_address
+ socket_connect_addr
+ socket_connect
+ socket_check_fd
+ socket_accept
+ socket_shutdown
+ socket_close
+ socket_receive
+ socket_peek
+ socket_receive_timeout
+ socket_send
+ socket_get_socket_port
+
+ ; src/termcolors.c
+ term_colors_init
+ term_colors_set_enabled
+ cvfprintf
+ cfprintf
+ cprintf
+
+ ; src/thread.c
+ thread_new
+ thread_detach
+ thread_free
+ thread_join
+ thread_alive
+ thread_cancel
+ mutex_init
+ mutex_destroy
+ mutex_lock
+ mutex_unlock
+ thread_once
+ cond_init
+ cond_destroy
+ cond_signal
+ cond_wait
+ cond_wait_timeout
+
+ ; src/tlv.c
+ tlv_buf_new
+ tlv_buf_free
+ tlv_buf_append
+ tlv_get_data_ptr
+ tlv_data_get_uint
+ tlv_data_get_uint8
+ tlv_data_copy_data
+
+ ; src/utils.c
+ string_concat
+ string_append
+ string_build_path
+ string_format_size
+ string_toupper
+ generate_uuid
+ buffer_read_from_filename
+ buffer_write_to_filename
diff --git a/vcpkg/ports/libimobiledevice-glue/portfile.cmake b/vcpkg/ports/libimobiledevice-glue/portfile.cmake
new file mode 100644
index 0000000..7daca51
--- /dev/null
+++ b/vcpkg/ports/libimobiledevice-glue/portfile.cmake
@@ -0,0 +1,35 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO libimobiledevice/libimobiledevice-glue
+ REF 214bafdde6a1434ead87357afe6cb41b32318495 # commits on 2023-05-13
+ SHA512 a12ace7690ebab0ac6372f61e1a6722d506bc20a89130f39441af4da74e8fe9cdae45d947eb3e864a5f043b621432b59418f8e4660857e25b648a9476c552ac6
+ HEAD_REF master
+ PATCHES
+ 001_fix_win32_defs.patch
+ 002_fix_msvc.patch
+ 003_fix_static_build.patch
+ 004_fix_api.patch
+)
+
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/exports.def" DESTINATION "${SOURCE_PATH}")
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+)
+
+vcpkg_cmake_install()
+vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-${PORT})
+vcpkg_fixup_pkgconfig()
+
+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)
+${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/libimobiledevice-glue/usage b/vcpkg/ports/libimobiledevice-glue/usage
new file mode 100644
index 0000000..c4868a6
--- /dev/null
+++ b/vcpkg/ports/libimobiledevice-glue/usage
@@ -0,0 +1,4 @@
+libimobiledevice-glue provides CMake targets:
+
+ find_package(unofficial-libimobiledevice-glue CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE unofficial::libimobiledevice-glue::libimobiledevice-glue)
diff --git a/vcpkg/ports/libimobiledevice-glue/vcpkg.json b/vcpkg/ports/libimobiledevice-glue/vcpkg.json
new file mode 100644
index 0000000..79b8ab5
--- /dev/null
+++ b/vcpkg/ports/libimobiledevice-glue/vcpkg.json
@@ -0,0 +1,18 @@
+{
+ "name": "libimobiledevice-glue",
+ "version-date": "2023-05-13",
+ "description": "Library with common code used by the libraries and tools around the libimobiledevice project.",
+ "homepage": "https://libimobiledevice.org/",
+ "license": "LGPL-2.1-or-later",
+ "dependencies": [
+ "libplist",
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}