HiroyasuNishiyama / kiwix-apple

Kiwix for offline access on iOS and macOS

Home Page:https://apple.kiwix.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kiwix for iOS & macOS

This is the home for Kiwix apps on iOS and macOS.

CodeFactor License: GPL v3 Drawing=

Mobile app for iPads & iPhones

  • Download the iOS mobile app on the App Store

Kiwix Desktop for macOS

Developers

Dependencies

  • An Apple Developer account (doesn't require membership)
  • Latest Apple Developers Tools (Xcode)
  • Its command-line utilities (xcode-select --install)
  • CoreKiwix.xcframework (libkiwix)

Creating CoreKiwix.xcframework

Instructions to build libkiwix at on the kiwix-build repo.

The xcframework is a bundle of a library for multiple architectures and/or platforms. The CoreKiwix.xcframework will contain libkiwix library for macOS archs and for iOS. You don't have to follow steps for other platform/arch if you don't need them.

Following steps are done from kiwix-build root and assume your apple repository is at ../apple.

Build libkiwix

Make sure to preinstall kiwix-build prerequisites (ninja and meson).

If you use homebrew, run the following

brew install ninja meson

Make sure xcode command tools are installed. Make sure to download an iOS SDK if you want to build for iOS.

xcode-select --install

Then you can build libkiwix

git clone https://github.com/kiwix/kiwix-build.git
cd kiwix-build
# [iOS] build libkiwix
kiwix-build --target-platform iOS_arm64 libkiwix
kiwix-build --target-platform iOS_x86_64 libkiwix  # iOS simulator in Xcode
# [macOS] build libkiwix
kiwix-build --target-platform macOS_x86_64 libkiwix
kiwix-build --target-platform macOS_arm64_static libkiwix

Create fat archive with all dependencies

This creates a single .a archive named merged.a (for each platform) which contains libkiwix and all it's dependencies. Skip those you don't want to support.

libtool -static -o BUILD_macOS_x86_64/INSTALL/lib/merged.a BUILD_macOS_x86_64/INSTALL/lib/*.a
libtool -static -o BUILD_macOS_arm64_static/INSTALL/lib/merged.a BUILD_macOS_arm64_static/INSTALL/lib/*.a
libtool -static -o BUILD_iOS_x86_64/INSTALL/lib/merged.a BUILD_iOS_x86_64/INSTALL/lib/*.a
libtool -static -o BUILD_iOS_arm64/INSTALL/lib/merged.a BUILD_iOS_arm64/INSTALL/lib/*.a

If you built macOS support for both archs (that's what you want unless you know what you're doing), you need to merge both files into a single one

mkdir -p macOS_fat
lipo -create -output macOS_fat/merged.a \
	-arch x86_64 BUILD_macOS_x86_64/INSTALL/lib/merged.a \
	-arch arm64 BUILD_macOS_arm64_static/INSTALL/lib/merged.a

Add fat archive to xcframework

xcodebuild -create-xcframework \
	-library macOS_fat/merged.a -headers BUILD_macOS_x86_64/INSTALL/include \
	-library BUILD_iOS_x86_64/INSTALL/lib/merged.a -headers BUILD_iOS_x86_64/INSTALL/include \
	-library BUILD_iOS_arm64/INSTALL/lib/merged.a -headers BUILD_iOS_arm64/INSTALL/include \
	-output ../apple/CoreKiwix.xcframework

You can now launch the build from Xcode and use the iOS simulator or your macOS target. At this point the xcframework is not signed.

Building Kiwix iOS or Kiwix macOS

  • Open project with Xcode open Kiwix.xcodeproj/project.xcworkspace/
  • Change the Bundle Identifier (in Signing & Capabilities)
  • Select appropriate Signing Certificate/Profile.

About

Kiwix for offline access on iOS and macOS

https://apple.kiwix.org

License:GNU Lesser General Public License v3.0


Languages

Language:Swift 90.9%Language:Objective-C++ 6.1%Language:Objective-C 2.2%Language:JavaScript 0.6%Language:CSS 0.2%