iosbuild.sh: add WebPDecoder.framework + encoder

WebPDecoder.framework replaces WebP.framework as the decode-only
framework.
WebP.framework now includes the full library allowing for use of the
encoder.

BUG=webp:307

Change-Id: Ic8139f201576bf94b0d4a31cb7cad0655cd8ba97
(cherry picked from commit 1d5046d1f9)
This commit is contained in:
James Zern 2016-12-09 19:08:53 -08:00
parent be7dcc088c
commit 74a12b10d9

View File

@ -1,10 +1,11 @@
#!/bin/bash #!/bin/bash
# #
# This script generates 'WebP.framework'. An iOS app can decode WebP images # This script generates 'WebP.framework' and 'WebPDecoder.framework'. An iOS
# by including 'WebP.framework'. # app can decode WebP images by including 'WebPDecoder.framework' and both
# encode and decode WebP images by including 'WebP.framework'.
# #
# Run ./iosbuild.sh to generate 'WebP.framework' under the current directory # Run ./iosbuild.sh to generate the frameworks under the current directory
# (previous build will be erased if it exists). # (the previous build will be erased if it exists).
# #
# This script is inspired by the build script written by Carson McDonald. # This script is inspired by the build script written by Carson McDonald.
# (http://www.ioncannon.net/programming/1483/using-webp-to-reduce-native-ios-app-size/). # (http://www.ioncannon.net/programming/1483/using-webp-to-reduce-native-ios-app-size/).
@ -33,10 +34,12 @@ readonly SRCDIR=$(dirname $0)
readonly TOPDIR=$(pwd) readonly TOPDIR=$(pwd)
readonly BUILDDIR="${TOPDIR}/iosbuild" readonly BUILDDIR="${TOPDIR}/iosbuild"
readonly TARGETDIR="${TOPDIR}/WebP.framework" readonly TARGETDIR="${TOPDIR}/WebP.framework"
readonly DECTARGETDIR="${TOPDIR}/WebPDecoder.framework"
readonly DEVELOPER=$(xcode-select --print-path) readonly DEVELOPER=$(xcode-select --print-path)
readonly PLATFORMSROOT="${DEVELOPER}/Platforms" readonly PLATFORMSROOT="${DEVELOPER}/Platforms"
readonly LIPO=$(xcrun -sdk iphoneos${SDK} -find lipo) readonly LIPO=$(xcrun -sdk iphoneos${SDK} -find lipo)
LIBLIST='' LIBLIST=''
DECLIBLIST=''
if [[ -z "${SDK}" ]]; then if [[ -z "${SDK}" ]]; then
echo "iOS SDK not available" echo "iOS SDK not available"
@ -50,10 +53,8 @@ else
echo "iOS SDK Version ${SDK}" echo "iOS SDK Version ${SDK}"
fi fi
rm -rf ${BUILDDIR} rm -rf ${BUILDDIR} ${TARGETDIR} ${DECTARGETDIR}
rm -rf ${TARGETDIR} mkdir -p ${BUILDDIR} ${TARGETDIR}/Headers/ ${DECTARGETDIR}/Headers/
mkdir -p ${BUILDDIR}
mkdir -p ${TARGETDIR}/Headers/
if [[ ! -e ${SRCDIR}/configure ]]; then if [[ ! -e ${SRCDIR}/configure ]]; then
if ! (cd ${SRCDIR} && sh autogen.sh); then if ! (cd ${SRCDIR} && sh autogen.sh); then
@ -107,12 +108,13 @@ for PLATFORM in ${PLATFORMS}; do
CFLAGS="${CFLAGS}" CFLAGS="${CFLAGS}"
set +x set +x
# run make only in the src/ directory to create libwebpdecoder.a # run make only in the src/ directory to create libwebp.a/libwebpdecoder.a
cd src/ cd src/
make V=0 make V=0
make install make install
LIBLIST+=" ${ROOTDIR}/lib/libwebpdecoder.a" LIBLIST+=" ${ROOTDIR}/lib/libwebp.a"
DECLIBLIST+=" ${ROOTDIR}/lib/libwebpdecoder.a"
make clean make clean
cd .. cd ..
@ -122,3 +124,6 @@ done
cp -a ${SRCDIR}/src/webp/*.h ${TARGETDIR}/Headers/ cp -a ${SRCDIR}/src/webp/*.h ${TARGETDIR}/Headers/
${LIPO} -create ${LIBLIST} -output ${TARGETDIR}/WebP ${LIPO} -create ${LIBLIST} -output ${TARGETDIR}/WebP
cp -a ${SRCDIR}/src/webp/*.h ${DECTARGETDIR}/Headers/
${LIPO} -create ${DECLIBLIST} -output ${DECTARGETDIR}/WebPDecoder