aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/libideviceactivation
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/libideviceactivation')
-rw-r--r--vcpkg/ports/libideviceactivation/001_fix_static_build.patch21
-rw-r--r--vcpkg/ports/libideviceactivation/002_fix_api.patch21
-rw-r--r--vcpkg/ports/libideviceactivation/003_fix_tools_msvc.patch14
-rw-r--r--vcpkg/ports/libideviceactivation/CMakeLists.txt103
-rw-r--r--vcpkg/ports/libideviceactivation/exports.def31
-rw-r--r--vcpkg/ports/libideviceactivation/portfile.cmake47
-rw-r--r--vcpkg/ports/libideviceactivation/usage4
-rw-r--r--vcpkg/ports/libideviceactivation/vcpkg.json29
8 files changed, 270 insertions, 0 deletions
diff --git a/vcpkg/ports/libideviceactivation/001_fix_static_build.patch b/vcpkg/ports/libideviceactivation/001_fix_static_build.patch
new file mode 100644
index 0000000..be47327
--- /dev/null
+++ b/vcpkg/ports/libideviceactivation/001_fix_static_build.patch
@@ -0,0 +1,21 @@
+diff --git a/src/activation.c b/src/activation.c
+index 4260c20..29bb2e8 100644
+--- a/src/activation.c
++++ b/src/activation.c
+@@ -90,6 +90,7 @@ struct idevice_activation_response_private {
+ int has_errors;
+ };
+
++#ifndef LIBIDEVICEACTIVATION_STATIC // disable dll constructor
+
+ static void internal_libideviceactivation_init(void)
+ {
+@@ -162,6 +163,8 @@ BOOL WINAPI DllMain(HINSTANCE hModule, DWORD dwReason, LPVOID lpReserved)
+ #warning No compiler support for constructor/destructor attributes, some features might not be available.
+ #endif
+
++#endif // disable dll constructor
++
+ static int debug_level = 0;
+
+ IDEVICE_ACTIVATION_API void idevice_activation_set_debug_level(int level) {
diff --git a/vcpkg/ports/libideviceactivation/002_fix_api.patch b/vcpkg/ports/libideviceactivation/002_fix_api.patch
new file mode 100644
index 0000000..8aea70d
--- /dev/null
+++ b/vcpkg/ports/libideviceactivation/002_fix_api.patch
@@ -0,0 +1,21 @@
+diff --git a/src/activation.c b/src/activation.c
+index 29bb2e8..69ec7b4 100644
+--- a/src/activation.c
++++ b/src/activation.c
+@@ -32,15 +32,11 @@
+ #include <libxml/HTMLtree.h>
+ #include <curl/curl.h>
+
+-#ifdef WIN32
+-#define IDEVICE_ACTIVATION_API __declspec( dllexport )
+-#else
+-#ifdef HAVE_FVISIBILITY
++#if !defined(_WIN32) && !defined(LIBIDEVICEACTIVATION_STATIC)
+ #define IDEVICE_ACTIVATION_API __attribute__((visibility("default")))
+ #else
+ #define IDEVICE_ACTIVATION_API
+ #endif
+-#endif
+
+ #ifdef WIN32
+ #include <windows.h>
diff --git a/vcpkg/ports/libideviceactivation/003_fix_tools_msvc.patch b/vcpkg/ports/libideviceactivation/003_fix_tools_msvc.patch
new file mode 100644
index 0000000..e89ae7f
--- /dev/null
+++ b/vcpkg/ports/libideviceactivation/003_fix_tools_msvc.patch
@@ -0,0 +1,14 @@
+diff --git a/tools/ideviceactivation.c b/tools/ideviceactivation.c
+index 757c54e..e75e9e9 100644
+--- a/tools/ideviceactivation.c
++++ b/tools/ideviceactivation.c
+@@ -28,7 +28,9 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#ifndef _MSC_VER
+ #include <unistd.h>
++#endif
+ #include <ctype.h>
+ #ifndef WIN32
+ #include <signal.h>
diff --git a/vcpkg/ports/libideviceactivation/CMakeLists.txt b/vcpkg/ports/libideviceactivation/CMakeLists.txt
new file mode 100644
index 0000000..833545e
--- /dev/null
+++ b/vcpkg/ports/libideviceactivation/CMakeLists.txt
@@ -0,0 +1,103 @@
+cmake_minimum_required(VERSION 3.15)
+project(libideviceactivation C)
+
+option(BUILD_TOOLS "Build tools." OFF)
+
+include(GNUInstallDirs)
+
+file(GLOB_RECURSE LIBIDEVICEACTIVATION_HEADER include/*.h)
+file(GLOB_RECURSE LIBIDEVICEACTIVATION_SOURCE src/*.c)
+
+set(DEFINITIONS)
+
+if(BUILD_SHARED_LIBS)
+ if(WIN32)
+ list(APPEND LIBIDEVICEACTIVATION_SOURCE exports.def)
+ endif()
+else()
+ list(APPEND DEFINITIONS -DLIBIDEVICEACTIVATION_STATIC)
+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 CONFIG REQUIRED)
+find_package(CURL CONFIG REQUIRED)
+find_package(LibXml2 CONFIG REQUIRED)
+
+add_library(libideviceactivation ${LIBIDEVICEACTIVATION_SOURCE})
+target_include_directories(libideviceactivation PUBLIC
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
+ "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
+)
+target_compile_definitions(libideviceactivation PRIVATE ${DEFINITIONS})
+target_link_libraries(libideviceactivation
+ PRIVATE
+ CURL::libcurl
+ LibXml2::LibXml2
+ PUBLIC
+ unofficial::libplist::libplist
+ unofficial::libimobiledevice::libimobiledevice
+)
+set_target_properties(libideviceactivation PROPERTIES OUTPUT_NAME ideviceactivation-1.0)
+
+install(TARGETS libideviceactivation EXPORT unofficial-libideviceactivation)
+
+install(
+ EXPORT unofficial-libideviceactivation
+ FILE unofficial-libideviceactivation-config.cmake
+ DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/unofficial-libideviceactivation"
+ NAMESPACE unofficial::libideviceactivation::
+)
+
+install(
+ FILES ${LIBIDEVICEACTIVATION_HEADER}
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
+)
+
+set(LIBPLIST_VERSION 2.0)
+set(LIBIMOBILEDEVICE_VERSION 1.0)
+set(LIBCURL_VERSION 7.0)
+set(LIBXML2_VERSION 2.0)
+set(PACKAGE_NAME libideviceactivation)
+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/libideviceactivation-1.0.pc.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/libideviceactivation-1.0.pc"
+ @ONLY
+)
+install(
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/libideviceactivation-1.0.pc"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
+)
+
+if(BUILD_TOOLS)
+ add_executable(ideviceactivation "tools/ideviceactivation.c")
+ target_compile_definitions(ideviceactivation PRIVATE
+ -DPACKAGE_VERSION="1.1.1"
+ -DPACKAGE_URL="https://github.com/libimobiledevice/libideviceactivation"
+ -DPACKAGE_BUGREPORT="https://github.com/libimobiledevice/libideviceactivation/issues"
+ )
+ if(WIN32)
+ target_compile_definitions(ideviceactivation PRIVATE
+ -D_CRT_SECURE_NO_WARNINGS
+ -DWIN32_LEAN_AND_MEAN
+ -DWIN32
+ )
+ endif()
+ target_link_libraries(ideviceactivation PRIVATE libideviceactivation)
+
+ install(
+ TARGETS ideviceactivation
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ )
+endif()
diff --git a/vcpkg/ports/libideviceactivation/exports.def b/vcpkg/ports/libideviceactivation/exports.def
new file mode 100644
index 0000000..346b0c8
--- /dev/null
+++ b/vcpkg/ports/libideviceactivation/exports.def
@@ -0,0 +1,31 @@
+EXPORTS
+ idevice_activation_set_debug_level
+ idevice_activation_request_new
+ idevice_activation_request_new_from_lockdownd
+ idevice_activation_drm_handshake_request_new
+ idevice_activation_request_free
+ idevice_activation_request_get_fields
+ idevice_activation_request_set_fields
+ idevice_activation_request_set_fields_from_response
+ idevice_activation_request_set_field
+ idevice_activation_request_get_field
+ idevice_activation_request_get_url
+ idevice_activation_request_set_url
+ idevice_activation_response_new
+ idevice_activation_response_new_from_html
+ idevice_activation_response_to_buffer
+ idevice_activation_response_free
+ idevice_activation_response_get_field
+ idevice_activation_response_get_fields
+ idevice_activation_response_get_label
+ idevice_activation_response_get_placeholder
+ idevice_activation_response_get_title
+ idevice_activation_response_get_description
+ idevice_activation_response_get_activation_record
+ idevice_activation_response_get_headers
+ idevice_activation_response_is_activation_acknowledged
+ idevice_activation_response_is_authentication_required
+ idevice_activation_response_field_requires_input
+ idevice_activation_response_field_secure_input
+ idevice_activation_response_has_errors
+ idevice_activation_send_request
diff --git a/vcpkg/ports/libideviceactivation/portfile.cmake b/vcpkg/ports/libideviceactivation/portfile.cmake
new file mode 100644
index 0000000..db91aba
--- /dev/null
+++ b/vcpkg/ports/libideviceactivation/portfile.cmake
@@ -0,0 +1,47 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO libimobiledevice/libideviceactivation
+ REF 067c439e0b18d6f1c8a37dde791f9d91191a922e # commits on 2023-05-01
+ SHA512 0afd74720abc6a1e47e035243879d291444b27667ce0a1908a4e66fea92185ff002e5390a1911ae95dc05d0bb0518a0043c77b531edcc5ac8b59c913aea9d487
+ HEAD_REF master
+ PATCHES
+ 001_fix_static_build.patch
+ 002_fix_api.patch
+ 003_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 ideviceactivation 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 CONFIG)
+find_dependency(CURL CONFIG)
+find_dependency(LibXml2 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/libideviceactivation/usage b/vcpkg/ports/libideviceactivation/usage
new file mode 100644
index 0000000..7ba822f
--- /dev/null
+++ b/vcpkg/ports/libideviceactivation/usage
@@ -0,0 +1,4 @@
+libideviceactivation provides CMake targets:
+
+ find_package(unofficial-libideviceactivation CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE unofficial::libideviceactivation::libideviceactivation)
diff --git a/vcpkg/ports/libideviceactivation/vcpkg.json b/vcpkg/ports/libideviceactivation/vcpkg.json
new file mode 100644
index 0000000..855b589
--- /dev/null
+++ b/vcpkg/ports/libideviceactivation/vcpkg.json
@@ -0,0 +1,29 @@
+{
+ "name": "libideviceactivation",
+ "version-date": "2023-05-01",
+ "port-version": 1,
+ "description": "A library to handle the activation process of iOS devices",
+ "homepage": "https://libimobiledevice.org/",
+ "license": "LGPL-2.1-or-later",
+ "supports": "!uwp",
+ "dependencies": [
+ "curl",
+ "libimobiledevice",
+ "libplist",
+ "libxml2",
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "features": {
+ "tools": {
+ "description": "build command line tool",
+ "supports": "!android & !ios & !xbox"
+ }
+ }
+}