Migrate to .xcframework (#2006)

* add libmd to linked libraries

* ios 16 fixes, new moneroc, simulator support

* update app version [skip ci]

* update monero.com as well [skip ci]

* migrate away from {Monero,Wownero,Zano}Wallet.framework
Generate .xcframework dynamically
Fix mweb requiring manual steps in xcode

* fix app_config.sh when .dylib are not yet present

* fix typo in model_generator.sh

---------

Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
This commit is contained in:
cyan 2025-02-17 14:53:10 +01:00 committed by GitHub
parent 537c59b684
commit 2078407608
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 184 additions and 67 deletions

View file

@ -10,8 +10,7 @@ if [ -z "$APP_IOS_TYPE" ]; then
echo "Please set APP_IOS_TYPE"
exit 1
fi
./gen_framework.sh
cd .. # go to scipts
cd ..
./gen_android_manifest.sh
cd .. # go to root
cp -rf ./ios/Runner/InfoBase.plist ./ios/Runner/Info.plist

View file

@ -13,13 +13,13 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN)
APP_IOS_TYPE=$1
MONERO_COM_NAME="Monero.com"
MONERO_COM_VERSION="1.20.0"
MONERO_COM_BUILD_NUMBER=110
MONERO_COM_VERSION="1.20.1"
MONERO_COM_BUILD_NUMBER=111
MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="4.23.0"
CAKEWALLET_BUILD_NUMBER=293
CAKEWALLET_VERSION="4.23.1"
CAKEWALLET_BUILD_NUMBER=295
CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
HAVEN_NAME="Haven"

View file

@ -18,11 +18,17 @@ cd "$(dirname "$0")"
for COIN in monero wownero zano;
do
pushd ../monero_c
rm -rf external/ios/build
./build_single.sh ${COIN} aarch64-apple-ios -j$MAKE_JOB_COUNT
./build_single.sh ${COIN} aarch64-apple-iossimulator -j$MAKE_JOB_COUNT
popd
done
unxz -f ../monero_c/release/monero/aarch64-apple-ios_libwallet2_api_c.dylib.xz
unxz -f ../monero_c/release/wownero/aarch64-apple-ios_libwallet2_api_c.dylib.xz
unxz -f ../monero_c/release/zano/aarch64-apple-ios_libwallet2_api_c.dylib.xz
unxz -fk ../monero_c/release/monero/aarch64-apple-ios_libwallet2_api_c.dylib.xz
unxz -fk ../monero_c/release/wownero/aarch64-apple-ios_libwallet2_api_c.dylib.xz
unxz -fk ../monero_c/release/zano/aarch64-apple-ios_libwallet2_api_c.dylib.xz
unxz -fk ../monero_c/release/monero/aarch64-apple-iossimulator_libwallet2_api_c.dylib.xz
unxz -fk ../monero_c/release/wownero/aarch64-apple-iossimulator_libwallet2_api_c.dylib.xz
unxz -fk ../monero_c/release/zano/aarch64-apple-iossimulator_libwallet2_api_c.dylib.xz
./gen_framework.sh

View file

@ -14,7 +14,7 @@ git clone https://github.com/ltcmweb/mwebd
cd mwebd
git reset --hard 555349415f76a42ec5c76152b64c4ab9aabc448f
gomobile bind -target=ios .
mv -fn ./Mwebd.xcframework ../../../ios/
mv -fn ./Mwebd.xcframework ../../../cw_mweb/ios/
# cleanup:
cd ..
rm -rf mwebd

View file

