libjpeg-turbo with bitcode
For a little side project I’m developing for iOS, I needed to build libjpeg-turbo.
Unfortunately the binary provided by the project maintainers doesn’t include bitcode and even if at the moment it’s not compulsory (unless you are targeting WatchOS), I like to be future proof, as Apple will eventually require it to be included in every app binary.
I’ve found a dedicated repository by David Hoerl with instructions to build libjpeg-turbo for iOS, but unfortunately it doesn’t include bitcode too.
In the issues on GitHub there’s a build script to build with bitcode enabled, but with the current SDK versions it fails.
This is an updated version with some optimizations:
- Developer tools and SDK paths are automatically detected, so it should be compatible even with future Xcode versions (tested with Xcode 7.2.1, 7.3.1 and 8.0 β4).
- Install required packages:
libtool,automake,autoconf,nasm. - Creates a Universal Binary library with simulator and device architectures.
Instructions:
- Install Xcode and command line tools.
- Install Homebrew on your Mac.
- Open terminal and
cdinto a temporary directory.
Download and run the script that your can find here with just a single line of code.
curl -s https://macteo.it/g/libturbo-jpeg.sh | bash
I’m not responsible if something goes wrong.
You’ll find the fat library with bitcode inside the ../libs/universal folder.
Architectures in the fat file: libturbojpeg.a are: armv7 armv7s i386 x86_64 arm64
🎉
The process seems to be confirmed.
I also sent a test build including bitcode to iTunes Connect, it has been processed successfully and it is now available (privately) on TestFlight.
