1 Building on Un*x Platforms (including Cygwin and OS X)
2 =======================================================
8 - autoconf 2.56 or later
10 - automake 1.7 or later
12 - libtool 1.4 or later
13 * If using Xcode 4.3 or later on OS X, autoconf and automake are no longer
14 provided. The easiest way to obtain them is from
15 [MacPorts](http://www.MacPorts.org).
17 - NASM or YASM (if building x86 or x86-64 SIMD extensions)
18 * NASM 0.98, or 2.01 or later is required for an x86 build (0.99 and 2.00 do
19 not work properly with libjpeg-turbo's x86 SIMD code.)
20 * NASM 2.00 or later is required for an x86-64 build.
21 * NASM 2.07, or 2.11.09 or later is required for an x86-64 Mac build
22 (2.11.08 does not work properly with libjpeg-turbo's x86-64 SIMD code when
23 building macho64 objects.) NASM or YASM can be obtained from
24 [MacPorts](http://www.MacPorts.org).
26 The binary RPMs released by the NASM project do not work on older Linux
27 systems, such as Red Hat Enterprise Linux 4. On such systems, you can
28 easily build and install NASM from a source RPM by downloading one of the
31 http://www.nasm.us/pub/nasm/releasebuilds
33 and executing the following as root:
36 rpmbuild --rebuild nasm-{version}.src.rpm
37 rpm -Uvh /usr/src/redhat/RPMS/$ARCH/nasm-{version}.$ARCH.rpm
39 NOTE: the NASM build will fail if texinfo is not installed.
41 - GCC v4.1 (or later) or clang recommended for best performance
43 - If building the TurboJPEG Java wrapper, JDK or OpenJDK 1.5 or later is
44 required. Some systems, such as Solaris 10 and later and Red Hat Enterprise
45 Linux 5 and later, have this pre-installed. On OS X 10.5 and later, it will
46 be necessary to install the Java Developer Package, which can be downloaded
47 from http://developer.apple.com/downloads (Apple ID required.) For systems
48 that do not have a JDK installed, you can obtain the Oracle Java Development
49 Kit from http://www.java.com.
55 Binary objects, libraries, and executables are generated in the same directory
56 from which `configure` was executed (the "binary directory"), and this
57 directory need not necessarily be the same as the libjpeg-turbo source
58 directory. You can create multiple independent binary directories, in which
59 different versions of libjpeg-turbo can be built from the same source tree
60 using different compilers or settings. In the sections below,
61 *{build_directory}* refers to the binary directory, whereas
62 *{source_directory}* refers to the libjpeg-turbo source directory. For in-tree
63 builds, these directories are the same.
66 Building libjpeg-turbo
67 ----------------------
69 The following procedure will build libjpeg-turbo on Linux, FreeBSD, Cygwin, and
70 Solaris/x86 systems (on Solaris, this generates a 32-bit library. See below
71 for 64-bit build instructions.)
76 sh {source_directory}/configure [additional configure flags]
79 NOTE: Running autoreconf in the source directory is not necessary if building
80 libjpeg-turbo from one of the official release tarballs.
82 This will generate the following files under .libs/:
85 Static link library for the libjpeg API
87 **libjpeg.so.{version}** (Linux, Unix)
88 **libjpeg.{version}.dylib** (OS X)
89 **cygjpeg-{version}.dll** (Cygwin)
90 Shared library for the libjpeg API
92 By default, *{version}* is 62.1.0, 7.1.0, or 8.0.2, depending on whether
93 libjpeg v6b (default), v7, or v8 emulation is enabled. If using Cygwin,
94 *{version}* is 62, 7, or 8.
96 **libjpeg.so** (Linux, Unix)
97 **libjpeg.dylib** (OS X)
98 Development symlink for the libjpeg API
100 **libjpeg.dll.a** (Cygwin)
101 Import library for the libjpeg API
104 Static link library for the TurboJPEG API
106 **libturbojpeg.so.0.1.0** (Linux, Unix)
107 **libturbojpeg.0.1.0.dylib** (OS X)
108 **cygturbojpeg-0.dll** (Cygwin)
109 Shared library for the TurboJPEG API
111 **libturbojpeg.so** (Linux, Unix)
112 **libturbojpeg.dylib** (OS X)
113 Development symlink for the TurboJPEG API
115 **libturbojpeg.dll.a** (Cygwin)
116 Import library for the TurboJPEG API
119 ### libjpeg v7 or v8 API/ABI Emulation
121 Add `--with-jpeg7` to the `configure` command line to build a version of
122 libjpeg-turbo that is API/ABI-compatible with libjpeg v7. Add `--with-jpeg8`
123 to the `configure` command to build a version of libjpeg-turbo that is
124 API/ABI-compatible with libjpeg v8. See [README.md](README.md) for more
125 information on libjpeg v7 and v8 emulation.
128 ### In-Memory Source/Destination Managers
130 When using libjpeg v6b or v7 API/ABI emulation, add `--without-mem-srcdst` to
131 the `configure` command line to build a version of libjpeg-turbo that lacks the
132 `jpeg_mem_src()` and `jpeg_mem_dest()` functions. These functions were not
133 part of the original libjpeg v6b and v7 APIs, so removing them ensures strict
134 conformance with those APIs. See [README.md](README.md) for more information.
137 ### Arithmetic Coding Support
139 Since the patent on arithmetic coding has expired, this functionality has been
140 included in this release of libjpeg-turbo. libjpeg-turbo's implementation is
141 based on the implementation in libjpeg v8, but it works when emulating libjpeg
142 v7 or v6b as well. The default is to enable both arithmetic encoding and
143 decoding, but those who have philosophical objections to arithmetic coding can
144 add `--without-arith-enc` or `--without-arith-dec` to the `configure` command
145 line to disable encoding or decoding (respectively.)
148 ### TurboJPEG Java Wrapper
150 Add `--with-java` to the `configure` command line to incorporate an optional
151 Java Native Interface wrapper into the TurboJPEG shared library and build the
152 Java front-end classes to support it. This allows the TurboJPEG shared library
153 to be used directly from Java applications. See [java/README](java/README) for
156 You can set the `JAVAC`, `JAR`, and `JAVA` configure variables to specify
157 alternate commands for javac, jar, and java (respectively.) You can also
158 set the `JAVACFLAGS` configure variable to specify arguments that should be
159 passed to the Java compiler when building the front-end classes, and
160 `JNI_CFLAGS` to specify arguments that should be passed to the C compiler when
161 building the JNI wrapper. Run `configure --help` for more details.
164 Installing libjpeg-turbo
165 ------------------------
167 If you intend to install these libraries and the associated header files, then
168 replace 'make' in the instructions above with
170 make install prefix={base dir} libdir={library directory}
174 make install prefix=/usr/local libdir=/usr/local/lib64
176 will install the header files in /usr/local/include and the library files in
177 /usr/local/lib64. If `prefix` and `libdir` are not specified, then the default
178 is to install the header files in /opt/libjpeg-turbo/include and the library
179 files in /opt/libjpeg-turbo/lib32 (32-bit) or /opt/libjpeg-turbo/lib64
182 NOTE: You can specify a prefix of /usr and a libdir of, for instance,
183 /usr/lib64 to overwrite the system's version of libjpeg. If you do this,
184 however, then be sure to BACK UP YOUR SYSTEM'S INSTALLATION OF LIBJPEG before
185 overwriting it. It is recommended that you instead install libjpeg-turbo into
186 a non-system directory and manipulate the `LD_LIBRARY_PATH` or create symlinks
187 to force applications to use libjpeg-turbo instead of libjpeg. See
188 [README.md](README.md) for more information.
195 ### 32-bit Build on 64-bit Linux
199 --host i686-pc-linux-gnu CFLAGS='-O3 -m32' LDFLAGS=-m32
201 to the `configure` command line.
204 ### 64-bit Build on 64-bit OS X
208 --host x86_64-apple-darwin NASM=/opt/local/bin/nasm
210 to the `configure` command line. NASM 2.07 or later from MacPorts must be
214 ### 32-bit Build on 64-bit OS X
218 --host i686-apple-darwin CFLAGS='-O3 -m32' LDFLAGS=-m32
220 to the `configure` command line.
223 ### 64-bit Backward-Compatible Build on 64-bit OS X
227 --host x86_64-apple-darwin NASM=/opt/local/bin/nasm \
228 CFLAGS='-mmacosx-version-min=10.5 -O3' \
229 LDFLAGS='-mmacosx-version-min=10.5'
231 to the `configure` command line. NASM 2.07 or later from MacPorts must be
235 ### 32-bit Backward-Compatible Build on OS X
239 --host i686-apple-darwin \
240 CFLAGS='-mmacosx-version-min=10.5 -O3 -m32' \
241 LDFLAGS='-mmacosx-version-min=10.5 -m32'
243 to the `configure` command line.
246 ### 64-bit Build on 64-bit Solaris
250 --host x86_64-pc-solaris CFLAGS='-O3 -m64' LDFLAGS=-m64
252 to the `configure` command line.
255 ### 32-bit Build on 64-bit FreeBSD
259 --host i386-unknown-freebsd CC='gcc -B /usr/lib32' CFLAGS='-O3 -m32' \
260 LDFLAGS='-B/usr/lib32'
262 to the `configure` command line. NASM 2.07 or later from FreeBSD ports must be
266 ### Oracle Solaris Studio
272 to the `configure` command line. libjpeg-turbo will automatically be built
273 with the maximum optimization level (-xO5) unless you override `CFLAGS`.
275 To build a 64-bit version of libjpeg-turbo using Oracle Solaris Studio, add
277 --host x86_64-pc-solaris CC=cc CFLAGS='-xO5 -m64' LDFLAGS=-m64
279 to the `configure` command line.
282 ### MinGW Build on Cygwin
284 Use CMake (see recipes below)
290 This release of libjpeg-turbo can use ARM NEON SIMD instructions to accelerate
291 JPEG compression/decompression by approximately 2-4x on ARMv7 and later
292 platforms. If libjpeg-turbo is configured on an ARM Linux platform, then the
293 build system will automatically include the NEON SIMD routines, if they are
294 supported. Build instructions for other ARM-based platforms follow.
297 ### Building libjpeg-turbo for iOS
299 iOS platforms, such as the iPhone and iPad, use ARM processors, some of which
300 support NEON instructions. Additional steps are required in order to build
301 libjpeg-turbo for these platforms.
304 #### Additional build requirements
306 - [gas-preprocessor.pl]
307 (https://raw.githubusercontent.com/libjpeg-turbo/gas-preprocessor/master/gas-preprocessor.pl)
308 should be installed in your `PATH`.
311 #### ARM 32-bit Build (Xcode 4.6.x and earlier, LLVM-GCC)
313 Set the following shell variables for simplicity:
315 *Xcode 4.2 and earlier*
317 IOS_PLATFORMDIR=/Developer/Platforms/iPhoneOS.platform`
319 *Xcode 4.3 and later*
321 IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
325 IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk
326 IOS_GCC=$IOS_PLATFORMDIR/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2
328 *ARMv6 (code will run on all iOS devices, not SIMD-accelerated)*
329 [NOTE: Requires Xcode 4.4.x or earlier]
331 IOS_CFLAGS="-march=armv6 -mcpu=arm1176jzf-s -mfpu=vfp"
333 *ARMv7 (code will run on iPhone 3GS-4S/iPad 1st-3rd Generation and newer)*
335 IOS_CFLAGS="-march=armv7 -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon"
337 *ARMv7s (code will run on iPhone 5/iPad 4th Generation and newer)*
338 [NOTE: Requires Xcode 4.5 or later]
340 IOS_CFLAGS="-march=armv7s -mcpu=swift -mtune=swift -mfpu=neon"
342 Follow the procedure under "Building libjpeg-turbo" above, adding
344 --host arm-apple-darwin10 \
345 CC="$IOS_GCC" LD="$IOS_GCC" \
346 CFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT -O3 $IOS_CFLAGS" \
347 LDFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT $IOS_CFLAGS"
349 to the `configure` command line.
352 #### ARM 32-bit Build (Xcode 5.0.x and later, Clang)
354 Set the following shell variables for simplicity:
356 IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
357 IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk
358 IOS_GCC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
360 *ARMv7 (code will run on iPhone 3GS-4S/iPad 1st-3rd Generation and newer)*
362 IOS_CFLAGS="-arch armv7"
364 *ARMv7s (code will run on iPhone 5/iPad 4th Generation and newer)*
366 IOS_CFLAGS="-arch armv7s"
368 Follow the procedure under "Building libjpeg-turbo" above, adding
370 --host arm-apple-darwin10 \
371 CC="$IOS_GCC" LD="$IOS_GCC" \
372 CFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT -O3 $IOS_CFLAGS" \
373 LDFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT $IOS_CFLAGS" \
374 CCASFLAGS="-no-integrated-as $IOS_CFLAGS"
376 to the `configure` command line.
379 #### ARMv8 64-bit Build (Xcode 5.0.x and later, Clang)
381 Code will run on iPhone 5S/iPad Mini 2/iPad Air and newer.
383 Set the following shell variables for simplicity:
385 IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
386 IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk
387 IOS_GCC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
388 IOS_CFLAGS="-arch arm64"
390 Follow the procedure under "Building libjpeg-turbo" above, adding
392 --host aarch64-apple-darwin \
393 CC="$IOS_GCC" LD="$IOS_GCC" \
394 CFLAGS="-isysroot $IOS_SYSROOT -O3 $IOS_CFLAGS" \
395 LDFLAGS="-isysroot $IOS_SYSROOT $IOS_CFLAGS"
397 to the `configure` command line.
400 NOTE: You can also add `-miphoneos-version-min={version}` to `$IOS_CFLAGS`
401 above in order to support older versions of iOS than the default version
402 supported by the SDK.
404 Once built, lipo can be used to combine the ARMv6, v7, v7s, and/or v8 variants
405 into a universal library.
408 ### Building libjpeg-turbo for Android
410 Building libjpeg-turbo for Android platforms requires the Android NDK
411 (https://developer.android.com/tools/sdk/ndk) and autotools. The following is
412 a general recipe script that can be modified for your specific needs.
414 # Set these variables to suit your needs
415 NDK_PATH={full path to the "ndk" directory-- for example, /opt/android/ndk}
416 BUILD_PLATFORM={the platform name for the NDK package you installed--
417 for example, "windows-x86" or "linux-x86_64" or "darwin-x86_64"}
418 TOOLCHAIN_VERSION={"4.8", "4.9", "clang3.5", etc. This corresponds to a
419 toolchain directory under ${NDK_PATH}/toolchains/.}
420 ANDROID_VERSION={The minimum version of Android to support-- for example,
421 "16", "19", etc. "21" or later is required for a 64-bit build.}
424 HOST=arm-linux-androideabi
425 SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-arm
426 ANDROID_CFLAGS="-march=armv7-a -mfloat-abi=softfp -fprefetch-loop-arrays \
427 --sysroot=${SYSROOT}"
430 HOST=aarch64-linux-android
431 SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-arm64
432 ANDROID_CFLAGS="--sysroot=${SYSROOT}"
434 TOOLCHAIN=${NDK_PATH}/toolchains/${HOST}-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}
435 ANDROID_INCLUDES="-I${SYSROOT}/usr/include -I${TOOLCHAIN}/include"
436 export CPP=${TOOLCHAIN}/bin/${HOST}-cpp
437 export AR=${TOOLCHAIN}/bin/${HOST}-ar
438 export AS=${TOOLCHAIN}/bin/${HOST}-as
439 export NM=${TOOLCHAIN}/bin/${HOST}-nm
440 export CC=${TOOLCHAIN}/bin/${HOST}-gcc
441 export LD=${TOOLCHAIN}/bin/${HOST}-ld
442 export RANLIB=${TOOLCHAIN}/bin/${HOST}-ranlib
443 export OBJDUMP=${TOOLCHAIN}/bin/${HOST}-objdump
444 export STRIP=${TOOLCHAIN}/bin/${HOST}-strip
446 sh {source_directory}/configure --host=${HOST} \
447 CFLAGS="${ANDROID_INCLUDES} ${ANDROID_CFLAGS} -O3 -fPIE" \
448 CPPFLAGS="${ANDROID_INCLUDES} ${ANDROID_CFLAGS}" \
449 LDFLAGS="${ANDROID_CFLAGS} -pie" --with-simd ${1+"$@"}
452 If building for Android 4.0.x (API level < 16) or earlier, remove `-fPIE` from
453 `CFLAGS` and `-pie` from `LDFLAGS`.
456 Building on Windows (Visual C++ or MinGW)
457 =========================================
463 - [CMake](http://www.cmake.org) v2.8.8 or later
465 - Microsoft Visual C++ 2005 or later
467 If you don't already have Visual C++, then the easiest way to get it is by
468 installing the Windows SDK:
470 http://msdn.microsoft.com/en-us/windows/bb980924.aspx
472 The Windows SDK includes both 32-bit and 64-bit Visual C++ compilers and
473 everything necessary to build libjpeg-turbo.
475 * You can also use Microsoft Visual Studio Express Edition, which is a free
476 download. (NOTE: versions prior to 2012 can only be used to build 32-bit
478 * If you intend to build libjpeg-turbo from the command line, then add the
479 appropriate compiler and SDK directories to the `INCLUDE`, `LIB`, and
480 `PATH` environment variables. This is generally accomplished by
481 executing `vcvars32.bat` or `vcvars64.bat` and `SetEnv.cmd`.
482 `vcvars32.bat` and `vcvars64.bat` are part of Visual C++ and are located in
483 the same directory as the compiler. `SetEnv.cmd` is part of the Windows
484 SDK. You can pass optional arguments to `SetEnv.cmd` to specify a 32-bit
485 or 64-bit build environment.
491 MinGW-builds (http://sourceforge.net/projects/mingwbuilds/) or
492 tdm-gcc (http://tdm-gcc.tdragon.net/) recommended if building on a Windows
493 machine. Both distributions install a Start Menu link that can be used to
494 launch a command prompt with the appropriate compiler paths automatically
497 - [NASM](http://www.nasm.us/) 0.98 or later (NASM 2.05 or later is required for
500 - If building the TurboJPEG Java wrapper, JDK 1.5 or later is required. This
501 can be downloaded from http://www.java.com.
507 Binary objects, libraries, and executables are generated in the same directory
508 from which `cmake` was executed (the "binary directory"), and this directory
509 need not necessarily be the same as the libjpeg-turbo source directory. You
510 can create multiple independent binary directories, in which different versions
511 of libjpeg-turbo can be built from the same source tree using different
512 compilers or settings. In the sections below, *{build_directory}* refers to
513 the binary directory, whereas *{source_directory}* refers to the libjpeg-turbo
514 source directory. For in-tree builds, these directories are the same.
517 Building libjpeg-turbo
518 ----------------------
521 ### Visual C++ (Command Line)
524 cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release {source_directory}
527 This will build either a 32-bit or a 64-bit version of libjpeg-turbo, depending
528 on which version of cl.exe is in the `PATH`.
530 The following files will be generated under *{build_directory}*:
533 Static link library for the libjpeg API
535 **sharedlib/jpeg{version}.dll**
536 DLL for the libjpeg API
538 **sharedlib/jpeg.lib**
539 Import library for the libjpeg API
541 **turbojpeg-static.lib**
542 Static link library for the TurboJPEG API
545 DLL for the TurboJPEG API
548 Import library for the TurboJPEG API
550 *{version}* is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or
551 v8 emulation is enabled.
556 Choose the appropriate CMake generator option for your version of Visual Studio
557 (run `cmake` with no arguments for a list of available generators.) For
561 cmake -G "Visual Studio 10" {source_directory}
563 NOTE: Add "Win64" to the generator name (for example, "Visual Studio 10
564 Win64") to build a 64-bit version of libjpeg-turbo. Recent versions of CMake
565 no longer document that. A separate build directory must be used for 32-bit
568 You can then open ALL_BUILD.vcproj in Visual Studio and build one of the
569 configurations in that project ("Debug", "Release", etc.) to generate a full
570 build of libjpeg-turbo.
572 This will generate the following files under *{build_directory}*:
574 **{configuration}/jpeg-static.lib**
575 Static link library for the libjpeg API
577 **sharedlib/{configuration}/jpeg{version}.dll**
578 DLL for the libjpeg API
580 **sharedlib/{configuration}/jpeg.lib**
581 Import library for the libjpeg API
583 **{configuration}/turbojpeg-static.lib**
584 Static link library for the TurboJPEG API
586 **{configuration}/turbojpeg.dll**
587 DLL for the TurboJPEG API
589 **{configuration}/turbojpeg.lib**
590 Import library for the TurboJPEG API
592 *{configuration}* is Debug, Release, RelWithDebInfo, or MinSizeRel, depending
593 on the configuration you built in the IDE, and *{version}* is 62, 7, or 8,
594 depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled.
599 NOTE: This assumes that you are building on a Windows machine. If you are
600 cross-compiling on a Linux/Unix machine, then see "Build Recipes" below.
603 cmake -G "MinGW Makefiles" {source_directory}
606 This will generate the following files under *{build_directory}*:
609 Static link library for the libjpeg API
611 **sharedlib/libjpeg-{version}.dll**
612 DLL for the libjpeg API
614 **sharedlib/libjpeg.dll.a**
615 Import library for the libjpeg API
618 Static link library for the TurboJPEG API
621 DLL for the TurboJPEG API
623 **libturbojpeg.dll.a**
624 Import library for the TurboJPEG API
626 *{version}* is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or
627 v8 emulation is enabled.
632 Add `-DCMAKE_BUILD_TYPE=Debug` to the `cmake` command line. Or, if building
633 with NMake, remove `-DCMAKE_BUILD_TYPE=Release` (Debug builds are the default
637 ### libjpeg v7 or v8 API/ABI Emulation
639 Add `-DWITH_JPEG7=1` to the `cmake` command line to build a version of
640 libjpeg-turbo that is API/ABI-compatible with libjpeg v7. Add `-DWITH_JPEG8=1`
641 to the `cmake` command line to build a version of libjpeg-turbo that is
642 API/ABI-compatible with libjpeg v8. See [README.md](README.md) for more
643 information on libjpeg v7 and v8 emulation.
646 ### In-Memory Source/Destination Managers
648 When using libjpeg v6b or v7 API/ABI emulation, add `-DWITH_MEM_SRCDST=0` to
649 the `cmake` command line to build a version of libjpeg-turbo that lacks the
650 `jpeg_mem_src()` and `jpeg_mem_dest()` functions. These functions were not
651 part of the original libjpeg v6b and v7 APIs, so removing them ensures strict
652 conformance with those APIs. See [README.md](README.md) for more information.
655 ### Arithmetic Coding Support
657 Since the patent on arithmetic coding has expired, this functionality has been
658 included in this release of libjpeg-turbo. libjpeg-turbo's implementation is
659 based on the implementation in libjpeg v8, but it works when emulating libjpeg
660 v7 or v6b as well. The default is to enable both arithmetic encoding and
661 decoding, but those who have philosophical objections to arithmetic coding can
662 add `-DWITH_ARITH_ENC=0` or `-DWITH_ARITH_DEC=0` to the `cmake` command line to
663 disable encoding or decoding (respectively.)
666 ### TurboJPEG Java Wrapper
668 Add `-DWITH_JAVA=1` to the `cmake` command line to incorporate an optional Java
669 Native Interface wrapper into the TurboJPEG shared library and build the Java
670 front-end classes to support it. This allows the TurboJPEG shared library to
671 be used directly from Java applications. See [java/README](java/README) for
674 If you are using CMake 2.8, you can set the `Java_JAVAC_EXECUTABLE`,
675 `Java_JAVA_EXECUTABLE`, and `Java_JAR_EXECUTABLE` CMake variables to specify
676 alternate commands or locations for javac, jar, and java (respectively.) You
677 can also set the `JAVACFLAGS` CMake variable to specify arguments that should
678 be passed to the Java compiler when building the front-end classes.
681 Installing libjpeg-turbo
682 ------------------------
684 You can use the build system to install libjpeg-turbo into a directory of your
685 choosing (as opposed to creating an installer.) To do this, add:
687 -DCMAKE_INSTALL_PREFIX={install_directory}
689 to the cmake command line.
693 cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release \
694 -DCMAKE_INSTALL_PREFIX=c:\libjpeg-turbo {source_directory}
697 will install the header files in c:\libjpeg-turbo\include, the library files
698 in c:\libjpeg-turbo\lib, the DLL's in c:\libjpeg-turbo\bin, and the
699 documentation in c:\libjpeg-turbo\doc.
706 ### 64-bit MinGW Build on Cygwin
709 CC=/usr/bin/x86_64-w64-mingw32-gcc \
710 cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
711 -DCMAKE_RC_COMPILER=/usr/bin/x86_64-w64-mingw32-windres.exe \
715 This produces a 64-bit build of libjpeg-turbo that does not depend on
716 cygwin1.dll or other Cygwin DLL's. The mingw64-x86\_64-gcc-core and
717 mingw64-x86\_64-gcc-g++ packages (and their dependencies) must be installed.
720 ### 32-bit MinGW Build on Cygwin
723 CC=/usr/bin/i686-w64-mingw32-gcc \
724 cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
725 -DCMAKE_RC_COMPILER=/usr/bin/i686-w64-mingw32-windres.exe \
729 This produces a 32-bit build of libjpeg-turbo that does not depend on
730 cygwin1.dll or other Cygwin DLL's. The mingw64-i686-gcc-core and
731 mingw64-i686-gcc-g++ packages (and their dependencies) must be installed.
734 ### MinGW Build on Linux
737 CC={mingw_binary_path}/i386-mingw32-gcc \
738 cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
739 -DCMAKE_AR={mingw_binary_path}/i386-mingw32-ar \
740 -DCMAKE_RANLIB={mingw_binary_path}/i386-mingw32-ranlib \
745 Creating Release Packages
746 =========================
748 The following commands can be used to create various types of release packages:
756 Create Red Hat-style binary RPM package. Requires RPM v4 or later.
760 This runs `make dist` to create a pristine source tarball, then creates a
761 Red Hat-style source RPM package from the tarball. Requires RPM v4 or later.
765 Create Debian-style binary package. Requires dpkg.
769 Create Macintosh package/disk image. This requires pkgbuild and
770 productbuild, which are installed by default on OS X 10.7 and later and which
771 can be obtained by installing Xcode 3.2.6 (with the "Unix Development"
772 option) on OS X 10.6. Packages built in this manner can be installed on OS X
773 10.5 and later, but they must be built on OS X 10.6 or later.
775 make udmg [BUILDDIR32={32-bit build directory}]
777 On 64-bit OS X systems, this creates a Macintosh package and disk image that
778 contains universal i386/x86-64 binaries. You should first configure a 32-bit
779 out-of-tree build of libjpeg-turbo, then configure a 64-bit out-of-tree
780 build, then run `make udmg` from the 64-bit build directory. The build
781 system will look for the 32-bit build under *{source_directory}*/osxx86 by
782 default, but you can override this by setting the `BUILDDIR32` variable on the
783 make command line as shown above.
785 make iosdmg [BUILDDIR32={32-bit build directory}] \
786 [BUILDDIRARMV6={ARMv6 build directory}] \
787 [BUILDDIRARMV7={ARMv7 build directory}] \
788 [BUILDDIRARMV7S={ARMv7s build directory}] \
789 [BUILDDIRARMV8={ARMv8 build directory}]
791 On OS X systems, this creates a Macintosh package and disk image in which the
792 libjpeg-turbo static libraries contain ARM architectures necessary to build
793 iOS applications. If building on an x86-64 system, the binaries will also
794 contain the i386 architecture, as with `make udmg` above. You should first
795 configure ARMv6, ARMv7, ARMv7s, and/or ARMv8 out-of-tree builds of
796 libjpeg-turbo (see "Building libjpeg-turbo for iOS" above.) If you are
797 building an x86-64 version of libjpeg-turbo, you should configure a 32-bit
798 out-of-tree build as well. Next, build libjpeg-turbo as you would normally,
799 using an out-of-tree build. When it is built, run `make iosdmg` from the
800 build directory. The build system will look for the ARMv6 build under
801 *{source_directory}*/iosarmv6 by default, the ARMv7 build under
802 *{source_directory}*/iosarmv7 by default, the ARMv7s build under
803 *{source_directory}*/iosarmv7s by default, the ARMv8 build under
804 *{source_directory}*/iosarmv8 by default, and (if applicable) the 32-bit build
805 under *{source_directory}*/osxx86 by default, but you can override this by
806 setting the `BUILDDIR32`, `BUILDDIRARMV6`, `BUILDDIRARMV7`, `BUILDDIRARMV7S`,
807 and/or `BUILDDIRARMV8` variables on the `make` command line as shown above.
809 NOTE: If including an ARMv8 build in the package, then you may need to use
810 Xcode's version of lipo instead of the operating system's. To do this, pass
811 an argument of `LIPO="xcrun lipo"` on the make command line.
815 Build a Cygwin binary package.
831 If using the Visual Studio IDE, build the "installer" project.
833 The installer package (libjpeg-turbo[-gcc][64].exe) will be located under
834 *{build_directory}*. If building using the Visual Studio IDE, then the
835 installer package will be located in a subdirectory with the same name as the
836 configuration you built (such as *{build_directory}*\Debug\ or
837 *{build_directory}*\Release\).
839 Building a Windows installer requires the Nullsoft Install System
840 (http://nsis.sourceforge.net/.) makensis.exe should be in your `PATH`.
846 The most common way to test libjpeg-turbo is by invoking `make test` on
847 Unix/Linux platforms or `ctest` on Windows platforms, once the build has
848 completed. This runs a series of tests to ensure that mathematical
849 compatibility has been maintained between libjpeg-turbo and libjpeg v6b. This
850 also invokes the TurboJPEG unit tests, which ensure that the colorspace
851 extensions, YUV encoding, decompression scaling, and other features of the
852 TurboJPEG C and Java APIs are working properly (and, by extension, that the
853 equivalent features of the underlying libjpeg API are also working.)
855 Invoking `make testclean` or `nmake testclean` (if using NMake) or building
856 the 'testclean' target (if using the Visual Studio IDE) will clean up the
857 output images generated by `make test`.
859 On Unix/Linux platforms, more extensive tests of the TurboJPEG C and Java
860 wrappers can be run by invoking `make tjtest`. These extended TurboJPEG tests
861 essentially iterate through all of the available features of the TurboJPEG APIs
862 that are not covered by the TurboJPEG unit tests (this includes the lossless
863 transform options) and compare the images generated by each feature to images
864 generated using the equivalent feature in the libjpeg API. The extended
865 TurboJPEG tests are meant to test for regressions in the TurboJPEG wrappers,
866 not in the underlying libjpeg API library.