It's easy:
- Grab
iOS-autotools
by @szanni from https://github.com/szanni/ios-autotools - Grab
libarchive 3
from http://www.libarchive.org/ cd
into thelibarchive
code directoryexport ARCHS="armv7 armv7s arm64"
(or suitable for your needs and your shell of choice)- Run
autoframework ArchiveLib libarchive.a
and wait for everything to build!
From there, you'll end up with both Frameworks (in the aptly named Frameworks/
directory) and per-architecture static libraries (you guessed it: Static/
).
These days (the modern iOS 8 and iOS 9 era), I recommend using the Frameworks.
-
Depending on what you want out of
libarchive
you'll probably want to also buildlibbz2
using the same strategy. (http://www.bzip.org/) -
Apple scans all binaries for use of private APIs. As it happens, both
libarchive
andlibbz2
are in the iOS SDK, but they are private. These days, Apple's tools seem hip to the idea that names in different frameworks can overlap sanely. Nevertheless, caveat emptor. You might run into issues during the app review process. If so, I'd recommend simply prefixing everything in the sources with a private prefix will do the trick. Annoying, but nothing a little extra automation scripting can't handle. -
Bitcode. Not sure what the story is here, yet.
-
Somebody could definitely package up this process and turn it into a cocoapod so that most developers don't have to take on the pain. Back in the iOS 4 and 5 era, I used to provide a repo on github that did something similar. I guess I just don't have the motivation to do this myself — it really isn't that much pain — but if you do, please let me know about it!
Last updated October 14, 2015.