From 74a12b10d9dbc728231789e832f9bcd7ba820820 Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 9 Dec 2016 19:08:53 -0800 Subject: [PATCH] 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 1d5046d1f9a863d8a13460e5405fef8c0acd3db0) --- iosbuild.sh | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/iosbuild.sh b/iosbuild.sh index 52626272..954c6641 100755 --- a/iosbuild.sh +++ b/iosbuild.sh @@ -1,10 +1,11 @@ #!/bin/bash # -# This script generates 'WebP.framework'. An iOS app can decode WebP images -# by including 'WebP.framework'. +# This script generates 'WebP.framework' and 'WebPDecoder.framework'. An iOS +# 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 -# (previous build will be erased if it exists). +# Run ./iosbuild.sh to generate the frameworks under the current directory +# (the previous build will be erased if it exists). # # 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/). @@ -33,10 +34,12 @@ readonly SRCDIR=$(dirname $0) readonly TOPDIR=$(pwd) readonly BUILDDIR="${TOPDIR}/iosbuild" readonly TARGETDIR="${TOPDIR}/WebP.framework" +readonly DECTARGETDIR="${TOPDIR}/WebPDecoder.framework" readonly DEVELOPER=$(xcode-select --print-path) readonly PLATFORMSROOT="${DEVELOPER}/Platforms" readonly LIPO=$(xcrun -sdk iphoneos${SDK} -find lipo) LIBLIST='' +DECLIBLIST='' if [[ -z "${SDK}" ]]; then echo "iOS SDK not available" @@ -50,10 +53,8 @@ else echo "iOS SDK Version ${SDK}" fi -rm -rf ${BUILDDIR} -rm -rf ${TARGETDIR} -mkdir -p ${BUILDDIR} -mkdir -p ${TARGETDIR}/Headers/ +rm -rf ${BUILDDIR} ${TARGETDIR} ${DECTARGETDIR} +mkdir -p ${BUILDDIR} ${TARGETDIR}/Headers/ ${DECTARGETDIR}/Headers/ if [[ ! -e ${SRCDIR}/configure ]]; then if ! (cd ${SRCDIR} && sh autogen.sh); then @@ -107,12 +108,13 @@ for PLATFORM in ${PLATFORMS}; do CFLAGS="${CFLAGS}" 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/ make V=0 make install - LIBLIST+=" ${ROOTDIR}/lib/libwebpdecoder.a" + LIBLIST+=" ${ROOTDIR}/lib/libwebp.a" + DECLIBLIST+=" ${ROOTDIR}/lib/libwebpdecoder.a" make clean cd .. @@ -122,3 +124,6 @@ done cp -a ${SRCDIR}/src/webp/*.h ${TARGETDIR}/Headers/ ${LIPO} -create ${LIBLIST} -output ${TARGETDIR}/WebP + +cp -a ${SRCDIR}/src/webp/*.h ${DECTARGETDIR}/Headers/ +${LIPO} -create ${DECLIBLIST} -output ${DECTARGETDIR}/WebPDecoder