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"}
418 TOOLCHAIN_VERSION={"4.6", "4.8", etc. This corresponds to a toolchain
419 directory under ${NDK_PATH}/toolchains/.}
420 ANDROID_VERSION={The minimum version of Android to support-- for example,
423 HOST=arm-linux-androideabi
424 TOOLCHAIN=${NDK_PATH}/toolchains/${HOST}-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}
425 SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-arm
426 ANDROID_INCLUDES="-I${SYSROOT}/usr/include -I${TOOLCHAIN}/include"
427 ANDROID_CFLAGS="-march=armv7-a -mfloat-abi=softfp -fprefetch-loop-arrays \
428 -fstrict-aliasing --sysroot=${SYSROOT}"
429 export CPP=${TOOLCHAIN}/bin/${HOST}-cpp
430 export AR=${TOOLCHAIN}/bin/${HOST}-ar
431 export AS=${TOOLCHAIN}/bin/${HOST}-as
432 export NM=${TOOLCHAIN}/bin/${HOST}-nm
433 export CC=${TOOLCHAIN}/bin/${HOST}-gcc
434 export LD=${TOOLCHAIN}/bin/${HOST}-ld
435 export RANLIB=${TOOLCHAIN}/bin/${HOST}-ranlib
436 export OBJDUMP=${TOOLCHAIN}/bin/${HOST}-objdump
437 export STRIP=${TOOLCHAIN}/bin/${HOST}-strip
439 sh {source_directory}/configure --host=${HOST} \
440 CFLAGS="${ANDROID_INCLUDES} ${ANDROID_CFLAGS} -O3" \
441 CPPFLAGS="${ANDROID_INCLUDES} ${ANDROID_CFLAGS}" \
442 LDFLAGS="${ANDROID_CFLAGS}" --with-simd ${1+"$@"}
446 Building on Windows (Visual C++ or MinGW)
447 =========================================
453 - [CMake](http://www.cmake.org) v2.8.8 or later
455 - Microsoft Visual C++ 2005 or later
457 If you don't already have Visual C++, then the easiest way to get it is by
458 installing the Windows SDK:
460 http://msdn.microsoft.com/en-us/windows/bb980924.aspx
462 The Windows SDK includes both 32-bit and 64-bit Visual C++ compilers and
463 everything necessary to build libjpeg-turbo.
465 * You can also use Microsoft Visual Studio Express Edition, which is a free
466 download. (NOTE: versions prior to 2012 can only be used to build 32-bit
468 * If you intend to build libjpeg-turbo from the command line, then add the
469 appropriate compiler and SDK directories to the `INCLUDE`, `LIB`, and
470 `PATH` environment variables. This is generally accomplished by
471 executing `vcvars32.bat` or `vcvars64.bat` and `SetEnv.cmd`.
472 `vcvars32.bat` and `vcvars64.bat` are part of Visual C++ and are located in
473 the same directory as the compiler. `SetEnv.cmd` is part of the Windows
474 SDK. You can pass optional arguments to `SetEnv.cmd` to specify a 32-bit
475 or 64-bit build environment.
481 MinGW-builds (http://sourceforge.net/projects/mingwbuilds/) or
482 tdm-gcc (http://tdm-gcc.tdragon.net/) recommended if building on a Windows
483 machine. Both distributions install a Start Menu link that can be used to
484 launch a command prompt with the appropriate compiler paths automatically
487 - [NASM](http://www.nasm.us/) 0.98 or later (NASM 2.05 or later is required for
490 - If building the TurboJPEG Java wrapper, JDK 1.5 or later is required. This
491 can be downloaded from http://www.java.com.
497 Binary objects, libraries, and executables are generated in the same directory
498 from which `cmake` was executed (the "binary directory"), and this directory
499 need not necessarily be the same as the libjpeg-turbo source directory. You
500 can create multiple independent binary directories, in which different versions
501 of libjpeg-turbo can be built from the same source tree using different
502 compilers or settings. In the sections below, *{build_directory}* refers to
503 the binary directory, whereas *{source_directory}* refers to the libjpeg-turbo
504 source directory. For in-tree builds, these directories are the same.
507 Building libjpeg-turbo
508 ----------------------
511 ### Visual C++ (Command Line)
514 cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release {source_directory}
517 This will build either a 32-bit or a 64-bit version of libjpeg-turbo, depending
518 on which version of cl.exe is in the `PATH`.
520 The following files will be generated under *{build_directory}*:
523 Static link library for the libjpeg API
525 **sharedlib/jpeg{version}.dll**
526 DLL for the libjpeg API
528 **sharedlib/jpeg.lib**
529 Import library for the libjpeg API
531 **turbojpeg-static.lib**
532 Static link library for the TurboJPEG API
535 DLL for the TurboJPEG API
538 Import library for the TurboJPEG API
540 *{version}* is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or
541 v8 emulation is enabled.
546 Choose the appropriate CMake generator option for your version of Visual Studio
547 (run `cmake` with no arguments for a list of available generators.) For
551 cmake -G "Visual Studio 10" {source_directory}
553 NOTE: Add "Win64" to the generator name (for example, "Visual Studio 10
554 Win64") to build a 64-bit version of libjpeg-turbo. Recent versions of CMake
555 no longer document that. A separate build directory must be used for 32-bit
558 You can then open ALL_BUILD.vcproj in Visual Studio and build one of the
559 configurations in that project ("Debug", "Release", etc.) to generate a full
560 build of libjpeg-turbo.
562 This will generate the following files under *{build_directory}*:
564 **{configuration}/jpeg-static.lib**
565 Static link library for the libjpeg API
567 **sharedlib/{configuration}/jpeg{version}.dll**
568 DLL for the libjpeg API
570 **sharedlib/{configuration}/jpeg.lib**
571 Import library for the libjpeg API
573 **{configuration}/turbojpeg-static.lib**
574 Static link library for the TurboJPEG API
576 **{configuration}/turbojpeg.dll**
577 DLL for the TurboJPEG API
579 **{configuration}/turbojpeg.lib**
580 Import library for the TurboJPEG API
582 *{configuration}* is Debug, Release, RelWithDebInfo, or MinSizeRel, depending
583 on the configuration you built in the IDE, and *{version}* is 62, 7, or 8,
584 depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled.
589 NOTE: This assumes that you are building on a Windows machine. If you are
590 cross-compiling on a Linux/Unix machine, then see "Build Recipes" below.
593 cmake -G "MinGW Makefiles" {source_directory}
596 This will generate the following files under *{build_directory}*:
599 Static link library for the libjpeg API
601 **sharedlib/libjpeg-{version}.dll**
602 DLL for the libjpeg API
604 **sharedlib/libjpeg.dll.a**
605 Import library for the libjpeg API
608 Static link library for the TurboJPEG API
611 DLL for the TurboJPEG API
613 **libturbojpeg.dll.a**
614 Import library for the TurboJPEG API
616 *{version}* is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or
617 v8 emulation is enabled.
622 Add `-DCMAKE_BUILD_TYPE=Debug` to the `cmake` command line. Or, if building
623 with NMake, remove `-DCMAKE_BUILD_TYPE=Release` (Debug builds are the default
627 ### libjpeg v7 or v8 API/ABI Emulation
629 Add `-DWITH_JPEG7=1` to the `cmake` command line to build a version of
630 libjpeg-turbo that is API/ABI-compatible with libjpeg v7. Add `-DWITH_JPEG8=1`
631 to the `cmake` command line to build a version of libjpeg-turbo that is
632 API/ABI-compatible with libjpeg v8. See [README.md](README.md) for more
633 information on libjpeg v7 and v8 emulation.
636 ### In-Memory Source/Destination Managers
638 When using libjpeg v6b or v7 API/ABI emulation, add `-DWITH_MEM_SRCDST=0` to
639 the `cmake` command line to build a version of libjpeg-turbo that lacks the
640 `jpeg_mem_src()` and `jpeg_mem_dest()` functions. These functions were not
641 part of the original libjpeg v6b and v7 APIs, so removing them ensures strict
642 conformance with those APIs. See [README.md](README.md) for more information.
645 ### Arithmetic Coding Support
647 Since the patent on arithmetic coding has expired, this functionality has been
648 included in this release of libjpeg-turbo. libjpeg-turbo's implementation is
649 based on the implementation in libjpeg v8, but it works when emulating libjpeg
650 v7 or v6b as well. The default is to enable both arithmetic encoding and
651 decoding, but those who have philosophical objections to arithmetic coding can
652 add `-DWITH_ARITH_ENC=0` or `-DWITH_ARITH_DEC=0` to the `cmake` command line to
653 disable encoding or decoding (respectively.)
656 ### TurboJPEG Java Wrapper
658 Add `-DWITH_JAVA=1` to the `cmake` command line to incorporate an optional Java
659 Native Interface wrapper into the TurboJPEG shared library and build the Java
660 front-end classes to support it. This allows the TurboJPEG shared library to
661 be used directly from Java applications. See [java/README](java/README) for
664 If you are using CMake 2.8, you can set the `Java_JAVAC_EXECUTABLE`,
665 `Java_JAVA_EXECUTABLE`, and `Java_JAR_EXECUTABLE` CMake variables to specify
666 alternate commands or locations for javac, jar, and java (respectively.) You
667 can also set the `JAVACFLAGS` CMake variable to specify arguments that should
668 be passed to the Java compiler when building the front-end classes.
671 Installing libjpeg-turbo
672 ------------------------
674 You can use the build system to install libjpeg-turbo into a directory of your
675 choosing (as opposed to creating an installer.) To do this, add:
677 -DCMAKE_INSTALL_PREFIX={install_directory}
679 to the cmake command line.
683 cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release \
684 -DCMAKE_INSTALL_PREFIX=c:\libjpeg-turbo {source_directory}
687 will install the header files in c:\libjpeg-turbo\include, the library files
688 in c:\libjpeg-turbo\lib, the DLL's in c:\libjpeg-turbo\bin, and the
689 documentation in c:\libjpeg-turbo\doc.
696 ### 64-bit MinGW Build on Cygwin
699 CC=/usr/bin/x86_64-w64-mingw32-gcc \
700 cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
701 -DCMAKE_RC_COMPILER=/usr/bin/x86_64-w64-mingw32-windres.exe \
705 This produces a 64-bit build of libjpeg-turbo that does not depend on
706 cygwin1.dll or other Cygwin DLL's. The mingw64-x86\_64-gcc-core and
707 mingw64-x86\_64-gcc-g++ packages (and their dependencies) must be installed.
710 ### 32-bit MinGW Build on Cygwin
713 CC=/usr/bin/i686-w64-mingw32-gcc \
714 cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
715 -DCMAKE_RC_COMPILER=/usr/bin/i686-w64-mingw32-windres.exe \
719 This produces a 32-bit build of libjpeg-turbo that does not depend on
720 cygwin1.dll or other Cygwin DLL's. The mingw64-i686-gcc-core and
721 mingw64-i686-gcc-g++ packages (and their dependencies) must be installed.
724 ### MinGW Build on Linux
727 CC={mingw_binary_path}/i386-mingw32-gcc \
728 cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
729 -DCMAKE_AR={mingw_binary_path}/i386-mingw32-ar \
730 -DCMAKE_RANLIB={mingw_binary_path}/i386-mingw32-ranlib \
735 Creating Release Packages
736 =========================
738 The following commands can be used to create various types of release packages:
746 Create Red Hat-style binary RPM package. Requires RPM v4 or later.
750 This runs `make dist` to create a pristine source tarball, then creates a
751 Red Hat-style source RPM package from the tarball. Requires RPM v4 or later.
755 Create Debian-style binary package. Requires dpkg.
759 Create Macintosh package/disk image. This requires pkgbuild and
760 productbuild, which are installed by default on OS X 10.7 and later and which
761 can be obtained by installing Xcode 3.2.6 (with the "Unix Development"
762 option) on OS X 10.6. Packages built in this manner can be installed on OS X
763 10.5 and later, but they must be built on OS X 10.6 or later.
765 make udmg [BUILDDIR32={32-bit build directory}]
767 On 64-bit OS X systems, this creates a Macintosh package and disk image that
768 contains universal i386/x86-64 binaries. You should first configure a 32-bit
769 out-of-tree build of libjpeg-turbo, then configure a 64-bit out-of-tree
770 build, then run `make udmg` from the 64-bit build directory. The build
771 system will look for the 32-bit build under *{source_directory}*/osxx86 by
772 default, but you can override this by setting the `BUILDDIR32` variable on the
773 make command line as shown above.
775 make iosdmg [BUILDDIR32={32-bit build directory}] \
776 [BUILDDIRARMV6={ARMv6 build directory}] \
777 [BUILDDIRARMV7={ARMv7 build directory}] \
778 [BUILDDIRARMV7S={ARMv7s build directory}] \
779 [BUILDDIRARMV8={ARMv8 build directory}]
781 On OS X systems, this creates a Macintosh package and disk image in which the
782 libjpeg-turbo static libraries contain ARM architectures necessary to build
783 iOS applications. If building on an x86-64 system, the binaries will also
784 contain the i386 architecture, as with `make udmg` above. You should first
785 configure ARMv6, ARMv7, ARMv7s, and/or ARMv8 out-of-tree builds of
786 libjpeg-turbo (see "Building libjpeg-turbo for iOS" above.) If you are
787 building an x86-64 version of libjpeg-turbo, you should configure a 32-bit
788 out-of-tree build as well. Next, build libjpeg-turbo as you would normally,
789 using an out-of-tree build. When it is built, run `make iosdmg` from the
790 build directory. The build system will look for the ARMv6 build under
791 *{source_directory}*/iosarmv6 by default, the ARMv7 build under
792 *{source_directory}*/iosarmv7 by default, the ARMv7s build under
793 *{source_directory}*/iosarmv7s by default, the ARMv8 build under
794 *{source_directory}*/iosarmv8 by default, and (if applicable) the 32-bit build
795 under *{source_directory}*/osxx86 by default, but you can override this by
796 setting the `BUILDDIR32`, `BUILDDIRARMV6`, `BUILDDIRARMV7`, `BUILDDIRARMV7S`,
797 and/or `BUILDDIRARMV8` variables on the `make` command line as shown above.
799 NOTE: If including an ARMv8 build in the package, then you may need to use
800 Xcode's version of lipo instead of the operating system's. To do this, pass
801 an argument of `LIPO="xcrun lipo"` on the make command line.
805 Build a Cygwin binary package.
821 If using the Visual Studio IDE, build the "installer" project.
823 The installer package (libjpeg-turbo[-gcc][64].exe) will be located under
824 *{build_directory}*. If building using the Visual Studio IDE, then the
825 installer package will be located in a subdirectory with the same name as the
826 configuration you built (such as *{build_directory}*\Debug\ or
827 *{build_directory}*\Release\).
829 Building a Windows installer requires the Nullsoft Install System
830 (http://nsis.sourceforge.net/.) makensis.exe should be in your `PATH`.
836 The most common way to test libjpeg-turbo is by invoking `make test` on
837 Unix/Linux platforms or `ctest` on Windows platforms, once the build has
838 completed. This runs a series of tests to ensure that mathematical
839 compatibility has been maintained between libjpeg-turbo and libjpeg v6b. This
840 also invokes the TurboJPEG unit tests, which ensure that the colorspace
841 extensions, YUV encoding, decompression scaling, and other features of the
842 TurboJPEG C and Java APIs are working properly (and, by extension, that the
843 equivalent features of the underlying libjpeg API are also working.)
845 Invoking `make testclean` or `nmake testclean` (if using NMake) or building
846 the 'testclean' target (if using the Visual Studio IDE) will clean up the
847 output images generated by `make test`.
849 On Unix/Linux platforms, more extensive tests of the TurboJPEG C and Java
850 wrappers can be run by invoking `make tjtest`. These extended TurboJPEG tests
851 essentially iterate through all of the available features of the TurboJPEG APIs
852 that are not covered by the TurboJPEG unit tests (this includes the lossless
853 transform options) and compare the images generated by each feature to images
854 generated using the equivalent feature in the libjpeg API. The extended
855 TurboJPEG tests are meant to test for regressions in the TurboJPEG wrappers,
856 not in the underlying libjpeg API library.