Skip to content

Commit

Permalink
Add additional protections against defining INT32 if another header h…
Browse files Browse the repository at this point in the history
…as already defined it (code borrowed from libjpeg v8.) This isn't necessary when using the libjpeg-turbo build system on Windows, because the CMake generated jconfig.h defines INT32 and then defines XMD_H to trick jmorecfg.h into not redefining it. However, some projects build libjpeg-turbo using their own build systems.

git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1592 632fc199-4ca6-4c93-a231-07263d6284db
  • Loading branch information
dcommander committed Jul 6, 2015
2 parents f854e66 + 5829cb2 commit 0b24602
Show file tree
Hide file tree
Showing 77 changed files with 6,360 additions and 893 deletions.
116 changes: 74 additions & 42 deletions BUILDING.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Build Requirements
code, relative to building libjpeg-turbo with GCC v4.2. If you are
running Snow Leopard or earlier, it is suggested that you continue to use
Xcode v3.2.6, which provides GCC v4.2. If you are using Lion or later, it
is suggested that you install Apple GCC v4.2 through MacPorts.
is suggested that you install Apple GCC v4.2 or GCC v5 through MacPorts.

-- If building the TurboJPEG Java wrapper, JDK or OpenJDK 1.5 or later is
required. Some systems, such as Solaris 10 and later and Red Hat Enterprise
Expand Down Expand Up @@ -81,14 +81,10 @@ Solaris/x86 systems (on Solaris, this generates a 32-bit library. See below
for 64-bit build instructions.)

cd {source_directory}
autoreconf -fiv
cd {build_directory}
sh {source_directory}/configure [additional configure flags]
make

NOTE: Running autoreconf in the source directory is usually only necessary if
building libjpeg-turbo from the SVN repository.

This will generate the following files under .libs/

