blob: 1976f2bc0fe5dfe83e4e7a8e318cfffd33c54315 [file] [log] [blame]
DRC68fef832010-02-16 05:29:10 +00001*******************************************************************************
DRC81543312010-10-18 07:23:58 +00002** Building on Unix Platforms (including Cygwin)
DRC68fef832010-02-16 05:29:10 +00003*******************************************************************************
4
DRCcc243742010-10-16 09:22:43 +00005
DRC68fef832010-02-16 05:29:10 +00006==================
7Build Requirements
8==================
9
10-- autoconf 2.56 or later
DRC68fef832010-02-16 05:29:10 +000011-- automake 1.7 or later
DRC68fef832010-02-16 05:29:10 +000012-- libtool 1.4 or later
DRC68fef832010-02-16 05:29:10 +000013
DRC94755ce2011-10-19 05:13:27 +000014-- NASM (if building x86 or x86-64 SIMD extensions)
DRC254937b2011-04-16 13:35:35 +000015 * 0.98, or 2.01 or later is required for a 32-bit build
16 * NASM 2.00 or later is required for a 64-bit build
DRC9026b372011-04-16 13:37:22 +000017 * NASM 2.07 or later is required for a 64-bit build on OS X. This can be
DRC0dedd1a2010-07-02 09:20:12 +000018 obtained from MacPorts (http://www.macports.org/).
DRC68fef832010-02-16 05:29:10 +000019
DRC254937b2011-04-16 13:35:35 +000020 The binary RPMs released by the NASM project do not work on older Linux
21 systems, such as Red Hat Enterprise Linux 4. On such systems, you can
22 easily build and install NASM from a source RPM by downloading one of the
23 SRPMs from
24
25 http://www.nasm.us/pub/nasm/releasebuilds
26
27 and executing the following as root:
DRC68fef832010-02-16 05:29:10 +000028
29 ARCH=`uname -m`
DRC254937b2011-04-16 13:35:35 +000030 rpmbuild --rebuild nasm-{version}.src.rpm
31 rpm -Uvh /usr/src/redhat/RPMS/$ARCH/nasm-{version}.$ARCH.rpm
DRC68fef832010-02-16 05:29:10 +000032
DRC254937b2011-04-16 13:35:35 +000033 NOTE: the NASM build will fail if texinfo is not installed.
DRCc3f4ac02010-02-19 21:51:26 +000034
DRC8f870c22010-02-24 00:30:00 +000035-- GCC v4.1 or later recommended for best performance
DRC68fef832010-02-16 05:29:10 +000036
DRC5039d732013-01-21 23:42:12 +000037-- If building the TurboJPEG Java wrapper, JDK or OpenJDK 1.5 or later is
DRC279bd342011-04-02 05:17:12 +000038 required. Some systems, such as OS X 10.4, Solaris 10 and later, and Red
39 Hat Enterprise Linux 5 and later, have this pre-installed. On OS X 10.5 and
40 later, it will be necessary to install the Java Developer Package, which can
41 be downloaded from http://connect.apple.com. For systems that do not have a
42 JDK installed, you can obtain the Oracle Java Development Kit from
43 http://www.java.com.
DRCf8e00552011-02-04 11:06:36 +000044
DRCcc243742010-10-16 09:22:43 +000045
46==================
47Out-of-Tree Builds
48==================
49
50Binary objects, libraries, and executables are generated in the same directory
51from which configure was executed (the "binary directory"), and this directory
52need not necessarily be the same as the libjpeg-turbo source directory. You
53can create multiple independent binary directories, in which different versions
54of libjpeg-turbo can be built from the same source tree using different
55compilers or settings. In the sections below, {build_directory} refers to the
56binary directory, whereas {source_directory} refers to the libjpeg-turbo source
57directory. For in-tree builds, these directories are the same.
58
59
DRC68fef832010-02-16 05:29:10 +000060======================
61Building libjpeg-turbo
62======================
63
DRC5039d732013-01-21 23:42:12 +000064The following procedure will build libjpeg-turbo on Linux, FreeBSD, Cygwin, and
65Solaris/x86 systems (on Solaris, this generates a 32-bit library. See below
66for 64-bit build instructions.)
DRC68fef832010-02-16 05:29:10 +000067
DRCcc243742010-10-16 09:22:43 +000068 cd {source_directory}
DRC68fef832010-02-16 05:29:10 +000069 autoreconf -fiv
DRCcc243742010-10-16 09:22:43 +000070 cd {build_directory}
DRC98dbe912010-11-04 22:22:30 +000071 sh {source_directory}/configure [additional configure flags]
DRC68fef832010-02-16 05:29:10 +000072 make
73
DRCfde862b2013-02-11 03:38:53 +000074NOTE: Running autoreconf in the source directory is usually only necessary if
75building libjpeg-turbo from the SVN repository.
DRC68fef832010-02-16 05:29:10 +000076
77This will generate the following files under .libs/
78
79 libjpeg.a
DRC5039d732013-01-21 23:42:12 +000080 Static link library for the libjpeg API
DRC68fef832010-02-16 05:29:10 +000081
DRC5039d732013-01-21 23:42:12 +000082 libjpeg.so.{version} (Linux, Unix)
DRCcc243742010-10-16 09:22:43 +000083 libjpeg.{version}.dylib (OS X)
DRC81543312010-10-18 07:23:58 +000084 cygjpeg-{version}.dll (Cygwin)
DRC5039d732013-01-21 23:42:12 +000085 Shared library for the libjpeg API
DRC68fef832010-02-16 05:29:10 +000086
DRC5039d732013-01-21 23:42:12 +000087 By default, {version} is 62.1.0, 7.1.0, or 8.0.2, depending on whether
88 libjpeg v6b (default), v7, or v8 emulation is enabled. If using Cygwin,
89 {version} is 62, 7, or 8.
90
91 libjpeg.so (Linux, Unix)
DRC68fef832010-02-16 05:29:10 +000092 libjpeg.dylib (OS X)
DRC5039d732013-01-21 23:42:12 +000093 Development symlink for the libjpeg API
94
DRC81543312010-10-18 07:23:58 +000095 libjpeg.dll.a (Cygwin)
DRC5039d732013-01-21 23:42:12 +000096 Import library for the libjpeg API
DRC68fef832010-02-16 05:29:10 +000097
98 libturbojpeg.a
DRC5039d732013-01-21 23:42:12 +000099 Static link library for the TurboJPEG API
DRC68fef832010-02-16 05:29:10 +0000100
DRC5039d732013-01-21 23:42:12 +0000101 libturbojpeg.so.0.0.0 (Linux, Unix)
102 libturbojpeg.0.0.0.dylib (OS X)
103 cygturbojpeg-0.dll (Cygwin)
104 Shared library for the TurboJPEG API
105
106 libturbojpeg.so (Linux, Unix)
DRC68fef832010-02-16 05:29:10 +0000107 libturbojpeg.dylib (OS X)
DRC5039d732013-01-21 23:42:12 +0000108 Development symlink for the TurboJPEG API
DRC81543312010-10-18 07:23:58 +0000109
110 libturbojpeg.dll.a (Cygwin)
DRC5039d732013-01-21 23:42:12 +0000111 Import library for the TurboJPEG API
DRC81543312010-10-18 07:23:58 +0000112
113
DRC30913542012-01-27 09:53:33 +0000114libjpeg v7 or v8 API/ABI Emulation
115----------------------------------
DRC81543312010-10-18 07:23:58 +0000116
117Add --with-jpeg7 to the configure command line to build a version of
DRC30913542012-01-27 09:53:33 +0000118libjpeg-turbo that is API/ABI-compatible with libjpeg v7. Add --with-jpeg8 to
119the configure command to build a version of libjpeg-turbo that is
120API/ABI-compatible with libjpeg v8. See README-turbo.txt for more information
121on libjpeg v7 and v8 emulation.
DRC81543312010-10-18 07:23:58 +0000122
DRC68fef832010-02-16 05:29:10 +0000123
DRC5039d732013-01-21 23:42:12 +0000124In-Memory Source/Destination Managers
125-------------------------------------
126
127When using libjpeg v6b or v7 API/ABI emulation, add --without-mem-srcdst to the
128configure command line to build a version of libjpeg-turbo that lacks the
129jpeg_mem_src() and jpeg_mem_dest() functions. These functions were not part of
130the original libjpeg v6b and v7 APIs, so removing them ensures strict
131conformance with those APIs. See README-turbo.txt for more information.
132
133
DRC245cfdf2010-11-23 17:11:06 +0000134Arithmetic Coding Support
135-------------------------
136
137Since the patent on arithmetic coding has expired, this functionality has been
138included in this release of libjpeg-turbo. libjpeg-turbo's implementation is
DRCf38eee02011-02-18 07:00:38 +0000139based on the implementation in libjpeg v8, but it works when emulating libjpeg
DRC245cfdf2010-11-23 17:11:06 +0000140v7 or v6b as well. The default is to enable both arithmetic encoding and
141decoding, but those who have philosophical objections to arithmetic coding can
142add --without-arith-enc or --without-arith-dec to the configure command line to
143disable encoding or decoding (respectively.)
144
DRC68fef832010-02-16 05:29:10 +0000145
DRC5039d732013-01-21 23:42:12 +0000146TurboJPEG Java Wrapper
147----------------------
DRC88f54a42011-04-01 01:21:22 +0000148Add --with-java to the configure command line to incorporate an optional Java
DRC5039d732013-01-21 23:42:12 +0000149Native Interface wrapper into the TurboJPEG shared library and build the Java
150front-end classes to support it. This allows the TurboJPEG shared library to
151be used directly from Java applications. See java/README for more details.
DRC88f54a42011-04-01 01:21:22 +0000152
153You can set the JAVAC, JAR, and JAVA configure variables to specify
154alternate commands for javac, jar, and java (respectively.) You can also
155set the JAVACFLAGS configure variable to specify arguments that should be
156passed to the Java compiler when building the front-end classes, and JNI_CFLAGS
157to specify arguments that should be passed to the C compiler when building the
158JNI wrapper. Run 'configure --help' for more details.
DRCf8e00552011-02-04 11:06:36 +0000159
160
DRC68fef832010-02-16 05:29:10 +0000161========================
162Installing libjpeg-turbo
163========================
164
165If you intend to install these libraries and the associated header files, then
166replace 'make' in the instructions above with
167
168 make install prefix={base dir} libdir={library directory}
169
170For example,
171
172 make install prefix=/usr/local libdir=/usr/local/lib64
173
174will install the header files in /usr/local/include and the library files in
175/usr/local/lib64. If 'prefix' and 'libdir' are not specified, then the default
176is to install the header files in /opt/libjpeg-turbo/include and the library
177files in /opt/libjpeg-turbo/lib.
178
179NOTE: You can specify a prefix of /usr and a libdir of, for instance,
180/usr/lib64 to overwrite the system's version of libjpeg. If you do this,
181however, then be sure to BACK UP YOUR SYSTEM'S INSTALLATION OF LIBJPEG before
182overwriting it. It is recommended that you instead install libjpeg-turbo into
DRC5039d732013-01-21 23:42:12 +0000183a non-system directory and manipulate the LD_LIBRARY_PATH or create symlinks
DRC68fef832010-02-16 05:29:10 +0000184to force applications to use libjpeg-turbo instead of libjpeg. See
185README-turbo.txt for more information.
186
DRCcc243742010-10-16 09:22:43 +0000187
DRC68fef832010-02-16 05:29:10 +0000188=============
189Build Recipes
190=============
191
DRCcc243742010-10-16 09:22:43 +0000192
DRC5039d732013-01-21 23:42:12 +000019332-bit Build on 64-bit Linux
194----------------------------
DRC68fef832010-02-16 05:29:10 +0000195
DRCca5e7d12010-02-17 02:25:06 +0000196Add
DRC68fef832010-02-16 05:29:10 +0000197
DRC2e4d0442011-02-08 01:18:37 +0000198 --host i686-pc-linux-gnu CFLAGS='-O3 -m32' LDFLAGS=-m32
DRC68fef832010-02-16 05:29:10 +0000199
200to the configure command line.
201
202
DRC5039d732013-01-21 23:42:12 +000020364-bit Build on 64-bit OS X
204---------------------------
DRC68fef832010-02-16 05:29:10 +0000205
DRCca5e7d12010-02-17 02:25:06 +0000206Add
DRC68fef832010-02-16 05:29:10 +0000207
DRC0dedd1a2010-07-02 09:20:12 +0000208 --host x86_64-apple-darwin NASM=/opt/local/bin/nasm
DRC68fef832010-02-16 05:29:10 +0000209
DRC7bac07b2010-04-10 05:53:35 +0000210to the configure command line. NASM 2.07 or later from MacPorts must be
211installed.
DRC68fef832010-02-16 05:29:10 +0000212
213
DRC5039d732013-01-21 23:42:12 +000021432-bit Build on 64-bit OS X
215---------------------------
DRC68fef832010-02-16 05:29:10 +0000216
DRCca5e7d12010-02-17 02:25:06 +0000217Add
DRC68fef832010-02-16 05:29:10 +0000218
DRC5950c5d2012-06-28 23:22:03 +0000219 --host i686-apple-darwin CFLAGS='-O3 -m32' LDFLAGS=-m32
DRC68fef832010-02-16 05:29:10 +0000220
221to the configure command line.
222
223
DRC5039d732013-01-21 23:42:12 +000022464-bit Backward-Compatible Build on 64-bit OS X
225-----------------------------------------------
DRC68fef832010-02-16 05:29:10 +0000226
DRCca5e7d12010-02-17 02:25:06 +0000227Add
DRC68fef832010-02-16 05:29:10 +0000228
DRC0dedd1a2010-07-02 09:20:12 +0000229 --host x86_64-apple-darwin NASM=/opt/local/bin/nasm \
230 CFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
231 -mmacosx-version-min=10.4 -O3' \
DRC0dedd1a2010-07-02 09:20:12 +0000232 LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
233 -mmacosx-version-min=10.4'
234
DRC575c3422010-07-08 07:01:20 +0000235to the configure command line. The OS X 10.4 SDK, and NASM 2.07 or later from
236MacPorts, must be installed.
DRC0dedd1a2010-07-02 09:20:12 +0000237
238
DRC5039d732013-01-21 23:42:12 +000023932-bit Backward-Compatible Build on OS X
240----------------------------------------
DRC0dedd1a2010-07-02 09:20:12 +0000241
242Add
243
DRC5950c5d2012-06-28 23:22:03 +0000244 --host i686-apple-darwin \
245 CFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
DRC485cd802010-02-23 23:23:42 +0000246 -mmacosx-version-min=10.4 -O3 -m32' \
DRC68fef832010-02-16 05:29:10 +0000247 LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
248 -mmacosx-version-min=10.4 -m32'
249
250to the configure command line. The OS X 10.4 SDK must be installed.
251
252
25364-bit Library Build on 64-bit Solaris
254--------------------------------------
255
DRCca5e7d12010-02-17 02:25:06 +0000256Add
DRC68fef832010-02-16 05:29:10 +0000257
DRC2e4d0442011-02-08 01:18:37 +0000258 --host x86_64-pc-solaris CFLAGS='-O3 -m64' LDFLAGS=-m64
DRC68fef832010-02-16 05:29:10 +0000259
260to the configure command line.
261
262
DRC5039d732013-01-21 23:42:12 +000026332-bit Build on 64-bit FreeBSD
264------------------------------
DRC7bac07b2010-04-10 05:53:35 +0000265
266Add
267
DRC2e4d0442011-02-08 01:18:37 +0000268 --host i386-unknown-freebsd CC='gcc -B /usr/lib32' CFLAGS='-O3 -m32' \
269 LDFLAGS='-B/usr/lib32'
DRC7bac07b2010-04-10 05:53:35 +0000270
271to the configure command line. NASM 2.07 or later from FreeBSD ports must be
272installed.
273
274
DRC0559e942012-03-23 03:12:35 +0000275Oracle Solaris Studio
276---------------------
DRCca5e7d12010-02-17 02:25:06 +0000277
278Add
279
DRC2e4d0442011-02-08 01:18:37 +0000280 CC=cc
DRCca5e7d12010-02-17 02:25:06 +0000281
282to the configure command line. libjpeg-turbo will automatically be built with
DRC2e4d0442011-02-08 01:18:37 +0000283the maximum optimization level (-xO5) unless you override CFLAGS.
DRCca5e7d12010-02-17 02:25:06 +0000284
DRC0559e942012-03-23 03:12:35 +0000285To build a 64-bit version of libjpeg-turbo using Oracle Solaris Studio, add
DRCca5e7d12010-02-17 02:25:06 +0000286
DRC2e4d0442011-02-08 01:18:37 +0000287 --host x86_64-pc-solaris CC=cc CFLAGS='-xO5 -m64' LDFLAGS=-m64
DRCca5e7d12010-02-17 02:25:06 +0000288
289to the configure command line.
290
DRC8b014d72010-02-18 13:03:41 +0000291
DRC81543312010-10-18 07:23:58 +0000292MinGW Build on Cygwin
293---------------------
294
295Use CMake (see recipes below)
296
297
DRC94755ce2011-10-19 05:13:27 +0000298===========
299ARM Support
300===========
301
302This release of libjpeg-turbo can use ARM NEON SIMD instructions to accelerate
303JPEG compression/decompression by approximately 2-4x on ARMv7 and later
304platforms. If libjpeg-turbo is configured on an ARM Linux platform, then the
305build system will automatically include the NEON SIMD routines, if they are
306supported.
307
308
309Building libjpeg-turbo for iOS
310------------------------------
311
312iOS platforms, such as the iPhone and iPad, also use ARM processors, some of
313which support NEON instructions. Additional steps are required to build
314libjpeg-turbo for these platforms. The steps below assume iOS SDK v4.3. If
315you are using a different SDK version, then you will need to modify the
316examples accordingly.
317
318Additional build requirements:
319
320 gas-preprocessor.pl (https://github.com/yuvi/gas-preprocessor) should be
321 installed in your PATH.
322
323Set the following shell variables for simplicity:
324
DRCa2a2cd62013-02-04 22:29:57 +0000325 Xcode 3.2.x / iOS 4.3 SDK:
DRC94755ce2011-10-19 05:13:27 +0000326 IOS_PLATFORMDIR="/Developer/Platforms/iPhoneOS.platform"
327 IOS_SYSROOT="$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS4.3.sdk"
328 IOS_GCC="$IOS_PLATFORMDIR/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2"
329
DRCa2a2cd62013-02-04 22:29:57 +0000330 Xcode 4.5.x / iOS 6.0 SDK:
331 IOS_PLATFORMDIR="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform"
332 IOS_SYSROOT="$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS6.0.sdk"
333 IOS_GCC="$IOS_PLATFORMDIR/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2"
334
DRC94755ce2011-10-19 05:13:27 +0000335 ARM v6 only (up to and including iPhone 3G):
DRCa2a2cd62013-02-04 22:29:57 +0000336 [NOTE: Requires Xcode 4.4.x or earlier]
DRC94755ce2011-10-19 05:13:27 +0000337 IOS_CFLAGS="-march=armv6 -mcpu=arm1176jzf-s -mfpu=vfp"
338
DRC5039d732013-01-21 23:42:12 +0000339 ARM v7 only (iPhone 3GS-4S, iPad 1st-3rd Generation):
DRC94755ce2011-10-19 05:13:27 +0000340 IOS_CFLAGS="-march=armv7 -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon"
341
DRCa2a2cd62013-02-04 22:29:57 +0000342 ARM v7s only (iPhone 5, iPad 4th Generation):
343 [NOTE: Requires Xcode 4.5 or later]
344 IOS_CFLAGS="-march=armv7s -mcpu=swift -mtune=swift -mfpu=neon"
345
DRC94755ce2011-10-19 05:13:27 +0000346Follow the procedure under "Building libjpeg-turbo" above, adding
347
DRC89c59dd2011-10-27 20:40:21 +0000348 --host arm-apple-darwin10 --enable-static --disable-shared \
DRC94755ce2011-10-19 05:13:27 +0000349 CC="$IOS_GCC" LD="$IOS_GCC" \
350 CFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT -O3 $IOS_CFLAGS" \
351 LDFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT $IOS_CFLAGS"
352
353to the configure command line.
354
DRCa2a2cd62013-02-04 22:29:57 +0000355Once built, lipo can be used to combine the ARM v6, v7, and/or v7s variants
356into a universal library.
DRC5039d732013-01-21 23:42:12 +0000357
DRCfde862b2013-02-11 03:38:53 +0000358NOTE: If you are building libjpeg-turbo from the "official" project tarball,
359then it is highly likely that you will need to run 'autoreconf -fiv' in the
360source tree prior to building ARM v7 or v7s iOS binaries using the techniques
361described above. Otherwise, you may get a libtool error such as "unable to
362infer tagged configuration."
363
DRC81543312010-10-18 07:23:58 +0000364
DRC68fef832010-02-16 05:29:10 +0000365*******************************************************************************
DRC81543312010-10-18 07:23:58 +0000366** Building on Windows (Visual C++ or MinGW)
DRC68fef832010-02-16 05:29:10 +0000367*******************************************************************************
368
DRCcc243742010-10-16 09:22:43 +0000369
DRC68fef832010-02-16 05:29:10 +0000370==================
371Build Requirements
372==================
373
DRCcc243742010-10-16 09:22:43 +0000374-- CMake (http://www.cmake.org) v2.6 or later
DRC68fef832010-02-16 05:29:10 +0000375
DRCcc243742010-10-16 09:22:43 +0000376-- Microsoft Visual C++ 2005 or later
DRC68fef832010-02-16 05:29:10 +0000377
DRCcc243742010-10-16 09:22:43 +0000378 If you don't already have Visual C++, then the easiest way to get it is by
379 installing the Windows SDK:
DRC68fef832010-02-16 05:29:10 +0000380
DRCcc243742010-10-16 09:22:43 +0000381 http://msdn.microsoft.com/en-us/windows/bb980924.aspx
382
383 The Windows SDK includes both 32-bit and 64-bit Visual C++ compilers and
384 everything necessary to build libjpeg-turbo.
385
386 * For 32-bit builds, you can also use Microsoft Visual C++ Express
387 Edition. Visual C++ Express Edition is a free download.
388 * If you intend to build libjpeg-turbo from the command line, then add the
389 appropriate compiler and SDK directories to the INCLUDE, LIB, and PATH
390 environment variables. This is generally accomplished by executing
391 vcvars32.bat or vcvars64.bat and SetEnv.cmd. vcvars32.bat and
392 vcvars64.bat are part of Visual C++ and are located in the same directory
393 as the compiler. SetEnv.cmd is part of the Windows SDK. You can pass
394 optional arguments to SetEnv.cmd to specify a 32-bit or 64-bit build
395 environment.
396
397... OR ...
398
DRC81543312010-10-18 07:23:58 +0000399-- MinGW
DRCcc243742010-10-16 09:22:43 +0000400
401 GCC v4.1 or later recommended for best performance
DRC68fef832010-02-16 05:29:10 +0000402
DRC377add72010-05-17 16:41:12 +0000403-- NASM (http://www.nasm.us/) 0.98 or later (NASM 2.05 or later is required for
404 a 64-bit build)
DRC68fef832010-02-16 05:29:10 +0000405
DRC5039d732013-01-21 23:42:12 +0000406-- If building the TurboJPEG Java wrapper, JDK 1.5 or later is required. This
407 can be downloaded from http://www.java.com.
DRC218c0c12011-02-05 06:01:18 +0000408
DRCcc243742010-10-16 09:22:43 +0000409
410==================
411Out-of-Tree Builds
412==================
413
414Binary objects, libraries, and executables are generated in the same directory
415from which cmake was executed (the "binary directory"), and this directory need
416not necessarily be the same as the libjpeg-turbo source directory. You can
417create multiple independent binary directories, in which different versions of
418libjpeg-turbo can be built from the same source tree using different compilers
419or settings. In the sections below, {build_directory} refers to the binary
420directory, whereas {source_directory} refers to the libjpeg-turbo source
421directory. For in-tree builds, these directories are the same.
422
423
DRC68fef832010-02-16 05:29:10 +0000424======================
425Building libjpeg-turbo
426======================
427
DRC68fef832010-02-16 05:29:10 +0000428
DRCcc243742010-10-16 09:22:43 +0000429Visual C++ (Command Line)
430-------------------------
DRC68fef832010-02-16 05:29:10 +0000431
DRCcc243742010-10-16 09:22:43 +0000432 cd {build_directory}
433 cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release {source_directory}
434 nmake
DRC68fef832010-02-16 05:29:10 +0000435
DRCcc243742010-10-16 09:22:43 +0000436This will build either a 32-bit or a 64-bit version of libjpeg-turbo, depending
437on which version of cl.exe is in the PATH.
DRC8b014d72010-02-18 13:03:41 +0000438
DRCcc243742010-10-16 09:22:43 +0000439The following files will be generated under {build_directory}:
440
441 jpeg-static.lib
DRC5039d732013-01-21 23:42:12 +0000442 Static link library for the libjpeg API
DRCcc243742010-10-16 09:22:43 +0000443 sharedlib/jpeg{version}.dll
DRC5039d732013-01-21 23:42:12 +0000444 DLL for the libjpeg API
DRCcc243742010-10-16 09:22:43 +0000445 sharedlib/jpeg.lib
DRC5039d732013-01-21 23:42:12 +0000446 Import library for the libjpeg API
DRCcc243742010-10-16 09:22:43 +0000447 turbojpeg-static.lib
DRC5039d732013-01-21 23:42:12 +0000448 Static link library for the TurboJPEG API
DRCcc243742010-10-16 09:22:43 +0000449 turbojpeg.dll
DRC5039d732013-01-21 23:42:12 +0000450 DLL for the TurboJPEG API
DRCcc243742010-10-16 09:22:43 +0000451 turbojpeg.lib
DRC5039d732013-01-21 23:42:12 +0000452 Import library for the TurboJPEG API
DRCcc243742010-10-16 09:22:43 +0000453
454{version} is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or
DRCf38eee02011-02-18 07:00:38 +0000455v8 emulation is enabled.
DRCcc243742010-10-16 09:22:43 +0000456
457
458Visual C++ (IDE)
459----------------
460
461Choose the appropriate CMake generator option for your version of Visual Studio
462(run "cmake" with no arguments for a list of available generators.) For
463instance:
464
465 cd {build_directory}
466 cmake -G "Visual Studio 9 2008" {source_directory}
467
468You can then open ALL_BUILD.vcproj in Visual Studio and build one of the
469configurations in that project ("Debug", "Release", etc.) to generate a full
470build of libjpeg-turbo.
471
472This will generate the following files under {build_directory}:
473
474 {configuration}/jpeg-static.lib
DRC5039d732013-01-21 23:42:12 +0000475 Static link library for the libjpeg API
DRCcc243742010-10-16 09:22:43 +0000476 sharedlib/{configuration}/jpeg{version}.dll
DRC5039d732013-01-21 23:42:12 +0000477 DLL for the libjpeg API
DRCcc243742010-10-16 09:22:43 +0000478 sharedlib/{configuration}/jpeg.lib
DRC5039d732013-01-21 23:42:12 +0000479 Import library for the libjpeg API
DRCcc243742010-10-16 09:22:43 +0000480 {configuration}/turbojpeg-static.lib
DRC5039d732013-01-21 23:42:12 +0000481 Static link library for the TurboJPEG API
DRCcc243742010-10-16 09:22:43 +0000482 {configuration}/turbojpeg.dll
DRC5039d732013-01-21 23:42:12 +0000483 DLL for the TurboJPEG API
DRCcc243742010-10-16 09:22:43 +0000484 {configuration}/turbojpeg.lib
DRC5039d732013-01-21 23:42:12 +0000485 Import library for the TurboJPEG API
DRCcc243742010-10-16 09:22:43 +0000486
487{configuration} is Debug, Release, RelWithDebInfo, or MinSizeRel, depending on
488the configuration you built in the IDE, and {version} is 62, 7, or 8,
DRCf38eee02011-02-18 07:00:38 +0000489depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled.
DRCcc243742010-10-16 09:22:43 +0000490
491
492MinGW
493-----
494
495 cd {build_directory}
496 cmake -G "MSYS Makefiles" {source_directory}
497 make
498
499This will generate the following files under {build_directory}
500
501 libjpeg.a
DRC5039d732013-01-21 23:42:12 +0000502 Static link library for the libjpeg API
DRCcc243742010-10-16 09:22:43 +0000503 sharedlib/libjpeg-{version}.dll
DRC5039d732013-01-21 23:42:12 +0000504 DLL for the libjpeg API
DRCcc243742010-10-16 09:22:43 +0000505 sharedlib/libjpeg.dll.a
DRC5039d732013-01-21 23:42:12 +0000506 Import library for the libjpeg API
DRCcc243742010-10-16 09:22:43 +0000507 libturbojpeg.a
DRC5039d732013-01-21 23:42:12 +0000508 Static link library for the TurboJPEG API
DRCcc243742010-10-16 09:22:43 +0000509 libturbojpeg.dll
DRC5039d732013-01-21 23:42:12 +0000510 DLL for the TurboJPEG API
DRCcc243742010-10-16 09:22:43 +0000511 libturbojpeg.dll.a
DRC5039d732013-01-21 23:42:12 +0000512 Import library for the TurboJPEG API
DRCcc243742010-10-16 09:22:43 +0000513
514{version} is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or
DRCf38eee02011-02-18 07:00:38 +0000515v8 emulation is enabled.
DRCcc243742010-10-16 09:22:43 +0000516
517
DRCcc243742010-10-16 09:22:43 +0000518Debug Build
519-----------
520
521Add "-DCMAKE_BUILD_TYPE=Debug" to the cmake command line. Or, if building with
522NMake, remove "-DCMAKE_BUILD_TYPE=Release" (Debug builds are the default with
523NMake.)
524
525
DRC30913542012-01-27 09:53:33 +0000526libjpeg v7 or v8 API/ABI Emulation
527-----------------------------------
DRCcc243742010-10-16 09:22:43 +0000528
529Add "-DWITH_JPEG7=1" to the cmake command line to build a version of
DRC30913542012-01-27 09:53:33 +0000530libjpeg-turbo that is API/ABI-compatible with libjpeg v7. Add "-DWITH_JPEG8=1"
531to the cmake command to build a version of libjpeg-turbo that is
532API/ABI-compatible with libjpeg v8. See README-turbo.txt for more information
533on libjpeg v7 and v8 emulation.
DRCcc243742010-10-16 09:22:43 +0000534
535
DRC5039d732013-01-21 23:42:12 +0000536In-Memory Source/Destination Managers
537-------------------------------------
538
539When using libjpeg v6b or v7 API/ABI emulation, add -DWITH_MEM_SRCDST=0 to the
540CMake command line to build a version of libjpeg-turbo that lacks the
541jpeg_mem_src() and jpeg_mem_dest() functions. These functions were not part of
542the original libjpeg v6b and v7 APIs, so removing them ensures strict
543conformance with those APIs. See README-turbo.txt for more information.
544
545
DRC245cfdf2010-11-23 17:11:06 +0000546Arithmetic Coding Support
547-------------------------
548
549Since the patent on arithmetic coding has expired, this functionality has been
550included in this release of libjpeg-turbo. libjpeg-turbo's implementation is
DRCf38eee02011-02-18 07:00:38 +0000551based on the implementation in libjpeg v8, but it works when emulating libjpeg
DRC245cfdf2010-11-23 17:11:06 +0000552v7 or v6b as well. The default is to enable both arithmetic encoding and
553decoding, but those who have philosophical objections to arithmetic coding can
554add "-DWITH_ARITH_ENC=0" or "-DWITH_ARITH_DEC=0" to the cmake command line to
555disable encoding or decoding (respectively.)
556
557
DRC5039d732013-01-21 23:42:12 +0000558TurboJPEG Java Wrapper
559----------------------
DRC279bd342011-04-02 05:17:12 +0000560Add "-DWITH_JAVA=1" to the cmake command line to incorporate an optional Java
DRC5039d732013-01-21 23:42:12 +0000561Native Interface wrapper into the TurboJPEG shared library and build the Java
562front-end classes to support it. This allows the TurboJPEG shared library to
563be used directly from Java applications. See java/README for more details.
DRC218c0c12011-02-05 06:01:18 +0000564
DRCdb425062011-04-03 06:10:18 +0000565If you are using CMake 2.8, you can set the Java_JAVAC_EXECUTABLE,
566Java_JAVA_EXECUTABLE, and Java_JAR_EXECUTABLE CMake variables to specify
567alternate commands or locations for javac, jar, and java (respectively.) If
568you are using CMake 2.6, set JAVA_COMPILE, JAVA_RUNTIME, and JAVA_ARCHIVE
569instead. You can also set the JAVACFLAGS CMake variable to specify arguments
570that should be passed to the Java compiler when building the front-end classes.
571
DRC218c0c12011-02-05 06:01:18 +0000572
DRC26658432010-10-16 22:04:29 +0000573========================
574Installing libjpeg-turbo
575========================
576
577You can use the build system to install libjpeg-turbo into a directory of your
578choosing (as opposed to creating an installer.) To do this, add:
579
580 -DCMAKE_INSTALL_PREFIX={install_directory}
581
582to the cmake command line.
583
584For example,
585
DRC81543312010-10-18 07:23:58 +0000586 cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release \
DRC26658432010-10-16 22:04:29 +0000587 -DCMAKE_INSTALL_PREFIX=c:\libjpeg-turbo {source_directory}
588 nmake install
589
590will install the header files in c:\libjpeg-turbo\include, the library files
591in c:\libjpeg-turbo\lib, the DLL's in c:\libjpeg-turbo\bin, and the
592documentation in c:\libjpeg-turbo\doc.
593
594
DRCcc243742010-10-16 09:22:43 +0000595=============
596Build Recipes
597=============
598
599
DRC1c73ce82010-10-16 21:02:54 +000060064-bit MinGW Build on Cygwin
601----------------------------
602
603 cd {build_directory}
DRC2e4d0442011-02-08 01:18:37 +0000604 CC=/usr/bin/x86_64-w64-mingw32-gcc \
DRC68bf3f22010-10-18 07:56:14 +0000605 cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
606 -DCMAKE_AR=/usr/bin/x86_64-w64-mingw32-ar \
DRC1c73ce82010-10-16 21:02:54 +0000607 -DCMAKE_RANLIB=/usr/bin/x86_64-w64-mingw32-ranlib {source_directory}
608 make
609
610This produces a 64-bit build of libjpeg-turbo that does not depend on
611cygwin1.dll or other Cygwin DLL's. The mingw64-x86_64-gcc-core and
612mingw64-x86_64-gcc-g++ packages (and their dependencies) must be installed.
613
614
61532-bit MinGW Build on Cygwin
616----------------------------
617
618 cd {build_directory}
DRC2e4d0442011-02-08 01:18:37 +0000619 CC=/usr/bin/i686-w64-mingw32-gcc \
DRC68bf3f22010-10-18 07:56:14 +0000620 cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
621 -DDCMAKE_AR=/usr/bin/i686-w64-mingw32-ar \
DRC1c73ce82010-10-16 21:02:54 +0000622 -DCMAKE_RANLIB=/usr/bin/i686-w64-mingw32-ranlib {source_directory}
623 make
624
625This produces a 32-bit build of libjpeg-turbo that does not depend on
626cygwin1.dll or other Cygwin DLL's. The mingw64-i686-gcc-core and
627mingw64-i686-gcc-g++ packages (and their dependencies) must be installed.
628
629
630MinGW-w64 Build on Windows
631--------------------------
632
633This produces a 64-bit build of libjpeg-turbo using the "native" MinGW-w64
634toolchain (which is faster than the Cygwin version):
635
636 cd {build_directory}
637 CC={mingw-w64_binary_path}/x86_64-w64-mingw32-gcc \
DRC81543312010-10-18 07:23:58 +0000638 cmake -G "MSYS Makefiles" \
DRC1c73ce82010-10-16 21:02:54 +0000639 -DCMAKE_AR={mingw-w64_binary_path}/x86_64-w64-mingw32-ar \
640 -DCMAKE_RANLIB={mingw-w64_binary_path}/x86_64-w64-mingw32-ranlib \
641 {source_directory}
642 make
643
644
DRCcc243742010-10-16 09:22:43 +0000645MinGW Build on Linux
646--------------------
647
648 cd {build_directory}
649 CC={mingw_binary_path}/i386-mingw32-gcc \
DRC68bf3f22010-10-18 07:56:14 +0000650 cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
651 -DCMAKE_AR={mingw_binary_path}/i386-mingw32-ar \
DRCcc243742010-10-16 09:22:43 +0000652 -DCMAKE_RANLIB={mingw_binary_path}/i386-mingw32-ranlib \
DRC68bf3f22010-10-18 07:56:14 +0000653 {source_directory}
DRCcc243742010-10-16 09:22:43 +0000654 make
DRC8b014d72010-02-18 13:03:41 +0000655
DRC68fef832010-02-16 05:29:10 +0000656
657*******************************************************************************
658** Creating Release Packages
659*******************************************************************************
660
661The following commands can be used to create various types of release packages:
662
DRCcc243742010-10-16 09:22:43 +0000663
664Unix
665----
666
DRC68fef832010-02-16 05:29:10 +0000667make rpm
668
DRCcc243742010-10-16 09:22:43 +0000669 Create Red Hat-style binary RPM package. Requires RPM v4 or later.
DRC68fef832010-02-16 05:29:10 +0000670
671make srpm
672
673 This runs 'make dist' to create a pristine source tarball, then creates a
DRCcc243742010-10-16 09:22:43 +0000674 Red Hat-style source RPM package from the tarball. Requires RPM v4 or later.
DRC68fef832010-02-16 05:29:10 +0000675
676make deb
677
678 Create Debian-style binary package. Requires dpkg.
679
680make dmg
681
682 Create Macintosh package/disk image. This requires the PackageMaker
683 application, which must be installed in /Developer/Applications/Utilities.
684
DRC9ef93db2010-10-18 08:24:42 +0000685make udmg [BUILDDIR32={32-bit build directory}]
DRC68fef832010-02-16 05:29:10 +0000686
DRC20b734e2012-02-10 01:30:37 +0000687 On 64-bit OS X systems, this creates a Macintosh package and disk image that
688 contains universal i386/x86-64 binaries. You should first configure a 32-bit
689 out-of-tree build of libjpeg-turbo, then configure a 64-bit out-of-tree
690 build, then run 'make udmg' from the 64-bit build directory. The build
691 system will look for the 32-bit build under {source_directory}/osxx86 by
692 default, but you can override this by setting the BUILDDIR32 variable on the
693 make command line as shown above.
694
695make iosdmg [BUILDDIR32={32-bit build directory}] \
696 [BUILDDIRARMV6={ARM v6 build directory}] \
697 [BUILDDIRARMV7={ARM v7 build directory}] \
DRCa2a2cd62013-02-04 22:29:57 +0000698 [BUILDDIRARMV7S={ARM v7s build directory}]
DRC20b734e2012-02-10 01:30:37 +0000699
700 On OS X systems, this creates a Macintosh package and disk image in which the
701 libjpeg-turbo static libraries contain ARM architectures necessary to build
702 iOS applications. If building on an x86-64 system, the binaries will also
703 contain the i386 architecture, as with 'make udmg' above. You should first
DRCa2a2cd62013-02-04 22:29:57 +0000704 configure ARM v6, ARM v7, and/or ARM v7s out-of-tree builds of libjpeg-turbo
705 (see "Building libjpeg-turbo for iOS" above.) If you are building an x86-64
DRC20b734e2012-02-10 01:30:37 +0000706 version of libjpeg-turbo, you should configure a 32-bit out-of-tree build as
707 well. Next, build libjpeg-turbo as you would normally, using an out-of-tree
708 build. When it is built, run 'make iosdmg' from the build directory. The
709 build system will look for the ARM v6 build under {source_directory}/iosarmv6
710 by default, the ARM v7 build under {source_directory}/iosarmv7 by default,
DRCa2a2cd62013-02-04 22:29:57 +0000711 the ARM v7s build under {source_directory}/iosarmv7s by default, and (if
712 applicable) the 32-bit build under {source_directory}/osxx86 by default, but
713 you can override this by setting the BUILDDIR32, BUILDDIRARMV6,
714 BUILDDIRARMV7, and/or BUILDDIRARMV7S variables on the make command line as
715 shown above.
DRC68fef832010-02-16 05:29:10 +0000716
DRC81543312010-10-18 07:23:58 +0000717make cygwinpkg
718
719 Build a Cygwin binary package.
720
DRC0a1f68e2010-02-24 07:24:26 +0000721
DRCcc243742010-10-16 09:22:43 +0000722Windows
723-------
DRC0a1f68e2010-02-24 07:24:26 +0000724
DRCcc243742010-10-16 09:22:43 +0000725If using NMake:
DRC68fef832010-02-16 05:29:10 +0000726
DRCcc243742010-10-16 09:22:43 +0000727 cd {build_directory}
728 nmake installer
729
DRC81543312010-10-18 07:23:58 +0000730If using MinGW:
DRCcc243742010-10-16 09:22:43 +0000731
732 cd {build_directory}
733 make installer
734
735If using the Visual Studio IDE, build the "installer" project.
736
737The installer package (libjpeg-turbo[-gcc][64].exe) will be located under
738{build_directory}. If building using the Visual Studio IDE, then the installer
739package will be located in a subdirectory with the same name as the
740configuration you built (such as {build_directory}\Debug\ or
741{build_directory}\Release\).
742
743Building a Windows installer requires the Nullsoft Install System
744(http://nsis.sourceforge.net/.) makensis.exe should be in your PATH.
DRC9cd4e4b2012-01-31 07:56:44 +0000745
746
747*******************************************************************************
748** Regression testing
749*******************************************************************************
750
751The most common way to test libjpeg-turbo is by invoking 'make test' on
752Unix/Linux platforms or 'ctest' on Windows platforms, once the build has
753completed. This runs a series of tests to ensure that mathematical
754compatibility has been maintained between libjpeg-turbo and libjpeg v6b. This
755also invokes the TurboJPEG unit tests, which ensure that the colorspace
756extensions, YUV encoding, decompression scaling, and other features of the
757TurboJPEG C and Java APIs are working properly (and, by extension, that the
758equivalent features of the underlying libjpeg API are also working.)
759
760Invoking 'make testclean' or 'nmake testclean' (if using NMake) or building
761the 'testclean' target (if using the Visual Studio IDE) will clean up the
762output images generated by 'make test'.
763
DRC5039d732013-01-21 23:42:12 +0000764On Unix/Linux platforms, more extensive tests of the TurboJPEG C and Java
DRC9cd4e4b2012-01-31 07:56:44 +0000765wrappers can be run by invoking 'make tjtest'. These extended TurboJPEG tests
766essentially iterate through all of the available features of the TurboJPEG APIs
767that are not covered by the TurboJPEG unit tests (this includes the lossless
768transform options) and compare the images generated by each feature to images
769generated using the equivalent feature in the libjpeg API. The extended
770TurboJPEG tests are meant to test for regressions in the TurboJPEG wrappers,
DRC5039d732013-01-21 23:42:12 +0000771not in the underlying libjpeg API library.