Infrastructure for producing a universal x86-64/i386/ARM version of libjpeg.a and libturbojpeg.a on OS X, so that the same library can be used to build OS X and iOS apps

git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@789 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
DRC
2012-02-09 09:23:30 +00:00
parent 272a395514
commit 1c833ad8a5
4 changed files with 79 additions and 14 deletions

View File

@@ -652,6 +652,21 @@ make udmg [BUILDDIR32={32-bit build directory}]
{source_directory}/osxx86 by default, but you can override this by setting {source_directory}/osxx86 by default, but you can override this by setting
the BUILDDIR32 variable on the make command line as shown above. the BUILDDIR32 variable on the make command line as shown above.
make iosdmg [BUILDDIR32={32-bit build directory}] \
[BUILDDIRARMV6={ARM v6 build directory}] \
[BUILDDIRARMV7={ARM v7 build directory}] \
On 64-bit OS X systems, this creates a version of the Macintosh package and
disk image that contains universal i386/x86-64/ARM binaries. You should
first configure 32-bit, ARM v6, and ARM v7 out-of-tree builds of
libjpeg-turbo, then configure a 64-bit out-of-tree build, then run
'make iosdmg' from the 64-bit build directory. The build system will look
for the 32-bit build under {source_directory}/osxx86 by default, the ARM v6
build under {source_directory}/iosarmv6 by default, and the ARM v7 build
under {source_directory}/iosarmv7 by default, but you can override this by
setting the BUILDDIR32, BUILDDIRARMV6, and/or BUILDDIRARMV7 variables on the
make command line as shown above.
make sunpkg make sunpkg
Build a Solaris package. This requires pkgmk, pkgtrans, and bzip2. Build a Solaris package. This requires pkgmk, pkgtrans, and bzip2.

View File

@@ -9,6 +9,10 @@ will not be SIMD-accelerated when using any of these scaling factors.
platforms. This speeds up the decompression of 4:2:2 JPEGs by 20-25% on such platforms. This speeds up the decompression of 4:2:2 JPEGs by 20-25% on such
platforms. platforms.
[3] Added ARM v6 and ARM v7 architectures to libjpeg.a and libturbojpeg.a in
the official OS X distribution package, so that those libraries can be used to
build both OS X and iOS applications.
1.2.0 1.2.0
===== =====

View File

@@ -293,6 +293,9 @@ if X86_64
udmg: all udmg: all
sh pkgscripts/makemacpkg universal ${BUILDDIR32} sh pkgscripts/makemacpkg universal ${BUILDDIR32}
iosdmg: all
sh pkgscripts/makemacpkg ios ${BUILDDIR32} ${BUILDDIRARMV6} ${BUILDDIRARMV7}
endif endif
dmg: all dmg: all

View File

