LZMA for iOS and Mac OS X (Intel & Apple Silicon M1) - arm64 / x86_64
Supported version: 5.4.5
This repo provides a universal script for building static liblzma library for use in iOS and macOS applications. The actual library version is taken from https://github.com/tukaani-project/xz with tag 'v5.4.5'
Rationale
Current MacOSX SDK contains liblzma.tbd and some set of headers related to the tukaani-project/xz product. But this set is not complete. Some headers are missed and corresponded functionality is also missed in the tbd (e.g. lzma_str_to_filters() function). But the saddest thing is that's impossible to embed this tbd into the IOS project for Apple Store distribution. Apple finds that all the definitions from the library as "the non-public symbols" and rejects a submission.
Prerequisites
- Xcode must be installed because xcodebuild is used to create xcframeworks
xcode-select -p
must point to Xcode app developer directory (by default e.g. /Applications/Xcode.app/Contents/Developer). If it points to CommandLineTools directory you should execute:sudo xcode-select --reset
orsudo xcode-select -s /Applications/Xcode.app/Contents/Developer
- CMake (at least version 3.13) must be installed (e.g. by brew install cmake)
How to build?
- Manually
# clone the repo
git clone -b 5.4.5 https://github.com/apotocki/lzma-iosx
# build libraries
cd lzma-iosx
scripts/build.sh
# have fun, the result artifacts will be located in 'frameworks' folder.
- Use cocoapods. Add the following lines into your project's Podfile:
use_frameworks!
pod 'lzma-iosx', '~> 5.4.5'
# or optionally more precisely
# pod 'lzma-iosx', :git => 'https://github.com/apotocki/lzma-iosx', :tag => '5.4.5.0'
install new dependency:
pod install --verbose
As an advertisement…
The LZMA XCFramework that has been built by this project is being used in my iOS application on the App Store:
PotoHEX HEX File Viewer & Editor | |
This application is designed to view and edit files at the byte or character level; calculate different hashes, encode/decode, and compress/decompress desired byte regions.
You can support my open-source development by trying the App.
Feedback is welcome!