mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 06:26:15 +01:00
Replace libplist with plist_ffi crate
This commit is contained in:
638
Cargo.lock
generated
638
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -12,7 +12,7 @@ once_cell = "1.21.1"
|
||||
tokio = { version = "1.44.1", features = ["full"] }
|
||||
libc = "0.2.171"
|
||||
plist = "1.7.1"
|
||||
plist_plus = { version = "0.2.6", features = ["dynamic"] }
|
||||
plist_ffi = "0.1.3"
|
||||
|
||||
[features]
|
||||
afc = ["idevice/afc"]
|
||||
@@ -67,7 +67,7 @@ full = [
|
||||
default = ["full"]
|
||||
|
||||
[build-dependencies]
|
||||
cbindgen = "0.28.0"
|
||||
cbindgen = "0.29.0"
|
||||
|
||||
[lib]
|
||||
crate-type = ["staticlib"]
|
||||
|
||||
@@ -32,31 +32,6 @@ foreach(EXAMPLE_FILE ${EXAMPLE_SOURCES})
|
||||
target_link_libraries(${EXAMPLE_NAME} PRIVATE m)
|
||||
endif()
|
||||
|
||||
|
||||
# libplist
|
||||
|
||||
if( APPLE )
|
||||
# use static linking
|
||||
find_library( LIBPLIST libplist-2.0.a REQUIRED )
|
||||
message( STATUS "(Static linking) LIBPLIST " ${LIBPLIST} )
|
||||
target_link_libraries ( ${EXAMPLE_NAME} PRIVATE ${LIBPLIST} )
|
||||
elseif( WIN32)
|
||||
pkg_search_module(PLIST REQUIRED libplist-2.0)
|
||||
find_library( LIBPLIST ${PLIST_LIBRARIES} PATH ${PLIST_LIBDIR} )
|
||||
target_link_libraries ( ${EXAMPLE_NAME} PRIVATE ${LIBPLIST} )
|
||||
else ()
|
||||
pkg_search_module(PLIST libplist>=2.0)
|
||||
if(NOT PLIST_FOUND)
|
||||
pkg_search_module(PLIST REQUIRED libplist-2.0)
|
||||
endif()
|
||||
find_library( LIBPLIST ${PLIST_LIBRARIES} PATH ${PLIST_LIBDIR} )
|
||||
target_link_libraries ( ${EXAMPLE_NAME} PUBLIC ${LIBPLIST} )
|
||||
endif()
|
||||
if ( PLIST_FOUND )
|
||||
message( STATUS "found libplist-${PLIST_VERSION}" )
|
||||
endif()
|
||||
target_include_directories( ${EXAMPLE_NAME} PRIVATE ${PLIST_INCLUDE_DIRS} )
|
||||
|
||||
# Bulk-link common macOS system frameworks
|
||||
if(APPLE)
|
||||
target_link_libraries(${EXAMPLE_NAME} PRIVATE
|
||||
|
||||
@@ -46,7 +46,7 @@ pub unsafe extern "C" fn adapter_connect(
|
||||
null_mut()
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("Adapter connect failed: {}", e);
|
||||
log::error!("Adapter connect failed: {e}");
|
||||
ffi_err!(e)
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,7 @@ pub unsafe extern "C" fn adapter_pcap(
|
||||
match res {
|
||||
Ok(_) => null_mut(),
|
||||
Err(e) => {
|
||||
log::error!("Adapter pcap failed: {}", e);
|
||||
log::error!("Adapter pcap failed: {e}");
|
||||
ffi_err!(e)
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ pub unsafe extern "C" fn adapter_close(handle: *mut AdapterStreamHandle) -> *mut
|
||||
match res {
|
||||
Ok(_) => null_mut(),
|
||||
Err(e) => {
|
||||
log::error!("Adapter close failed: {}", e);
|
||||
log::error!("Adapter close failed: {e}");
|
||||
ffi_err!(e)
|
||||
}
|
||||
}
|
||||
@@ -150,7 +150,7 @@ pub unsafe extern "C" fn adapter_send(
|
||||
match res {
|
||||
Ok(_) => null_mut(),
|
||||
Err(e) => {
|
||||
log::error!("Adapter send failed: {}", e);
|
||||
log::error!("Adapter send failed: {e}");
|
||||
ffi_err!(e)
|
||||
}
|
||||
}
|
||||
@@ -200,7 +200,7 @@ pub unsafe extern "C" fn adapter_recv(
|
||||
null_mut()
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("Adapter recv failed: {}", e);
|
||||
log::error!("Adapter recv failed: {e}");
|
||||
ffi_err!(e)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,9 @@ use idevice::{
|
||||
IdeviceError, IdeviceService, installation_proxy::InstallationProxyClient,
|
||||
provider::IdeviceProvider,
|
||||
};
|
||||
use plist_ffi::{PlistWrapper, plist_t};
|
||||
|
||||
use crate::{
|
||||
IdeviceFfiError, IdeviceHandle, RUNTIME, ffi_err, provider::IdeviceProviderHandle, util,
|
||||
};
|
||||
use crate::{IdeviceFfiError, IdeviceHandle, RUNTIME, ffi_err, provider::IdeviceProviderHandle};
|
||||
|
||||
pub struct InstallationProxyClientHandle(pub InstallationProxyClient);
|
||||
|
||||
@@ -132,10 +131,10 @@ pub unsafe extern "C" fn installation_proxy_get_apps(
|
||||
)
|
||||
};
|
||||
|
||||
let res: Result<Vec<*mut c_void>, IdeviceError> = RUNTIME.block_on(async {
|
||||
let res: Result<Vec<plist_t>, IdeviceError> = RUNTIME.block_on(async {
|
||||
client.0.get_apps(app_type, bundle_ids).await.map(|apps| {
|
||||
apps.into_values()
|
||||
.map(|v| util::plist_to_libplist(&v))
|
||||
.map(|v| PlistWrapper::new_node(v).into_ptr())
|
||||
.collect()
|
||||
})
|
||||
});
|
||||
@@ -192,7 +191,7 @@ pub unsafe extern "C" fn installation_proxy_client_free(
|
||||
pub unsafe extern "C" fn installation_proxy_install(
|
||||
client: *mut InstallationProxyClientHandle,
|
||||
package_path: *const libc::c_char,
|
||||
options: *mut c_void,
|
||||
options: plist_t,
|
||||
) -> *mut IdeviceFfiError {
|
||||
if client.is_null() || package_path.is_null() {
|
||||
return ffi_err!(IdeviceError::FfiInvalidArg);
|
||||
@@ -204,8 +203,9 @@ pub unsafe extern "C" fn installation_proxy_install(
|
||||
let options = if options.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(util::libplist_to_plist(options))
|
||||
};
|
||||
Some(unsafe { &mut *options })
|
||||
}
|
||||
.map(|x| x.borrow_self().clone());
|
||||
|
||||
let res = RUNTIME.block_on(async {
|
||||
unsafe { &mut *client }
|
||||
@@ -240,7 +240,7 @@ pub unsafe extern "C" fn installation_proxy_install(
|
||||
pub unsafe extern "C" fn installation_proxy_install_with_callback(
|
||||
client: *mut InstallationProxyClientHandle,
|
||||
package_path: *const libc::c_char,
|
||||
options: *mut c_void,
|
||||
options: plist_t,
|
||||
callback: extern "C" fn(progress: u64, context: *mut c_void),
|
||||
context: *mut c_void,
|
||||
) -> *mut IdeviceFfiError {
|
||||
@@ -254,8 +254,9 @@ pub unsafe extern "C" fn installation_proxy_install_with_callback(
|
||||
let options = if options.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(util::libplist_to_plist(options))
|
||||
};
|
||||
Some(unsafe { &mut *options })
|
||||
}
|
||||
.map(|x| x.borrow_self().clone());
|
||||
|
||||
let res = RUNTIME.block_on(async {
|
||||
let callback_wrapper = |(progress, context)| async move {
|
||||
@@ -292,7 +293,7 @@ pub unsafe extern "C" fn installation_proxy_install_with_callback(
|
||||
pub unsafe extern "C" fn installation_proxy_upgrade(
|
||||
client: *mut InstallationProxyClientHandle,
|
||||
package_path: *const libc::c_char,
|
||||
options: *mut c_void,
|
||||
options: plist_t,
|
||||
) -> *mut IdeviceFfiError {
|
||||
if client.is_null() || package_path.is_null() {
|
||||
return ffi_err!(IdeviceError::FfiInvalidArg);
|
||||
@@ -304,8 +305,9 @@ pub unsafe extern "C" fn installation_proxy_upgrade(
|
||||
let options = if options.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(util::libplist_to_plist(options))
|
||||
};
|
||||
Some(unsafe { &mut *options })
|
||||
}
|
||||
.map(|x| x.borrow_self().clone());
|
||||
|
||||
let res = RUNTIME.block_on(async {
|
||||
unsafe { &mut *client }
|
||||
@@ -340,7 +342,7 @@ pub unsafe extern "C" fn installation_proxy_upgrade(
|
||||
pub unsafe extern "C" fn installation_proxy_upgrade_with_callback(
|
||||
client: *mut InstallationProxyClientHandle,
|
||||
package_path: *const libc::c_char,
|
||||
options: *mut c_void,
|
||||
options: plist_t,
|
||||
callback: extern "C" fn(progress: u64, context: *mut c_void),
|
||||
context: *mut c_void,
|
||||
) -> *mut IdeviceFfiError {
|
||||
@@ -354,8 +356,9 @@ pub unsafe extern "C" fn installation_proxy_upgrade_with_callback(
|
||||
let options = if options.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(util::libplist_to_plist(options))
|
||||
};
|
||||
Some(unsafe { &mut *options })
|
||||
}
|
||||
.map(|x| x.borrow_self().clone());
|
||||
|
||||
let res = RUNTIME.block_on(async {
|
||||
let callback_wrapper = |(progress, context)| async move {
|
||||
@@ -392,7 +395,7 @@ pub unsafe extern "C" fn installation_proxy_upgrade_with_callback(
|
||||
pub unsafe extern "C" fn installation_proxy_uninstall(
|
||||
client: *mut InstallationProxyClientHandle,
|
||||
bundle_id: *const libc::c_char,
|
||||
options: *mut c_void,
|
||||
options: plist_t,
|
||||
) -> *mut IdeviceFfiError {
|
||||
if client.is_null() || bundle_id.is_null() {
|
||||
return ffi_err!(IdeviceError::FfiInvalidArg);
|
||||
@@ -404,8 +407,9 @@ pub unsafe extern "C" fn installation_proxy_uninstall(
|
||||
let options = if options.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(util::libplist_to_plist(options))
|
||||
};
|
||||
Some(unsafe { &mut *options })
|
||||
}
|
||||
.map(|x| x.borrow_self().clone());
|
||||
|
||||
let res = RUNTIME.block_on(async {
|
||||
unsafe { &mut *client }
|
||||
@@ -440,7 +444,7 @@ pub unsafe extern "C" fn installation_proxy_uninstall(
|
||||
pub unsafe extern "C" fn installation_proxy_uninstall_with_callback(
|
||||
client: *mut InstallationProxyClientHandle,
|
||||
bundle_id: *const libc::c_char,
|
||||
options: *mut c_void,
|
||||
options: plist_t,
|
||||
callback: extern "C" fn(progress: u64, context: *mut c_void),
|
||||
context: *mut c_void,
|
||||
) -> *mut IdeviceFfiError {
|
||||
@@ -454,8 +458,9 @@ pub unsafe extern "C" fn installation_proxy_uninstall_with_callback(
|
||||
let options = if options.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(util::libplist_to_plist(options))
|
||||
};
|
||||
Some(unsafe { &mut *options })
|
||||
}
|
||||
.map(|x| x.borrow_self().clone());
|
||||
|
||||
let res = RUNTIME.block_on(async {
|
||||
let callback_wrapper = |(progress, context)| async move {
|
||||
@@ -494,9 +499,9 @@ pub unsafe extern "C" fn installation_proxy_uninstall_with_callback(
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn installation_proxy_check_capabilities_match(
|
||||
client: *mut InstallationProxyClientHandle,
|
||||
capabilities: *const *mut c_void,
|
||||
capabilities: *const plist_t,
|
||||
capabilities_len: libc::size_t,
|
||||
options: *mut c_void,
|
||||
options: plist_t,
|
||||
out_result: *mut bool,
|
||||
) -> *mut IdeviceFfiError {
|
||||
if client.is_null() || out_result.is_null() {
|
||||
@@ -508,15 +513,16 @@ pub unsafe extern "C" fn installation_proxy_check_capabilities_match(
|
||||
} else {
|
||||
unsafe { std::slice::from_raw_parts(capabilities, capabilities_len) }
|
||||
.iter()
|
||||
.map(|&ptr| util::libplist_to_plist(ptr))
|
||||
.map(|ptr| unsafe { &mut **ptr }.borrow_self().clone())
|
||||
.collect()
|
||||
};
|
||||
|
||||
let options = if options.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(util::libplist_to_plist(options))
|
||||
};
|
||||
Some(unsafe { &mut *options })
|
||||
}
|
||||
.map(|x| x.borrow_self().clone());
|
||||
|
||||
let res = RUNTIME.block_on(async {
|
||||
unsafe { &mut *client }
|
||||
@@ -553,8 +559,8 @@ pub unsafe extern "C" fn installation_proxy_check_capabilities_match(
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn installation_proxy_browse(
|
||||
client: *mut InstallationProxyClientHandle,
|
||||
options: *mut c_void,
|
||||
out_result: *mut *mut c_void,
|
||||
options: plist_t,
|
||||
out_result: *mut *mut plist_t,
|
||||
out_result_len: *mut libc::size_t,
|
||||
) -> *mut IdeviceFfiError {
|
||||
if client.is_null() || out_result.is_null() || out_result_len.is_null() {
|
||||
@@ -564,25 +570,27 @@ pub unsafe extern "C" fn installation_proxy_browse(
|
||||
let options = if options.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(util::libplist_to_plist(options))
|
||||
};
|
||||
Some(unsafe { &mut *options })
|
||||
}
|
||||
.map(|x| x.borrow_self().clone());
|
||||
|
||||
let res: Result<Vec<*mut c_void>, IdeviceError> = RUNTIME.block_on(async {
|
||||
let res: Result<Vec<plist_t>, IdeviceError> = RUNTIME.block_on(async {
|
||||
unsafe { &mut *client }.0.browse(options).await.map(|apps| {
|
||||
apps.into_iter()
|
||||
.map(|v| util::plist_to_libplist(&v))
|
||||
.map(|v| PlistWrapper::new_node(v).into_ptr())
|
||||
.collect()
|
||||
})
|
||||
});
|
||||
|
||||
match res {
|
||||
Ok(mut r) => {
|
||||
Ok(r) => {
|
||||
let mut r = r.into_boxed_slice();
|
||||
let ptr = r.as_mut_ptr();
|
||||
let len = r.len();
|
||||
std::mem::forget(r);
|
||||
|
||||
unsafe {
|
||||
*out_result = ptr as *mut c_void;
|
||||
*out_result = ptr;
|
||||
*out_result_len = len;
|
||||
}
|
||||
null_mut()
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
// Jackson Coxson
|
||||
|
||||
use std::{ffi::c_void, ptr::null_mut};
|
||||
use std::ptr::null_mut;
|
||||
|
||||
use idevice::{IdeviceError, IdeviceService, lockdown::LockdownClient, provider::IdeviceProvider};
|
||||
use plist_ffi::{PlistWrapper, plist_t};
|
||||
|
||||
use crate::{
|
||||
IdeviceFfiError, IdeviceHandle, IdevicePairingFile, RUNTIME, ffi_err,
|
||||
@@ -176,7 +177,7 @@ pub unsafe extern "C" fn lockdownd_get_value(
|
||||
client: *mut LockdowndClientHandle,
|
||||
key: *const libc::c_char,
|
||||
domain: *const libc::c_char,
|
||||
out_plist: *mut *mut c_void,
|
||||
out_plist: *mut plist_t,
|
||||
) -> *mut IdeviceFfiError {
|
||||
if key.is_null() || out_plist.is_null() {
|
||||
return ffi_err!(IdeviceError::FfiInvalidArg);
|
||||
@@ -204,7 +205,7 @@ pub unsafe extern "C" fn lockdownd_get_value(
|
||||
match res {
|
||||
Ok(value) => {
|
||||
unsafe {
|
||||
*out_plist = crate::util::plist_to_libplist(&value);
|
||||
*out_plist = plist_ffi::PlistWrapper::new_node(value).into_ptr();
|
||||
}
|
||||
null_mut()
|
||||
}
|
||||
@@ -228,7 +229,7 @@ pub unsafe extern "C" fn lockdownd_get_value(
|
||||
pub unsafe extern "C" fn lockdownd_get_all_values(
|
||||
client: *mut LockdowndClientHandle,
|
||||
domain: *const libc::c_char,
|
||||
out_plist: *mut *mut c_void,
|
||||
out_plist: *mut plist_t,
|
||||
) -> *mut IdeviceFfiError {
|
||||
if out_plist.is_null() {
|
||||
return ffi_err!(IdeviceError::FfiInvalidArg);
|
||||
@@ -252,7 +253,7 @@ pub unsafe extern "C" fn lockdownd_get_all_values(
|
||||
match res {
|
||||
Ok(dict) => {
|
||||
unsafe {
|
||||
*out_plist = crate::util::plist_to_libplist(&plist::Value::Dictionary(dict));
|
||||
*out_plist = PlistWrapper::new_node(plist::Value::Dictionary(dict)).into_ptr();
|
||||
}
|
||||
null_mut()
|
||||
}
|
||||
|
||||
@@ -6,10 +6,9 @@ use idevice::{
|
||||
IdeviceError, IdeviceService, mobile_image_mounter::ImageMounter, provider::IdeviceProvider,
|
||||
};
|
||||
use plist::Value;
|
||||
use plist_ffi::{PlistWrapper, plist_t};
|
||||
|
||||
use crate::{
|
||||
IdeviceFfiError, IdeviceHandle, RUNTIME, ffi_err, provider::IdeviceProviderHandle, util,
|
||||
};
|
||||
use crate::{IdeviceFfiError, IdeviceHandle, RUNTIME, ffi_err, provider::IdeviceProviderHandle};
|
||||
|
||||
pub struct ImageMounterHandle(pub ImageMounter);
|
||||
|
||||
@@ -112,7 +111,7 @@ pub unsafe extern "C" fn image_mounter_free(handle: *mut ImageMounterHandle) {
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn image_mounter_copy_devices(
|
||||
client: *mut ImageMounterHandle,
|
||||
devices: *mut *mut c_void,
|
||||
devices: *mut *mut plist_t,
|
||||
devices_len: *mut libc::size_t,
|
||||
) -> *mut IdeviceFfiError {
|
||||
let res: Result<Vec<Value>, IdeviceError> = RUNTIME.block_on(async move {
|
||||
@@ -124,14 +123,14 @@ pub unsafe extern "C" fn image_mounter_copy_devices(
|
||||
Ok(devices_list) => {
|
||||
let devices_list = devices_list
|
||||
.into_iter()
|
||||
.map(|x| util::plist_to_libplist(&x))
|
||||
.collect::<Vec<*mut std::ffi::c_void>>();
|
||||
.map(|x| plist_ffi::PlistWrapper::new_node(x).into_ptr())
|
||||
.collect::<Vec<plist_t>>();
|
||||
let len = devices_list.len();
|
||||
let boxed_slice = devices_list.into_boxed_slice();
|
||||
let ptr = Box::leak(boxed_slice).as_mut_ptr();
|
||||
|
||||
unsafe {
|
||||
*devices = ptr as *mut c_void;
|
||||
*devices = ptr as *mut plist_t;
|
||||
*devices_len = len;
|
||||
}
|
||||
null_mut()
|
||||
@@ -558,7 +557,7 @@ pub unsafe extern "C" fn image_mounter_query_nonce(
|
||||
pub unsafe extern "C" fn image_mounter_query_personalization_identifiers(
|
||||
client: *mut ImageMounterHandle,
|
||||
image_type: *const libc::c_char,
|
||||
identifiers: *mut *mut c_void,
|
||||
identifiers: *mut plist_t,
|
||||
) -> *mut IdeviceFfiError {
|
||||
if identifiers.is_null() {
|
||||
return ffi_err!(IdeviceError::FfiInvalidArg);
|
||||
@@ -583,7 +582,7 @@ pub unsafe extern "C" fn image_mounter_query_personalization_identifiers(
|
||||
|
||||
match res {
|
||||
Ok(id) => {
|
||||
let plist = util::plist_to_libplist(&plist::Value::Dictionary(id));
|
||||
let plist = PlistWrapper::new_node(Value::Dictionary(id)).into_ptr();
|
||||
unsafe { *identifiers = plist };
|
||||
null_mut()
|
||||
}
|
||||
|
||||
@@ -3,12 +3,10 @@
|
||||
use std::{
|
||||
ffi::c_int,
|
||||
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr},
|
||||
os::raw::c_void,
|
||||
};
|
||||
|
||||
use idevice::IdeviceError;
|
||||
use libc::{sockaddr_in, sockaddr_in6};
|
||||
use plist::Value;
|
||||
|
||||
pub(crate) fn c_socket_to_rust(
|
||||
addr: *const libc::sockaddr,
|
||||
@@ -76,23 +74,3 @@ pub(crate) fn c_addr_to_rust(addr: *const libc::sockaddr) -> Result<IpAddr, Idev
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn plist_to_libplist(v: &Value) -> *mut libc::c_void {
|
||||
let buf = Vec::new();
|
||||
let mut writer = std::io::BufWriter::new(buf);
|
||||
plist::to_writer_xml(&mut writer, v).unwrap();
|
||||
let buf = String::from_utf8(writer.into_inner().unwrap()).unwrap();
|
||||
let p = plist_plus::Plist::from_xml(buf).unwrap();
|
||||
let ptr = p.get_pointer();
|
||||
p.false_drop();
|
||||
ptr
|
||||
}
|
||||
|
||||
pub(crate) fn libplist_to_plist(v: *mut c_void) -> Value {
|
||||
let v: plist_plus::Plist = v.into();
|
||||
let v_string = v.to_string();
|
||||
v.false_drop();
|
||||
|
||||
let reader = std::io::Cursor::new(v_string.as_bytes());
|
||||
plist::from_reader(reader).unwrap()
|
||||
}
|
||||
|
||||
147
justfile
147
justfile
@@ -66,150 +66,3 @@ apple-build: # requires a Mac
|
||||
cargo build --release --target aarch64-apple-darwin
|
||||
cargo build --release --target x86_64-apple-darwin
|
||||
|
||||
lib_name := "plist"
|
||||
src_dir := "ffi/libplist"
|
||||
|
||||
ios_out := "build/ios"
|
||||
sim_out := "build/sim"
|
||||
x86_64_sim_out := "build/x86_64_sim"
|
||||
mac_out := "build/mac"
|
||||
x86_64_mac_out := "build/x86_64_mac"
|
||||
|
||||
plist_xcframework: plist_clean build_plist_ios build_plist_sim build_plist_x86_64_sim build_plist_mac build_plist_x86_64_mac plist_merge_archs
|
||||
rm -rf {{lib_name}}.xcframework
|
||||
xcodebuild -create-xcframework \
|
||||
-framework {{ios_out}}/plist.framework \
|
||||
-framework build/universal-sim/plist.framework \
|
||||
-framework build/universal-mac/plist.framework \
|
||||
-output swift/{{lib_name}}.xcframework
|
||||
|
||||
plist_clean:
|
||||
rm -rf build
|
||||
rm -rf swift/plist.xcframework
|
||||
|
||||
plist_merge_archs:
|
||||
# Merge simulator dylibs (arm64 + x86_64)
|
||||
mkdir -p build/universal-sim
|
||||
lipo -create \
|
||||
{{sim_out}}/lib/libplist-2.0.4.dylib \
|
||||
{{x86_64_sim_out}}/lib/libplist-2.0.4.dylib \
|
||||
-output build/universal-sim/libplist-2.0.4.dylib
|
||||
|
||||
mkdir -p build/universal-sim/plist.framework/Headers
|
||||
mkdir -p build/universal-sim/plist.framework/Modules
|
||||
cp build/universal-sim/libplist-2.0.4.dylib build/universal-sim/plist.framework/plist
|
||||
cp {{sim_out}}/include/plist/*.h build/universal-sim/plist.framework/Headers
|
||||
cp swift/Info.plist build/universal-sim/plist.framework/Info.plist
|
||||
cp swift/plistinclude/module.modulemap build/universal-sim/plist.framework/Modules/module.modulemap
|
||||
|
||||
# Merge macOS dylibs (arm64 + x86_64)
|
||||
mkdir -p build/universal-mac
|
||||
lipo -create \
|
||||
{{mac_out}}/lib/libplist-2.0.4.dylib \
|
||||
{{x86_64_mac_out}}/lib/libplist-2.0.4.dylib \
|
||||
-output build/universal-mac/libplist-2.0.4.dylib
|
||||
|
||||
mkdir -p build/universal-mac/plist.framework/Headers
|
||||
mkdir -p build/universal-mac/plist.framework/Modules
|
||||
cp build/universal-mac/libplist-2.0.4.dylib build/universal-mac/plist.framework/plist
|
||||
cp {{mac_out}}/include/plist/*.h build/universal-mac/plist.framework/Headers
|
||||
cp swift/Info.plist build/universal-mac/plist.framework/Info.plist
|
||||
cp swift/plistinclude/module.modulemap build/universal-mac/plist.framework/Modules/module.modulemap
|
||||
|
||||
build_plist_ios:
|
||||
rm -rf {{ios_out}} build/build-ios
|
||||
rm -rf build/ios
|
||||
mkdir -p {{ios_out}}
|
||||
mkdir -p build/build-ios && cd build/build-ios && \
|
||||
../../ffi/libplist/autogen.sh \
|
||||
--host=arm-apple-darwin \
|
||||
--prefix="$(pwd)/../../{{ios_out}}" \
|
||||
--without-cython \
|
||||
--without-tools \
|
||||
CC="$(xcrun --sdk iphoneos --find clang)" \
|
||||
CFLAGS="-arch arm64 -isysroot $(xcrun --sdk iphoneos --show-sdk-path) -mios-version-min=12.0" \
|
||||
CXX="$(xcrun --sdk iphoneos --find clang++)" \
|
||||
CXXFLAGS="-arch arm64 -isysroot $(xcrun --sdk iphoneos --show-sdk-path) -mios-version-min=12.0" \
|
||||
LDFLAGS="-arch arm64 -isysroot $(xcrun --sdk iphoneos --show-sdk-path) -mios-version-min=12.0" && \
|
||||
make clean && make -j$(sysctl -n hw.ncpu) && make install
|
||||
|
||||
install_name_tool -id @rpath/plist.framework/plist {{ios_out}}/lib/libplist-2.0.4.dylib
|
||||
|
||||
mkdir -p {{ios_out}}/plist.framework/Headers
|
||||
mkdir -p {{ios_out}}/plist.framework/Modules
|
||||
cp {{ios_out}}/lib/libplist-2.0.4.dylib {{ios_out}}/plist.framework/plist
|
||||
cp {{ios_out}}/include/plist/*.h {{ios_out}}/plist.framework/Headers
|
||||
cp swift/Info.plist {{ios_out}}/plist.framework/Info.plist
|
||||
cp swift/plistinclude/module.modulemap {{ios_out}}/plist.framework/Modules/module.modulemap
|
||||
|
||||
build_plist_sim:
|
||||
rm -rf {{sim_out}} build/build-sim
|
||||
mkdir -p {{sim_out}}
|
||||
mkdir -p build/build-sim && cd build/build-sim && \
|
||||
../../ffi/libplist/autogen.sh \
|
||||
--host=arm-apple-darwin \
|
||||
--prefix="$(pwd)/../../{{sim_out}}" \
|
||||
--without-cython \
|
||||
--without-tools \
|
||||
CC="$(xcrun --sdk iphonesimulator --find clang)" \
|
||||
CFLAGS="-arch arm64 -isysroot $(xcrun --sdk iphonesimulator --show-sdk-path) -mios-simulator-version-min=12.0" \
|
||||
CXX="$(xcrun --sdk iphonesimulator --find clang++)" \
|
||||
CXXFLAGS="-arch arm64 -isysroot $(xcrun --sdk iphonesimulator --show-sdk-path) -mios-simulator-version-min=12.0" \
|
||||
LDFLAGS="-arch arm64 -isysroot $(xcrun --sdk iphonesimulator --show-sdk-path) -mios-simulator-version-min=12.0" && \
|
||||
make clean && make -j$(sysctl -n hw.ncpu) && make install
|
||||
|
||||
install_name_tool -id @rpath/plist.framework/plist {{sim_out}}/lib/libplist-2.0.4.dylib
|
||||
|
||||
build_plist_x86_64_sim:
|
||||
rm -rf {{x86_64_sim_out}} build/build-sim
|
||||
mkdir -p {{x86_64_sim_out}}
|
||||
mkdir -p build/build-sim && cd build/build-sim && \
|
||||
../../ffi/libplist/autogen.sh \
|
||||
--host=x86_64-apple-darwin \
|
||||
--prefix="$(pwd)/../../{{x86_64_sim_out}}" \
|
||||
--without-cython \
|
||||
--without-tools \
|
||||
CC="$(xcrun --sdk iphonesimulator --find clang)" \
|
||||
CFLAGS="-arch x86_64 -isysroot $(xcrun --sdk iphonesimulator --show-sdk-path) -mios-simulator-version-min=12.0" \
|
||||
CXX="$(xcrun --sdk iphonesimulator --find clang++)" \
|
||||
CXXFLAGS="-arch x86_64 -isysroot $(xcrun --sdk iphonesimulator --show-sdk-path) -mios-simulator-version-min=12.0" \
|
||||
LDFLAGS="-arch x86_64 -isysroot $(xcrun --sdk iphonesimulator --show-sdk-path) -mios-simulator-version-min=12.0" && \
|
||||
make clean && make -j$(sysctl -n hw.ncpu) && make install
|
||||
|
||||
install_name_tool -id @rpath/plist.framework/plist {{x86_64_sim_out}}/lib/libplist-2.0.4.dylib
|
||||
|
||||
build_plist_mac:
|
||||
rm -rf {{mac_out}} build/build-mac
|
||||
mkdir -p {{mac_out}}
|
||||
mkdir -p build/build-mac && cd build/build-mac && \
|
||||
../../ffi/libplist/autogen.sh \
|
||||
--host=aarch64-apple-darwin \
|
||||
--prefix="$(pwd)/../../{{mac_out}}" \
|
||||
--without-cython \
|
||||
--without-tools \
|
||||
CC="$(xcrun --sdk macosx --find clang)" \
|
||||
CFLAGS="-arch arm64 -isysroot $(xcrun --sdk macosx --show-sdk-path) -mmacosx-version-min=11.0" \
|
||||
CXX="$(xcrun --sdk macosx --find clang++)" \
|
||||
CXXFLAGS="-arch arm64 -isysroot $(xcrun --sdk macosx --show-sdk-path) -mmacosx-version-min=11.0" \
|
||||
LDFLAGS="-arch arm64 -isysroot $(xcrun --sdk macosx --show-sdk-path) -mmacosx-version-min=11.0" && \
|
||||
make clean && make -j$(sysctl -n hw.ncpu) && make install
|
||||
|
||||
install_name_tool -id @rpath/plist.framework/plist {{mac_out}}/lib/libplist-2.0.4.dylib
|
||||
|
||||
build_plist_x86_64_mac:
|
||||
rm -rf {{x86_64_mac_out}} build/build-mac
|
||||
mkdir -p {{x86_64_mac_out}}
|
||||
mkdir -p build/build-mac && cd build/build-mac && \
|
||||
../../ffi/libplist/autogen.sh \
|
||||
--host=x86_64-apple-darwin \
|
||||
--prefix="$(pwd)/../../{{x86_64_mac_out}}" \
|
||||
--without-cython \
|
||||
--without-tools \
|
||||
CC="$(xcrun --sdk macosx --find clang)" \
|
||||
CFLAGS="-arch x86_64 -isysroot $(xcrun --sdk macosx --show-sdk-path) -mmacosx-version-min=11.0" \
|
||||
CXX="$(xcrun --sdk macosx --find clang++)" \
|
||||
CXXFLAGS="-arch x86_64 -isysroot $(xcrun --sdk macosx --show-sdk-path) -mmacosx-version-min=11.0" \
|
||||
LDFLAGS="-arch x86_64 -isysroot $(xcrun --sdk macosx --show-sdk-path) -mmacosx-version-min=11.0" && \
|
||||
make clean && make -j$(sysctl -n hw.ncpu) && make install
|
||||
|
||||
install_name_tool -id @rpath/plist.framework/plist {{x86_64_mac_out}}/lib/libplist-2.0.4.dylib
|
||||
|
||||
Reference in New Issue
Block a user