libjpeg.a
Expand Down Expand Up @@ -335,6 +331,9 @@ Additional build requirements:
(https://sourceforge.net/p/libjpeg-turbo/code/HEAD/tree/gas-preprocessor)
should be installed in your PATH.


ARM 32-bit Build (Xcode 4.6.x and earlier, LLVM-GCC):

Set the following shell variables for simplicity:

Xcode 4.2 and earlier:
Expand All @@ -343,55 +342,82 @@ Set the following shell variables for simplicity:
IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform

IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk

Xcode 4.6.x and earlier:
IOS_GCC=$IOS_PLATFORMDIR/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2
Xcode 5.0.x and later:
IOS_GCC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang

ARM v6 (code will run on all iOS devices, not SIMD-accelerated):
ARMv6 (code will run on all iOS devices, not SIMD-accelerated):
[NOTE: Requires Xcode 4.4.x or earlier]
IOS_CFLAGS="-march=armv6 -mcpu=arm1176jzf-s -mfpu=vfp"

ARM v7 (code will run on iPhone 3GS-4S/iPad 1st-3rd Generation and newer):
Xcode 4.6.x and earlier:
ARMv7 (code will run on iPhone 3GS-4S/iPad 1st-3rd Generation and newer):
IOS_CFLAGS="-march=armv7 -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon"
Xcode 5.0.x and later:
IOS_CFLAGS="-arch armv7"

ARM v7s (code will run on iPhone 5/iPad 4th Generation and newer):
ARMv7s (code will run on iPhone 5/iPad 4th Generation and newer):
[NOTE: Requires Xcode 4.5 or later]
Xcode 4.6.x and earlier:
IOS_CFLAGS="-march=armv7s -mcpu=swift -mtune=swift -mfpu=neon"
Xcode 5.0.x and later:
IOS_CFLAGS="-arch armv7s"

Follow the procedure under "Building libjpeg-turbo" above, adding

--host arm-apple-darwin10 --enable-static --disable-shared \
--host arm-apple-darwin10 \
CC="$IOS_GCC" LD="$IOS_GCC" \
CFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT -O3 $IOS_CFLAGS" \
LDFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT $IOS_CFLAGS"

to the configure command line. If using Xcode 5.0.x or later, also add
to the configure command line.


ARM 32-bit Build (Xcode 5.0.x and later, Clang):

Set the following shell variables for simplicity:

IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk
IOS_GCC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang

ARMv7 (code will run on iPhone 3GS-4S/iPad 1st-3rd Generation and newer):
IOS_CFLAGS="-arch armv7"

ARMv7s (code will run on iPhone 5/iPad 4th Generation and newer):
IOS_CFLAGS="-arch armv7s"

Follow the procedure under "Building libjpeg-turbo" above, adding

--host arm-apple-darwin10 \
CC="$IOS_GCC" LD="$IOS_GCC" \
CFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT -O3 $IOS_CFLAGS" \
LDFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT $IOS_CFLAGS" \
CCASFLAGS="-no-integrated-as $IOS_CFLAGS"

to the configure command line.


ARMv8 64-bit Build (Xcode 5.0.x and later, Clang):

Code will run on iPhone 5S/iPad Mini 2/iPad Air and newer.

Set the following shell variables for simplicity:

IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk
IOS_GCC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
IOS_CFLAGS="-arch arm64"

Follow the procedure under "Building libjpeg-turbo" above, adding

--host aarch64-apple-darwin \
CC="$IOS_GCC" LD="$IOS_GCC" \
CFLAGS="-isysroot $IOS_SYSROOT -O3 $IOS_CFLAGS" \
LDFLAGS="-isysroot $IOS_SYSROOT $IOS_CFLAGS"

to the configure command line.


NOTE: You can also add -miphoneos-version-min={version} to $IOS_CFLAGS above
in order to support older versions of iOS than the default version supported by
the SDK.

Once built, lipo can be used to combine the ARM v6, v7, and/or v7s variants
Once built, lipo can be used to combine the ARMv6, v7, v7s, and/or v8 variants
into a universal library.

NOTE: If you are building libjpeg-turbo from the "official" project tarball,
then it is highly likely that you will need to run 'autoreconf -fiv' in the
source tree prior to building ARM v7 or v7s iOS binaries using the techniques
described above. Otherwise, you may get a libtool error such as "unable to
infer tagged configuration."


Building libjpeg-turbo for Android
----------------------------------
Expand Down Expand Up @@ -764,26 +790,32 @@ make udmg [BUILDDIR32={32-bit build directory}]
make command line as shown above.

make iosdmg [BUILDDIR32={32-bit build directory}] \
[BUILDDIRARMV6={ARM v6 build directory}] \
[BUILDDIRARMV7={ARM v7 build directory}] \
[BUILDDIRARMV7S={ARM v7s build directory}]
[BUILDDIRARMV6={ARMv6 build directory}] \
[BUILDDIRARMV7={ARMv7 build directory}] \
[BUILDDIRARMV7S={ARMv7s build directory}] \
[BUILDDIRARMV8={ARMv8 build directory}]

On OS X systems, this creates a Macintosh package and disk image in which the
libjpeg-turbo static libraries contain ARM architectures necessary to build
iOS applications. If building on an x86-64 system, the binaries will also
contain the i386 architecture, as with 'make udmg' above. You should first
configure ARM v6, ARM v7, and/or ARM v7s out-of-tree builds of libjpeg-turbo
(see "Building libjpeg-turbo for iOS" above.) If you are building an x86-64
version of libjpeg-turbo, you should configure a 32-bit out-of-tree build as
well. Next, build libjpeg-turbo as you would normally, using an out-of-tree
build. When it is built, run 'make iosdmg' from the build directory. The
build system will look for the ARM v6 build under {source_directory}/iosarmv6
by default, the ARM v7 build under {source_directory}/iosarmv7 by default,
the ARM v7s build under {source_directory}/iosarmv7s by default, and (if
applicable) the 32-bit build under {source_directory}/osxx86 by default, but
you can override this by setting the BUILDDIR32, BUILDDIRARMV6,
BUILDDIRARMV7, and/or BUILDDIRARMV7S variables on the make command line as
shown above.
configure ARMv6, ARMv7, ARMv7s, and/or ARMv8 out-of-tree builds of
libjpeg-turbo (see "Building libjpeg-turbo for iOS" above.) If you are
building an x86-64 version of libjpeg-turbo, you should configure a 32-bit
out-of-tree build as well. Next, build libjpeg-turbo as you would normally,
using an out-of-tree build. When it is built, run 'make iosdmg' from the
build directory. The build system will look for the ARMv6 build under
{source_directory}/iosarmv6 by default, the ARMv7 build under
{source_directory}/iosarmv7 by default, the ARMv7s build under
{source_directory}/iosarmv7s by default, the ARMv8 build under
{source_directory}/iosarmv8 by default, and (if applicable) the 32-bit build
under {source_directory}/osxx86 by default, but you can override this by
setting the BUILDDIR32, BUILDDIRARMV6, BUILDDIRARMV7, BUILDDIRARMV7S, and/or
BUILDDIRARMV8 variables on the make command line as shown above.

NOTE: If including an ARMv8 build in the package, then you may need to use
Xcode's version of lipo instead of the operating system's. To do this, pass
an argument of LIPO="xcrun lipo" on the make command line.

make cygwinpkg

Expand Down
Loading

0 comments on commit 0b24602

Please sign in to comment.