iosbuild.sh: sync some aspects of xcframeworkbuild.sh
#!/bin/bash
#
-# 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'.
+# This script generates 'WebP.framework' and 'WebPDecoder.framework',
+# 'WebPDemux.framework' and 'WebPMux.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 the frameworks under the current directory
# (the previous build will be erased if it exists).
@@ -50,13 +51,27 @@ if [[ -z "${SDK}" ]]; then
exit 1
elif [[ ${SDK%%.*} -gt 8 ]]; then
EXTRA_CFLAGS="-fembed-bitcode"
-elif [[ ${SDK} < 6.0 ]]; then
+elif [[ ${SDK%%.*} -le 6 ]]; then
echo "You need iOS SDK version 6.0 or above"
exit 1
-else
- echo "iOS SDK Version ${SDK}"
fi
+echo "Xcode Version: ${XCODE}"
+echo "iOS SDK Version: ${SDK}"
+
+if [[ -e "${BUILDDIR}" || -e "${TARGETDIR}" || -e "${DECTARGETDIR}" \
+ || -e "${MUXTARGETDIR}" || -e "${DEMUXTARGETDIR}" ]]; then
+ cat << EOF
+WARNING: The following directories will be deleted:
+WARNING: ${BUILDDIR}
+WARNING: ${TARGETDIR}
+WARNING: ${DECTARGETDIR}
+WARNING: ${MUXTARGETDIR}
+WARNING: ${DEMUXTARGETDIR}
+WARNING: The build will continue in 5 seconds...
+EOF
+ sleep 5
+fi
rm -rf ${BUILDDIR} ${TARGETDIR} ${DECTARGETDIR} \
${MUXTARGETDIR} ${DEMUXTARGETDIR}
mkdir -p ${BUILDDIR} ${TARGETDIR}/Headers/ ${DECTARGETDIR}/Headers/ \
@@ -64,12 +79,12 @@ mkdir -p ${BUILDDIR} ${TARGETDIR}/Headers/ ${DECTARGETDIR}/Headers/ \
if [[ ! -e ${SRCDIR}/configure ]]; then
if ! (cd ${SRCDIR} && sh autogen.sh); then
- cat <<EOT
+ cat << EOF
Error creating configure script!
This script requires the autoconf/automake and libtool to build. MacPorts can
be used to obtain these:
http://www.macports.org/install.php
-EOT
+EOF
exit 1
fi
fi
@@ -148,3 +163,5 @@ echo "DEMUXLIBLIST = ${DEMUXLIBLIST}"
cp -a ${SRCDIR}/src/webp/{decode,types,mux_types,demux}.h \
${DEMUXTARGETDIR}/Headers/
${LIPO} -create ${DEMUXLIBLIST} -output ${DEMUXTARGETDIR}/WebPDemux
+
+echo "SUCCESS"