@ -1,47 +1,159 @@
#!/bin/sh
# Assume we are in scripts/ios
set -e
IOS_DIR="$(pwd)/../../ios"
DYLIB_NAME="monero_libwallet2_api_c.dylib"
DYLIB_LINK_PATH="${IOS_DIR}/${DYLIB_NAME}"
FRWK_DIR="${IOS_DIR}/MoneroWallet.framework"
DYLIB_PATH="$(pwd)/../../scripts/monero_c/release"
TMP_DIR="${IOS_DIR}/tmp"
if [ ! -f $DYLIB_LINK_PATH ]; then
echo "Dylib is not found by the link: ${DYLIB_LINK_PATH}"
exit 0
fi
rm -rf "${IOS_DIR:?}/MoneroWallet.xcframework" "${IOS_DIR:?}/WowneroWallet.xcframework" "${IOS_DIR:?}/ZanoWallet.xcframework"
rm -rf "${IOS_DIR:?}/MoneroWallet.framework" "${IOS_DIR:?}/WowneroWallet.framework" "${IOS_DIR:?}/ZanoWallet.framework"
rm -rf "$TMP_DIR"
mkdir -p "$TMP_DIR"
cd $FRWK_DIR # go to iOS framework dir
lipo -create $DYLIB_LINK_PATH -output MoneroWallet
write_info_plist() {
framework_bundle="$1"
framework_name="$2"
target="$3"
plist_path="${framework_bundle}/Info.plist"
echo "Generated ${FRWK_DIR}"
# also generate for wownero
IOS_DIR="$(pwd)/../../ios"
DYLIB_NAME="wownero_libwallet2_api_c.dylib"
DYLIB_LINK_PATH="${IOS_DIR}/${DYLIB_NAME}"
FRWK_DIR="${IOS_DIR}/WowneroWallet.framework"
if [[ "x$target" = "xiossimulator" ]]; then
platform="iPhoneSimulator"
dtplatformname="iphonesimulator"
dtsdkname="iphonesimulator17.4"
else
platform="iPhoneOS"
dtplatformname="iphoneos"
dtsdkname="iphoneos17.4"
fi
if [ ! -f $DYLIB_LINK_PATH ]; then
echo "Dylib is not found by the link: ${DYLIB_LINK_PATH}"
exit 0
fi
cat > "$plist_path" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>23E224</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${framework_name}</string>
<key>CFBundleIdentifier</key>
<string>com.fotolockr.${framework_name}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${framework_name}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>???</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>${platform}</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>21E210</string>
<key>DTPlatformName</key>
<string>${dtplatformname}</string>
<key>DTPlatformVersion</key>
<string>17.4</string>
<key>DTSDKBuild</key>
<string>21E210</string>
<key>DTSDKName</key>
<string>${dtsdkname}</string>
<key>DTXcode</key>
<string>1530</string>
<key>DTXcodeBuild</key>
<string>15E204a</string>
<key>MinimumOSVersion</key>
<string>16.0</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
</dict>
</plist>
EOF
plutil -convert binary1 "$plist_path"
}
cd $FRWK_DIR # go to iOS framework dir
lipo -create $DYLIB_LINK_PATH -output WowneroWallet
create_framework() {
wallet="$1"
framework_name="$2"
target="$3"
out_dir="$4"
echo "Generated ${FRWK_DIR}"
echo "Creating ${framework_name}.framework for target ${target} in ${out_dir}..."
# also generate for zano
IOS_DIR="$(pwd)/../../ios"
DYLIB_NAME="zano_libwallet2_api_c.dylib"
DYLIB_LINK_PATH="${IOS_DIR}/${DYLIB_NAME}"
FRWK_DIR="${IOS_DIR}/ZanoWallet.framework"
framework_bundle="${out_dir}/${framework_name}.framework"
rm -rf "$framework_bundle"
mkdir -p "$framework_bundle"
if [ ! -f $DYLIB_LINK_PATH ]; then
echo "Dylib is not found by the link: ${DYLIB_LINK_PATH}"
exit 0
fi
input_dylib="${DYLIB_PATH}/${wallet}/aarch64-apple-${target}_libwallet2_api_c.dylib"
if [[ ! -f "$input_dylib" ]]; then
echo "Error: Input dylib not found: $input_dylib"
exit 1
fi
cd $FRWK_DIR # go to iOS framework dir
lipo -create $DYLIB_LINK_PATH -output ZanoWallet
lipo -create "$input_dylib" -output "${framework_bundle}/${framework_name}"
echo "Created binary: ${framework_bundle}/${framework_name}"
echo "Generated ${FRWK_DIR}"
write_info_plist "$framework_bundle" "$framework_name" "$target"
}
create_xcframework() {
framework_name="$1"
device_framework="$2"
simulator_framework="$3"
xcframework_output="$4"
echo "Creating ${xcframework_output} by bundling:"
echo " Device framework: ${device_framework}"
echo " Simulator framework: ${simulator_framework}"
xcodebuild -create-xcframework \
-framework "$device_framework" \
-framework "$simulator_framework" \
-output "$xcframework_output"
echo "Created XCFramework: ${xcframework_output}"
}
wallets=("monero" "wownero" "zano")
framework_names=("MoneroWallet" "WowneroWallet" "ZanoWallet")
for i in "${!wallets[@]}"; do
wallet="${wallets[$i]}"
framework_name="${framework_names[$i]}"
device_out="${TMP_DIR}/${framework_name}_device"
simulator_out="${TMP_DIR}/${framework_name}_simulator"
rm -rf "$device_out" "$simulator_out"
mkdir -p "$device_out" "$simulator_out"
create_framework "$wallet" "$framework_name" "ios" "$device_out"
create_framework "$wallet" "$framework_name" "iossimulator" "$simulator_out"
device_framework="${device_out}/${framework_name}.framework"
simulator_framework="${simulator_out}/${framework_name}.framework"
xcframework_output="${IOS_DIR}/${framework_name}.xcframework"
rm -rf "$xcframework_output"
create_xcframework "$framework_name" "$device_framework" "$simulator_framework" "$xcframework_output"
done
echo "All XCFrameworks created successfully."
rm -rf "$TMP_DIR"