-
-
Save ayansg/fb987d69df95681ec752784dc6ea7621 to your computer and use it in GitHub Desktop.
build libpng for iOS/MacOS X
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
| # =========================================================================================================== | |
| # Enable bitcode for iOS. Updated iOS support to the minimum of iOS 10.3 | |
| # Added architecture specific --host flag to mark target platform for output library during cross compilation | |
| # =========================================================================================================== | |
| rm -rf install_* | |
| rm -rf output-* | |
| #build x86_64 | |
| ARCH="x86_64" | |
| ./configure --prefix=`pwd`/install_x86_64 CFLAGS="-Ofast -fembed-bitcode=marker -mios-version-min=10.3" LDFLAGS="-flto" CC="xcrun -sdk iphonesimulator clang -arch x86_64" --disable-shared --enable-static --host="${ARCH}-apple-darwin" | |
| make clean && make -j8 && make install | |
| # build armv7 | |
| ARCH="armv7" | |
| ./configure --prefix=`pwd`/install_armv7 --enable-arm-neon=api CFLAGS="-Ofast -fembed-bitcode -mios-version-min=10.3" LDFLAGS="-flto" CC="xcrun -sdk iphoneos clang -arch armv7" --host="${ARCH}-apple-darwin" --enable-static=yes --enable-shared=no | |
| make clean && make -j8 && make install | |
| # build armv7s | |
| ARCH="armv7s" | |
| ./configure --prefix=`pwd`/install_armv7s --enable-arm-neon=api CFLAGS="-Ofast -fembed-bitcode -mios-version-min=10.3" LDFLAGS="-flto" CC="xcrun -sdk iphoneos clang -arch armv7s" --host="${ARCH}-apple-darwin" --enable-static=yes --enable-shared=no | |
| make clean && make -j8 && make install | |
| # build arm64 | |
| ARCH="arm64" | |
| ./configure --prefix=`pwd`/install_arm64 --enable-arm-neon=api CFLAGS="-Ofast -fembed-bitcode -mios-version-min=10.3" LDFLAGS="-flto" CC="xcrun -sdk iphoneos clang -arch arm64" --host="aarch64-apple-darwin" --enable-static=yes --enable-shared=no | |
| make clean && make -j8 && make install | |
| # build universal | |
| mkdir -p output-ios | |
| xcrun lipo -create $(find install_*/lib -name "libpng.a") -o output-ios/libpng.a | |
| cp -r install_armv7/include output-ios/. | |
| # build macosx | |
| ./configure --prefix=`pwd`/install_macosx CFLAGS="-Ofast -mmacosx-version-min=10.7" LDFLAGS="-flto" CC="xcrun -sdk macosx clang -arch x86_64" | |
| make clean && make -j8 && make install | |
| install_name_tool -id "@executable_path/../Frameworkds/libpng.dylib" install_macosx/lib/libpng.dylib | |
| mkdir -p output-macosx | |
| cp -r install_macosx/include output-macosx/. | |
| LIB=libpng.dylib; while readlink install_macosx/lib/$LIB > /dev/null; do LIB=$(readlink install_macosx/lib/$LIB); done; | |
| cp install_macosx/lib/$LIB output-macosx/libpng.dylib |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment