blob: 1528fce2c9249fc8d571bb63b5aee96d08663ccc [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
DRCcc243742010-10-16 09:22:43 +000074NOTE: Running autoreconf in the source directory is only necessary if building
75libjpeg-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
DRC81543312010-10-18 07:23:58 +0000358
DRC68fef832010-02-16 05:29:10 +0000359*******************************************************************************
DRC81543312010-10-18 07:23:58 +0000360** Building on Windows (Visual C++ or MinGW)
DRC68fef832010-02-16 05:29:10 +0000361*******************************************************************************
362
DRCcc243742010-10-16 09:22:43 +0000363
DRC68fef832010-02-16 05:29:10 +0000364==================
365Build Requirements
366==================
367
DRCcc243742010-10-16 09:22:43 +0000368-- CMake (http://www.cmake.org) v2.6 or later
DRC68fef832010-02-16 05:29:10 +0000369
DRCcc243742010-10-16 09:22:43 +0000370-- Microsoft Visual C++ 2005 or later
DRC68fef832010-02-16 05:29:10 +0000371
DRCcc243742010-10-16 09:22:43 +0000372 If you don't already have Visual C++, then the easiest way to get it is by
373 installing the Windows SDK:
DRC68fef832010-02-16 05:29:10 +0000374
DRCcc243742010-10-16 09:22:43 +0000375 http://msdn.microsoft.com/en-us/windows/bb980924.aspx
376
377 The Windows SDK includes both 32-bit and 64-bit Visual C++ compilers and
378 everything necessary to build libjpeg-turbo.
379
380 * For 32-bit builds, you can also use Microsoft Visual C++ Express
381 Edition. Visual C++ Express Edition is a free download.
382 * If you intend to build libjpeg-turbo from the command line, then add the
383 appropriate compiler and SDK directories to the INCLUDE, LIB, and PATH
384 environment variables. This is generally accomplished by executing
385 vcvars32.bat or vcvars64.bat and SetEnv.cmd. vcvars32.bat and
386 vcvars64.bat are part of Visual C++ and are located in the same directory
387 as the compiler. SetEnv.cmd is part of the Windows SDK. You can pass
388 optional arguments to SetEnv.cmd to specify a 32-bit or 64-bit build
389 environment.
390
391... OR ...
392
DRC81543312010-10-18 07:23:58 +0000393-- MinGW
DRCcc243742010-10-16 09:22:43 +0000394
395 GCC v4.1 or later recommended for best performance
DRC68fef832010-02-16 05:29:10 +0000396
DRC377add72010-05-17 16:41:12 +0000397-- NASM (http://www.nasm.us/) 0.98 or later (NASM 2.05 or later is required for
398 a 64-bit build)
DRC68fef832010-02-16 05:29:10 +0000399
DRC5039d732013-01-21 23:42:12 +0000400-- If building the TurboJPEG Java wrapper, JDK 1.5 or later is required. This
401 can be downloaded from http://www.java.com.
DRC218c0c12011-02-05 06:01:18 +0000402
DRCcc243742010-10-16 09:22:43 +0000403
404==================
405Out-of-Tree Builds
406==================
407
408Binary objects, libraries, and executables are generated in the same directory
409from which cmake was executed (the "binary directory"), and this directory need
410not necessarily be the same as the libjpeg-turbo source directory. You can
411create multiple independent binary directories, in which different versions of
412libjpeg-turbo can be built from the same source tree using different compilers
413or settings. In the sections below, {build_directory} refers to the binary
414directory, whereas {source_directory} refers to the libjpeg-turbo source
415directory. For in-tree builds, these directories are the same.
416
417
DRC68fef832010-02-16 05:29:10 +0000418======================
419Building libjpeg-turbo
420======================
421
DRC68fef832010-02-16 05:29:10 +0000422
DRCcc243742010-10-16 09:22:43 +0000423Visual C++ (Command Line)
424-------------------------
DRC68fef832010-02-16 05:29:10 +0000425
DRCcc243742010-10-16 09:22:43 +0000426 cd {build_directory}
427 cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release {source_directory}
428 nmake
DRC68fef832010-02-16 05:29:10 +0000429
DRCcc243742010-10-16 09:22:43 +0000430This will build either a 32-bit or a 64-bit version of libjpeg-turbo, depending
431on which version of cl.exe is in the PATH.
DRC8b014d72010-02-18 13:03:41 +0000432
DRCcc243742010-10-16 09:22:43 +0000433The following files will be generated under {build_directory}:
434
435 jpeg-static.lib
DRC5039d732013-01-21 23:42:12 +0000436 Static link library for the libjpeg API
DRCcc243742010-10-16 09:22:43 +0000437 sharedlib/jpeg{version}.dll
DRC5039d732013-01-21 23:42:12 +0000438 DLL for the libjpeg API
DRCcc243742010-10-16 09:22:43 +0000439 sharedlib/jpeg.lib
DRC5039d732013-01-21 23:42:12 +0000440 Import library for the libjpeg API
DRCcc243742010-10-16 09:22:43 +0000441 turbojpeg-static.lib
DRC5039d732013-01-21 23:42:12 +0000442 Static link library for the TurboJPEG API
DRCcc243742010-10-16 09:22:43 +0000443 turbojpeg.dll
DRC5039d732013-01-21 23:42:12 +0000444 DLL for the TurboJPEG API
DRCcc243742010-10-16 09:22:43 +0000445 turbojpeg.lib
DRC5039d732013-01-21 23:42:12 +0000446 Import library for the TurboJPEG API
DRCcc243742010-10-16 09:22:43 +0000447
448{version} is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or
DRCf38eee02011-02-18 07:00:38 +0000449v8 emulation is enabled.
DRCcc243742010-10-16 09:22:43 +0000450
451
452Visual C++ (IDE)
453----------------
454
455Choose the appropriate CMake generator option for your version of Visual Studio
456(run "cmake" with no arguments for a list of available generators.) For
457instance:
458
459 cd {build_directory}
460 cmake -G "Visual Studio 9 2008" {source_directory}
461
462You can then open ALL_BUILD.vcproj in Visual Studio and build one of the
463configurations in that project ("Debug", "Release", etc.) to generate a full
464build of libjpeg-turbo.
465
466This will generate the following files under {build_directory}:
467
468 {configuration}/jpeg-static.lib
DRC5039d732013-01-21 23:42:12 +0000469 Static link library for the libjpeg API
DRCcc243742010-10-16 09:22:43 +0000470 sharedlib/{configuration}/jpeg{version}.dll
DRC5039d732013-01-21 23:42:12 +0000471 DLL for the libjpeg API
DRCcc243742010-10-16 09:22:43 +0000472 sharedlib/{configuration}/jpeg.lib
DRC5039d732013-01-21 23:42:12 +0000473 Import library for the libjpeg API
DRCcc243742010-10-16 09:22:43 +0000474 {configuration}/turbojpeg-static.lib
DRC5039d732013-01-21 23:42:12 +0000475 Static link library for the TurboJPEG API
DRCcc243742010-10-16 09:22:43 +0000476 {configuration}/turbojpeg.dll
DRC5039d732013-01-21 23:42:12 +0000477 DLL for the TurboJPEG API
DRCcc243742010-10-16 09:22:43 +0000478 {configuration}/turbojpeg.lib
DRC5039d732013-01-21 23:42:12 +0000479 Import library for the TurboJPEG API
DRCcc243742010-10-16 09:22:43 +0000480
481{configuration} is Debug, Release, RelWithDebInfo, or MinSizeRel, depending on
482the configuration you built in the IDE, and {version} is 62, 7, or 8,
DRCf38eee02011-02-18 07:00:38 +0000483depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled.
DRCcc243742010-10-16 09:22:43 +0000484
485
486MinGW
487-----
488
489 cd {build_directory}
490 cmake -G "MSYS Makefiles" {source_directory}
491 make
492
493This will generate the following files under {build_directory}
494
495 libjpeg.a
DRC5039d732013-01-21 23:42:12 +0000496 Static link library for the libjpeg API
DRCcc243742010-10-16 09:22:43 +0000497 sharedlib/libjpeg-{version}.dll
DRC5039d732013-01-21 23:42:12 +0000498 DLL for the libjpeg API
DRCcc243742010-10-16 09:22:43 +0000499 sharedlib/libjpeg.dll.a
DRC5039d732013-01-21 23:42:12 +0000500 Import library for the libjpeg API
DRCcc243742010-10-16 09:22:43 +0000501 libturbojpeg.a
DRC5039d732013-01-21 23:42:12 +0000502 Static link library for the TurboJPEG API
DRCcc243742010-10-16 09:22:43 +0000503 libturbojpeg.dll
DRC5039d732013-01-21 23:42:12 +0000504 DLL for the TurboJPEG API
DRCcc243742010-10-16 09:22:43 +0000505 libturbojpeg.dll.a
DRC5039d732013-01-21 23:42:12 +0000506 Import library for the TurboJPEG API
DRCcc243742010-10-16 09:22:43 +0000507
508{version} is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or
DRCf38eee02011-02-18 07:00:38 +0000509v8 emulation is enabled.
DRCcc243742010-10-16 09:22:43 +0000510
511
DRCcc243742010-10-16 09:22:43 +0000512Debug Build
513-----------
514
515Add "-DCMAKE_BUILD_TYPE=Debug" to the cmake command line. Or, if building with
516NMake, remove "-DCMAKE_BUILD_TYPE=Release" (Debug builds are the default with
517NMake.)
518
519
DRC30913542012-01-27 09:53:33 +0000520libjpeg v7 or v8 API/ABI Emulation
521-----------------------------------
DRCcc243742010-10-16 09:22:43 +0000522
523Add "-DWITH_JPEG7=1" to the cmake command line to build a version of
DRC30913542012-01-27 09:53:33 +0000524libjpeg-turbo that is API/ABI-compatible with libjpeg v7. Add "-DWITH_JPEG8=1"
525to the cmake command to build a version of libjpeg-turbo that is
526API/ABI-compatible with libjpeg v8. See README-turbo.txt for more information
527on libjpeg v7 and v8 emulation.
DRCcc243742010-10-16 09:22:43 +0000528
529
DRC5039d732013-01-21 23:42:12 +0000530In-Memory Source/Destination Managers
531-------------------------------------
532
533When using libjpeg v6b or v7 API/ABI emulation, add -DWITH_MEM_SRCDST=0 to the
534CMake command line to build a version of libjpeg-turbo that lacks the
535jpeg_mem_src() and jpeg_mem_dest() functions. These functions were not part of
536the original libjpeg v6b and v7 APIs, so removing them ensures strict
537conformance with those APIs. See README-turbo.txt for more information.
538
539
DRC245cfdf2010-11-23 17:11:06 +0000540Arithmetic Coding Support
541-------------------------
542
543Since the patent on arithmetic coding has expired, this functionality has been
544included in this release of libjpeg-turbo. libjpeg-turbo's implementation is
DRCf38eee02011-02-18 07:00:38 +0000545based on the implementation in libjpeg v8, but it works when emulating libjpeg
DRC245cfdf2010-11-23 17:11:06 +0000546v7 or v6b as well. The default is to enable both arithmetic encoding and
547decoding, but those who have philosophical objections to arithmetic coding can
548add "-DWITH_ARITH_ENC=0" or "-DWITH_ARITH_DEC=0" to the cmake command line to
549disable encoding or decoding (respectively.)
550
551
DRC5039d732013-01-21 23:42:12 +0000552TurboJPEG Java Wrapper
553----------------------
DRC279bd342011-04-02 05:17:12 +0000554Add "-DWITH_JAVA=1" to the cmake command line to incorporate an optional Java
DRC5039d732013-01-21 23:42:12 +0000555Native Interface wrapper into the TurboJPEG shared library and build the Java
556front-end classes to support it. This allows the TurboJPEG shared library to
557be used directly from Java applications. See java/README for more details.
DRC218c0c12011-02-05 06:01:18 +0000558
DRCdb425062011-04-03 06:10:18 +0000559If you are using CMake 2.8, you can set the Java_JAVAC_EXECUTABLE,
560Java_JAVA_EXECUTABLE, and Java_JAR_EXECUTABLE CMake variables to specify
561alternate commands or locations for javac, jar, and java (respectively.) If
562you are using CMake 2.6, set JAVA_COMPILE, JAVA_RUNTIME, and JAVA_ARCHIVE
563instead. You can also set the JAVACFLAGS CMake variable to specify arguments
564that should be passed to the Java compiler when building the front-end classes.
565
DRC218c0c12011-02-05 06:01:18 +0000566
DRC26658432010-10-16 22:04:29 +0000567========================
568Installing libjpeg-turbo
569========================
570
571You can use the build system to install libjpeg-turbo into a directory of your
572choosing (as opposed to creating an installer.) To do this, add:
573
574 -DCMAKE_INSTALL_PREFIX={install_directory}
575
576to the cmake command line.
577
578For example,
579
DRC81543312010-10-18 07:23:58 +0000580 cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release \
DRC26658432010-10-16 22:04:29 +0000581 -DCMAKE_INSTALL_PREFIX=c:\libjpeg-turbo {source_directory}
582 nmake install
583
584will install the header files in c:\libjpeg-turbo\include, the library files
585in c:\libjpeg-turbo\lib, the DLL's in c:\libjpeg-turbo\bin, and the
586documentation in c:\libjpeg-turbo\doc.
587
588
DRCcc243742010-10-16 09:22:43 +0000589=============
590Build Recipes
591=============
592
593
DRC1c73ce82010-10-16 21:02:54 +000059464-bit MinGW Build on Cygwin
595----------------------------
596
597 cd {build_directory}
DRC2e4d0442011-02-08 01:18:37 +0000598 CC=/usr/bin/x86_64-w64-mingw32-gcc \
DRC68bf3f22010-10-18 07:56:14 +0000599 cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
600 -DCMAKE_AR=/usr/bin/x86_64-w64-mingw32-ar \
DRC1c73ce82010-10-16 21:02:54 +0000601 -DCMAKE_RANLIB=/usr/bin/x86_64-w64-mingw32-ranlib {source_directory}
602 make
603
604This produces a 64-bit build of libjpeg-turbo that does not depend on
605cygwin1.dll or other Cygwin DLL's. The mingw64-x86_64-gcc-core and
606mingw64-x86_64-gcc-g++ packages (and their dependencies) must be installed.
607
608
60932-bit MinGW Build on Cygwin
610----------------------------
611
612 cd {build_directory}
DRC2e4d0442011-02-08 01:18:37 +0000613 CC=/usr/bin/i686-w64-mingw32-gcc \
DRC68bf3f22010-10-18 07:56:14 +0000614 cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
615 -DDCMAKE_AR=/usr/bin/i686-w64-mingw32-ar \
DRC1c73ce82010-10-16 21:02:54 +0000616 -DCMAKE_RANLIB=/usr/bin/i686-w64-mingw32-ranlib {source_directory}
617 make
618
619This produces a 32-bit build of libjpeg-turbo that does not depend on
620cygwin1.dll or other Cygwin DLL's. The mingw64-i686-gcc-core and
621mingw64-i686-gcc-g++ packages (and their dependencies) must be installed.
622
623
624MinGW-w64 Build on Windows
625--------------------------
626
627This produces a 64-bit build of libjpeg-turbo using the "native" MinGW-w64
628toolchain (which is faster than the Cygwin version):
629
630 cd {build_directory}
631 CC={mingw-w64_binary_path}/x86_64-w64-mingw32-gcc \
DRC81543312010-10-18 07:23:58 +0000632 cmake -G "MSYS Makefiles" \
DRC1c73ce82010-10-16 21:02:54 +0000633 -DCMAKE_AR={mingw-w64_binary_path}/x86_64-w64-mingw32-ar \
634 -DCMAKE_RANLIB={mingw-w64_binary_path}/x86_64-w64-mingw32-ranlib \
635 {source_directory}
636 make
637
638
DRCcc243742010-10-16 09:22:43 +0000639MinGW Build on Linux
640--------------------
641
642 cd {build_directory}
643 CC={mingw_binary_path}/i386-mingw32-gcc \
DRC68bf3f22010-10-18 07:56:14 +0000644 cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
645 -DCMAKE_AR={mingw_binary_path}/i386-mingw32-ar \
DRCcc243742010-10-16 09:22:43 +0000646 -DCMAKE_RANLIB={mingw_binary_path}/i386-mingw32-ranlib \
DRC68bf3f22010-10-18 07:56:14 +0000647 {source_directory}
DRCcc243742010-10-16 09:22:43 +0000648 make
DRC8b014d72010-02-18 13:03:41 +0000649
DRC68fef832010-02-16 05:29:10 +0000650
651*******************************************************************************
652** Creating Release Packages
653*******************************************************************************
654
655The following commands can be used to create various types of release packages:
656
DRCcc243742010-10-16 09:22:43 +0000657
658Unix
659----
660
DRC68fef832010-02-16 05:29:10 +0000661make rpm
662
DRCcc243742010-10-16 09:22:43 +0000663 Create Red Hat-style binary RPM package. Requires RPM v4 or later.
DRC68fef832010-02-16 05:29:10 +0000664
665make srpm
666
667 This runs 'make dist' to create a pristine source tarball, then creates a
DRCcc243742010-10-16 09:22:43 +0000668 Red Hat-style source RPM package from the tarball. Requires RPM v4 or later.
DRC68fef832010-02-16 05:29:10 +0000669
670make deb
671
672 Create Debian-style binary package. Requires dpkg.
673
674make dmg
675
676 Create Macintosh package/disk image. This requires the PackageMaker
677 application, which must be installed in /Developer/Applications/Utilities.
678
DRC9ef93db2010-10-18 08:24:42 +0000679make udmg [BUILDDIR32={32-bit build directory}]
DRC68fef832010-02-16 05:29:10 +0000680
DRC20b734e2012-02-10 01:30:37 +0000681 On 64-bit OS X systems, this creates a Macintosh package and disk image that
682 contains universal i386/x86-64 binaries. You should first configure a 32-bit
683 out-of-tree build of libjpeg-turbo, then configure a 64-bit out-of-tree
684 build, then run 'make udmg' from the 64-bit build directory. The build
685 system will look for the 32-bit build under {source_directory}/osxx86 by
686 default, but you can override this by setting the BUILDDIR32 variable on the
687 make command line as shown above.
688
689make iosdmg [BUILDDIR32={32-bit build directory}] \
690 [BUILDDIRARMV6={ARM v6 build directory}] \
691 [BUILDDIRARMV7={ARM v7 build directory}] \
DRCa2a2cd62013-02-04 22:29:57 +0000692 [BUILDDIRARMV7S={ARM v7s build directory}]
DRC20b734e2012-02-10 01:30:37 +0000693
694 On OS X systems, this creates a Macintosh package and disk image in which the
695 libjpeg-turbo static libraries contain ARM architectures necessary to build
696 iOS applications. If building on an x86-64 system, the binaries will also
697 contain the i386 architecture, as with 'make udmg' above. You should first
DRCa2a2cd62013-02-04 22:29:57 +0000698 configure ARM v6, ARM v7, and/or ARM v7s out-of-tree builds of libjpeg-turbo
699 (see "Building libjpeg-turbo for iOS" above.) If you are building an x86-64
DRC20b734e2012-02-10 01:30:37 +0000700 version of libjpeg-turbo, you should configure a 32-bit out-of-tree build as
701 well. Next, build libjpeg-turbo as you would normally, using an out-of-tree
702 build. When it is built, run 'make iosdmg' from the build directory. The
703 build system will look for the ARM v6 build under {source_directory}/iosarmv6
704 by default, the ARM v7 build under {source_directory}/iosarmv7 by default,
DRCa2a2cd62013-02-04 22:29:57 +0000705 the ARM v7s build under {source_directory}/iosarmv7s by default, and (if
706 applicable) the 32-bit build under {source_directory}/osxx86 by default, but
707 you can override this by setting the BUILDDIR32, BUILDDIRARMV6,
708 BUILDDIRARMV7, and/or BUILDDIRARMV7S variables on the make command line as
709 shown above.
DRC68fef832010-02-16 05:29:10 +0000710
DRC81543312010-10-18 07:23:58 +0000711make cygwinpkg
712
713 Build a Cygwin binary package.
714
DRC0a1f68e2010-02-24 07:24:26 +0000715
DRCcc243742010-10-16 09:22:43 +0000716Windows
717-------
DRC0a1f68e2010-02-24 07:24:26 +0000718
DRCcc243742010-10-16 09:22:43 +0000719If using NMake:
DRC68fef832010-02-16 05:29:10 +0000720
DRCcc243742010-10-16 09:22:43 +0000721 cd {build_directory}
722 nmake installer
723
DRC81543312010-10-18 07:23:58 +0000724If using MinGW:
DRCcc243742010-10-16 09:22:43 +0000725
726 cd {build_directory}
727 make installer
728
729If using the Visual Studio IDE, build the "installer" project.
730
731The installer package (libjpeg-turbo[-gcc][64].exe) will be located under
732{build_directory}. If building using the Visual Studio IDE, then the installer
733package will be located in a subdirectory with the same name as the
734configuration you built (such as {build_directory}\Debug\ or
735{build_directory}\Release\).
736
737Building a Windows installer requires the Nullsoft Install System
738(http://nsis.sourceforge.net/.) makensis.exe should be in your PATH.
DRC9cd4e4b2012-01-31 07:56:44 +0000739
740
741*******************************************************************************
742** Regression testing
743*******************************************************************************
744
745The most common way to test libjpeg-turbo is by invoking 'make test' on
746Unix/Linux platforms or 'ctest' on Windows platforms, once the build has
747completed. This runs a series of tests to ensure that mathematical
748compatibility has been maintained between libjpeg-turbo and libjpeg v6b. This
749also invokes the TurboJPEG unit tests, which ensure that the colorspace
750extensions, YUV encoding, decompression scaling, and other features of the
751TurboJPEG C and Java APIs are working properly (and, by extension, that the
752equivalent features of the underlying libjpeg API are also working.)
753
754Invoking 'make testclean' or 'nmake testclean' (if using NMake) or building
755the 'testclean' target (if using the Visual Studio IDE) will clean up the
756output images generated by 'make test'.
757
DRC5039d732013-01-21 23:42:12 +0000758On Unix/Linux platforms, more extensive tests of the TurboJPEG C and Java
DRC9cd4e4b2012-01-31 07:56:44 +0000759wrappers can be run by invoking 'make tjtest'. These extended TurboJPEG tests
760essentially iterate through all of the available features of the TurboJPEG APIs
761that are not covered by the TurboJPEG unit tests (this includes the lossless
762transform options) and compare the images generated by each feature to images
763generated using the equivalent feature in the libjpeg API. The extended
764TurboJPEG tests are meant to test for regressions in the TurboJPEG wrappers,
DRC5039d732013-01-21 23:42:12 +0000765not in the underlying libjpeg API library.