@@ -15,25 +15,29 @@ onexit()
fi fi
} }
usage()
{
echo "$0 [universal [32-bit build dir]]"
exit 1
}
UNIVERSAL=0 UNIVERSAL=0
IOS=0
PACKAGE_NAME=@PACKAGE_NAME@ PACKAGE_NAME=@PACKAGE_NAME@
VERSION=@VERSION@ VERSION=@VERSION@
BUILD=@BUILD@ BUILD=@BUILD@
SRCDIR=@abs_top_srcdir@ SRCDIR=@abs_top_srcdir@
BUILDDIR32=@abs_top_srcdir@/osxx86 BUILDDIR32=@abs_top_srcdir@/osxx86
BUILDDIRARMV6=@abs_top_srcdir@/iosarmv6
BUILDDIRARMV7=@abs_top_srcdir@/iosarmv7
WITH_JAVA=@WITH_JAVA@ WITH_JAVA=@WITH_JAVA@
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
if [ "$1" = "universal" ]; then if [ "$1" = "universal" ]; then
UNIVERSAL=1 UNIVERSAL=1
if [ $# -gt 1 ]; then BUILDDIR32=$2; fi if [ $# -gt 1 ]; then BUILDDIR32=$2; fi
fi fi
if [ "$1" = "ios" ]; then
UNIVERSAL=1
IOS=1
if [ $# -gt 1 ]; then BUILDDIR32=$2; fi
if [ $# -gt 2 ]; then BUILDDIRARMV6=$3; fi
if [ $# -gt 3 ]; then BUILDDIRARMV7=$4; fi
fi
fi fi
PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
@@ -79,18 +83,57 @@ if [ $UNIVERSAL = 1 ]; then
-arch x86_64 $PKGROOT/opt/$PACKAGE_NAME/lib/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib \ -arch x86_64 $PKGROOT/opt/$PACKAGE_NAME/lib/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib \
-output $PKGROOT/opt/$PACKAGE_NAME/lib/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib -output $PKGROOT/opt/$PACKAGE_NAME/lib/libjpeg.@SO_MAJOR_VERSION@.0.@SO_MINOR_VERSION@.dylib
fi fi
lipo -create \ if [ $IOS = 1 ]; then
-arch i386 $TMPDIR/dist.x86/opt/$PACKAGE_NAME/lib/libjpeg.a \ if [ ! -d $BUILDDIRARMV6 ]; then
-arch x86_64 $PKGROOT/opt/$PACKAGE_NAME/lib/libjpeg.a \ echo ERROR: ARM v6 build directory $BUILDDIRARMV6 does not exist
-output $PKGROOT/opt/$PACKAGE_NAME/lib/libjpeg.a exit 1
fi
if [ ! -f $BUILDDIRARMV6/Makefile ]; then
echo ERROR: ARM v6 build directory $BUILDDIRARMV6 is not configured
exit 1
fi
mkdir -p $TMPDIR/dist.armv6
pushd $BUILDDIRARMV6
make install DESTDIR=$TMPDIR/dist.armv6
popd
if [ ! -d $BUILDDIRARMV7 ]; then
echo ERROR: ARM v7 build directory $BUILDDIRARMV7 does not exist
exit 1
fi
if [ ! -f $BUILDDIRARMV7/Makefile ]; then
echo ERROR: ARM v7 build directory $BUILDDIRARMV7 is not configured
exit 1
fi
mkdir -p $TMPDIR/dist.armv7
pushd $BUILDDIRARMV7
make install DESTDIR=$TMPDIR/dist.armv7
popd
lipo -create \
-arch arm $TMPDIR/dist.armv6/opt/$PACKAGE_NAME/lib/libjpeg.a \
-arch arm $TMPDIR/dist.armv7/opt/$PACKAGE_NAME/lib/libjpeg.a \
-arch i386 $TMPDIR/dist.x86/opt/$PACKAGE_NAME/lib/libjpeg.a \
-arch x86_64 $PKGROOT/opt/$PACKAGE_NAME/lib/libjpeg.a \
-output $PKGROOT/opt/$PACKAGE_NAME/lib/libjpeg.a
lipo -create \
-arch arm $TMPDIR/dist.armv6/opt/$PACKAGE_NAME/lib/libturbojpeg.a \
-arch arm $TMPDIR/dist.armv7/opt/$PACKAGE_NAME/lib/libturbojpeg.a \
-arch i386 $TMPDIR/dist.x86/opt/$PACKAGE_NAME/lib/libturbojpeg.a \
-arch x86_64 $PKGROOT/usr/lib/libturbojpeg.a \
-output $PKGROOT/usr/lib/libturbojpeg.a
else
lipo -create \
-arch i386 $TMPDIR/dist.x86/opt/$PACKAGE_NAME/lib/libjpeg.a \
-arch x86_64 $PKGROOT/opt/$PACKAGE_NAME/lib/libjpeg.a \
-output $PKGROOT/opt/$PACKAGE_NAME/lib/libjpeg.a
lipo -create \
-arch i386 $TMPDIR/dist.x86/opt/$PACKAGE_NAME/lib/libturbojpeg.a \
-arch x86_64 $PKGROOT/usr/lib/libturbojpeg.a \
-output $PKGROOT/usr/lib/libturbojpeg.a
fi
lipo -create \ lipo -create \
-arch i386 $TMPDIR/dist.x86/opt/$PACKAGE_NAME/lib/libturbojpeg.dylib \ -arch i386 $TMPDIR/dist.x86/opt/$PACKAGE_NAME/lib/libturbojpeg.dylib \
-arch x86_64 $PKGROOT/usr/lib/libturbojpeg.dylib \ -arch x86_64 $PKGROOT/usr/lib/libturbojpeg.dylib \
-output $PKGROOT/usr/lib/libturbojpeg.dylib -output $PKGROOT/usr/lib/libturbojpeg.dylib
lipo -create \
-arch i386 $TMPDIR/dist.x86/opt/$PACKAGE_NAME/lib/libturbojpeg.a \
-arch x86_64 $PKGROOT/usr/lib/libturbojpeg.a \
-output $PKGROOT/usr/lib/libturbojpeg.a
lipo -create \ lipo -create \
-arch i386 $TMPDIR/dist.x86/opt/$PACKAGE_NAME/bin/cjpeg \ -arch i386 $TMPDIR/dist.x86/opt/$PACKAGE_NAME/bin/cjpeg \
-arch x86_64 $PKGROOT/opt/$PACKAGE_NAME/bin/cjpeg \ -arch x86_64 $PKGROOT/opt/$PACKAGE_NAME/bin/cjpeg \