Last active
February 22, 2016 14:35
-
-
Save mmick66/798726f87c21649d9daf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm -rf install_* | |
rm -rf output-* | |
${LIB_VERSION:=1.2.8} | |
${TARBALLDIR:=`pwd`} | |
${SRCDIR:=`pwd`} | |
LIB_TARBALL=$TARBALLDIR/zlib-$LIB_VERSION.tar.gz | |
LIB_SRC=$SRCDIR/zlib-${LIB_VERSION} | |
if [ ! -s $LIB_TARBALL ]; then | |
echo "Downloading zlib ${LIB_VERSION}" | |
curl -L -o $LIB_TARBALL http://sourceforge.net/projects/libpng/files/zlib/${LIB_VERSION}/zlib-${LIB_VERSION}.tar.gz | |
fi | |
[ -f "$LIB_TARBALL" ] || abort "Source tarball missing." | |
echo Unpacking zlib into $SRCDIR... | |
[ -d $SRCDIR ] || mkdir -p $SRCDIR | |
[ -d $LIB_SRC ] || ( cd $SRCDIR; tar xfj $LIB_TARBALL ) | |
[ -d $LIB_SRC ] && echo " ...unpacked as $LIB_SRC" | |
cd $LIB_SRC | |
# build simulator | |
export CFLAGS="-Ofast -mios-version-min=5.0 -fembed-bitcode" | |
export LDFLAGS="-flto" | |
export CC="xcrun -sdk iphonesimulator clang -arch i386" | |
./configure --prefix=`pwd`/install_i386 | |
make clean && make -j8 && make install | |
export CFLAGS="-Ofast -mios-version-min=5.0" | |
export LDFLAGS="-flto" | |
export CC="xcrun -sdk iphonesimulator clang -arch x86_64" | |
./configure --prefix=`pwd`/install_x86_64 | |
make clean && make -j8 && make install | |
# build armv7 | |
export CFLAGS="-Ofast -mios-version-min=5.0" | |
export LDFLAGS="-flto" | |
export CC="xcrun -sdk iphoneos clang -arch armv7" | |
./configure --prefix=`pwd`/install_armv7 | |
make clean && make -j8 && make install | |
# build armv7s | |
export CFLAGS="-Ofast -mios-version-min=5.0" | |
export LDFLAGS="-flto" | |
export CC="xcrun -sdk iphoneos clang -arch armv7s" | |
./configure --prefix=`pwd`/install_armv7s | |
make clean && make -j8 && make install | |
# build armv7s | |
export CFLAGS="-Ofast -mios-version-min=5.0" | |
export LDFLAGS="-flto" | |
export CC="xcrun -sdk iphoneos clang -arch arm64" | |
./configure --prefix=`pwd`/install_arm64 | |
make clean && make -j8 && make install | |
# build universal | |
mkdir -p output-ios | |
xcrun lipo -create $(find install_*/lib -name "libz.a") -o output-ios/libz.a | |
cp -r install_armv7/include output-ios/. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment