Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(753)

Side by Side Diff: BUILDING.md

Issue 1934113002: Update libjpeg_turbo to 1.4.90 from https://github.com/libjpeg-turbo/ (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 Building on Un*x Platforms (including Cygwin and OS X)
2 =======================================================
3
4
5 Build Requirements
6 ------------------
7
8 - autoconf 2.56 or later
9
10 - automake 1.7 or later
11
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).
16
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).
25
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
29 SRPMs from
30
31 http://www.nasm.us/pub/nasm/releasebuilds
32
33 and executing the following as root:
34
35 ARCH=`uname -m`
36 rpmbuild --rebuild nasm-{version}.src.rpm
37 rpm -Uvh /usr/src/redhat/RPMS/$ARCH/nasm-{version}.$ARCH.rpm
38
39 NOTE: the NASM build will fail if texinfo is not installed.
40
41 - GCC v4.1 (or later) or clang recommended for best performance
42
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 10.6, 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 other
48 systems, you can obtain the Oracle Java Development Kit from
49 http://www.java.com.
50
51
52 Out-of-Tree Builds
53 ------------------
54
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.
64
65
66 Building libjpeg-turbo
67 ----------------------
68
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.)
72
73 cd {source_directory}
74 autoreconf -fiv
75 cd {build_directory}
76 sh {source_directory}/configure [additional configure flags]
77 make
78
79 NOTE: Running autoreconf in the source directory is not necessary if building
80 libjpeg-turbo from one of the official release tarballs.
81
82 This will generate the following files under .libs/:
83
84 **libjpeg.a**
85 Static link library for the libjpeg API
86
87 **libjpeg.so.{version}** (Linux, Unix)
88 **libjpeg.{version}.dylib** (OS X)
89 **cygjpeg-{version}.dll** (Cygwin)
90 Shared library for the libjpeg API
91
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.
95
96 **libjpeg.so** (Linux, Unix)
97 **libjpeg.dylib** (OS X)
98 Development symlink for the libjpeg API
99
100 **libjpeg.dll.a** (Cygwin)
101 Import library for the libjpeg API
102
103 **libturbojpeg.a**
104 Static link library for the TurboJPEG API
105
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
110
111 **libturbojpeg.so** (Linux, Unix)
112 **libturbojpeg.dylib** (OS X)
113 Development symlink for the TurboJPEG API
114
115 **libturbojpeg.dll.a** (Cygwin)
116 Import library for the TurboJPEG API
117
118
119 ### libjpeg v7 or v8 API/ABI Emulation
120
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.
126
127
128 ### In-Memory Source/Destination Managers
129
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.
135
136
137 ### Arithmetic Coding Support
138
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.)
146
147
148 ### TurboJPEG Java Wrapper
149
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
154 more details.
155
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.
162
163
164 Installing libjpeg-turbo
165 ------------------------
166
167 If you intend to install these libraries and the associated header files, then
168 replace 'make' in the instructions above with
169
170 make install prefix={base dir} libdir={library directory}
171
172 For example,
173
174 make install prefix=/usr/local libdir=/usr/local/lib64
175
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
180 (64-bit.)
181
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.
189
190
191 Build Recipes
192 -------------
193
194
195 ### 32-bit Build on 64-bit Linux
196
197 Add
198
199 --host i686-pc-linux-gnu CFLAGS='-O3 -m32' LDFLAGS=-m32
200
201 to the `configure` command line.
202
203
204 ### 64-bit Build on 64-bit OS X
205
206 Add
207
208 --host x86_64-apple-darwin NASM=/opt/local/bin/nasm
209
210 to the `configure` command line. NASM 2.07 or later from MacPorts must be
211 installed.
212
213
214 ### 32-bit Build on 64-bit OS X
215
216 Add
217
218 --host i686-apple-darwin CFLAGS='-O3 -m32' LDFLAGS=-m32
219
220 to the `configure` command line.
221
222
223 ### 64-bit Backward-Compatible Build on 64-bit OS X
224
225 Add
226
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'
230
231 to the `configure` command line. NASM 2.07 or later from MacPorts must be
232 installed.
233
234
235 ### 32-bit Backward-Compatible Build on OS X
236
237 Add
238
239 --host i686-apple-darwin \
240 CFLAGS='-mmacosx-version-min=10.5 -O3 -m32' \
241 LDFLAGS='-mmacosx-version-min=10.5 -m32'
242
243 to the `configure` command line.
244
245
246 ### 64-bit Build on 64-bit Solaris
247
248 Add
249
250 --host x86_64-pc-solaris CFLAGS='-O3 -m64' LDFLAGS=-m64
251
252 to the `configure` command line.
253
254
255 ### 32-bit Build on 64-bit FreeBSD
256
257 Add
258
259 --host i386-unknown-freebsd CC='gcc -B /usr/lib32' CFLAGS='-O3 -m32' \
260 LDFLAGS='-B/usr/lib32'
261
262 to the `configure` command line. NASM 2.07 or later from FreeBSD ports must be
263 installed.
264
265
266 ### Oracle Solaris Studio
267
268 Add
269
270 CC=cc
271
272 to the `configure` command line. libjpeg-turbo will automatically be built
273 with the maximum optimization level (-xO5) unless you override `CFLAGS`.
274
275 To build a 64-bit version of libjpeg-turbo using Oracle Solaris Studio, add
276
277 --host x86_64-pc-solaris CC=cc CFLAGS='-xO5 -m64' LDFLAGS=-m64
278
279 to the `configure` command line.
280
281
282 ### MinGW Build on Cygwin
283
284 Use CMake (see recipes below)
285
286
287 ARM Support
288 -----------
289
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.
295
296
297 ### Building libjpeg-turbo for iOS
298
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.
302
303
304 #### Additional build requirements
305
306 - [gas-preprocessor.pl]
307 (https://raw.githubusercontent.com/libjpeg-turbo/gas-preprocessor/master/gas-p reprocessor.pl)
308 should be installed in your `PATH`.
309
310
311 #### ARM 32-bit Build (Xcode 4.6.x and earlier, LLVM-GCC)
312
313 Set the following shell variables for simplicity:
314
315 *Xcode 4.2 and earlier*
316
317 IOS_PLATFORMDIR=/Developer/Platforms/iPhoneOS.platform`
318
319 *Xcode 4.3 and later*
320
321 IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneO S.platform
322
323 *All Xcode versions*
324
325 IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk
326 IOS_GCC=$IOS_PLATFORMDIR/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2
327
328 *ARMv6 (code will run on all iOS devices, not SIMD-accelerated)*
329 [NOTE: Requires Xcode 4.4.x or earlier]
330
331 IOS_CFLAGS="-march=armv6 -mcpu=arm1176jzf-s -mfpu=vfp"
332
333 *ARMv7 (code will run on iPhone 3GS-4S/iPad 1st-3rd Generation and newer)*
334
335 IOS_CFLAGS="-march=armv7 -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon"
336
337 *ARMv7s (code will run on iPhone 5/iPad 4th Generation and newer)*
338 [NOTE: Requires Xcode 4.5 or later]
339
340 IOS_CFLAGS="-march=armv7s -mcpu=swift -mtune=swift -mfpu=neon"
341
342 Follow the procedure under "Building libjpeg-turbo" above, adding
343
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"
348
349 to the `configure` command line.
350
351
352 #### ARM 32-bit Build (Xcode 5.0.x and later, Clang)
353
354 Set the following shell variables for simplicity:
355
356 IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneO S.platform
357 IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk
358 IOS_GCC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.x ctoolchain/usr/bin/clang
359
360 *ARMv7 (code will run on iPhone 3GS-4S/iPad 1st-3rd Generation and newer)*
361
362 IOS_CFLAGS="-arch armv7"
363
364 *ARMv7s (code will run on iPhone 5/iPad 4th Generation and newer)*
365
366 IOS_CFLAGS="-arch armv7s"
367
368 Follow the procedure under "Building libjpeg-turbo" above, adding
369
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"
375
376 to the `configure` command line.
377
378
379 #### ARMv8 64-bit Build (Xcode 5.0.x and later, Clang)
380
381 Code will run on iPhone 5S/iPad Mini 2/iPad Air and newer.
382
383 Set the following shell variables for simplicity:
384
385 IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneO S.platform
386 IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk
387 IOS_GCC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.x ctoolchain/usr/bin/clang
388 IOS_CFLAGS="-arch arm64"
389
390 Follow the procedure under "Building libjpeg-turbo" above, adding
391
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"
396
397 to the `configure` command line.
398
399
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.
403
404 Once built, lipo can be used to combine the ARMv6, v7, v7s, and/or v8 variants
405 into a universal library.
406
407
408 ### Building libjpeg-turbo for Android
409
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.
413
414 # Set these variables to suit your needs
415 NDK_PATH={full path to the "ndk" directory-- for example, /opt/android/ndk}
416 BUILD_PLATFORM={the platform name for the NDK package you installed--
417 for example, "windows-x86" or "linux-x86_64" or "darwin-x86_64"}
418 TOOLCHAIN_VERSION={"4.8", "4.9", "clang3.5", etc. This corresponds to a
419 toolchain directory under ${NDK_PATH}/toolchains/.}
420 ANDROID_VERSION={The minimum version of Android to support-- for example,
421 "16", "19", etc. "21" or later is required for a 64-bit build.}
422
423 # 32-bit ARMv7 build
424 HOST=arm-linux-androideabi
425 SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-arm
426 ANDROID_CFLAGS="-march=armv7-a -mfloat-abi=softfp -fprefetch-loop-arrays \
427 --sysroot=${SYSROOT}"
428
429 # 64-bit ARMv8 build
430 HOST=aarch64-linux-android
431 SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-arm64
432 ANDROID_CFLAGS="--sysroot=${SYSROOT}"
433
434 TOOLCHAIN=${NDK_PATH}/toolchains/${HOST}-${TOOLCHAIN_VERSION}/prebuilt/${BUI LD_PLATFORM}
435 ANDROID_INCLUDES="-I${SYSROOT}/usr/include -I${TOOLCHAIN}/include"
436 export CPP=${TOOLCHAIN}/bin/${HOST}-cpp
437 export AR=${TOOLCHAIN}/bin/${HOST}-ar
438 export AS=${TOOLCHAIN}/bin/${HOST}-as
439 export NM=${TOOLCHAIN}/bin/${HOST}-nm
440 export CC=${TOOLCHAIN}/bin/${HOST}-gcc
441 export LD=${TOOLCHAIN}/bin/${HOST}-ld
442 export RANLIB=${TOOLCHAIN}/bin/${HOST}-ranlib
443 export OBJDUMP=${TOOLCHAIN}/bin/${HOST}-objdump
444 export STRIP=${TOOLCHAIN}/bin/${HOST}-strip
445 cd {build_directory}
446 sh {source_directory}/configure --host=${HOST} \
447 CFLAGS="${ANDROID_INCLUDES} ${ANDROID_CFLAGS} -O3 -fPIE" \
448 CPPFLAGS="${ANDROID_INCLUDES} ${ANDROID_CFLAGS}" \
449 LDFLAGS="${ANDROID_CFLAGS} -pie" --with-simd ${1+"$@"}
450 make
451
452 If building for Android 4.0.x (API level < 16) or earlier, remove `-fPIE` from
453 `CFLAGS` and `-pie` from `LDFLAGS`.
454
455
456 Building on Windows (Visual C++ or MinGW)
457 =========================================
458
459
460 Build Requirements
461 ------------------
462
463 - [CMake](http://www.cmake.org) v2.8.8 or later
464
465 - Microsoft Visual C++ 2005 or later
466
467 If you don't already have Visual C++, then the easiest way to get it is by
468 installing the Windows SDK:
469
470 http://msdn.microsoft.com/en-us/windows/bb980924.aspx
471
472 The Windows SDK includes both 32-bit and 64-bit Visual C++ compilers and
473 everything necessary to build libjpeg-turbo.
474
475 * You can also use Microsoft Visual Studio Express Edition, which is a free
476 download. (NOTE: versions prior to 2012 can only be used to build 32-bit
477 code.)
478 * If you intend to build libjpeg-turbo from the command line, then add the
479 appropriate compiler and SDK directories to the `INCLUDE`, `LIB`, and
480 `PATH` environment variables. This is generally accomplished by
481 executing `vcvars32.bat` or `vcvars64.bat` and `SetEnv.cmd`.
482 `vcvars32.bat` and `vcvars64.bat` are part of Visual C++ and are located in
483 the same directory as the compiler. `SetEnv.cmd` is part of the Windows
484 SDK. You can pass optional arguments to `SetEnv.cmd` to specify a 32-bit
485 or 64-bit build environment.
486
487 ... OR ...
488
489 - MinGW
490
491 MinGW-builds (http://sourceforge.net/projects/mingwbuilds/) or
492 tdm-gcc (http://tdm-gcc.tdragon.net/) recommended if building on a Windows
493 machine. Both distributions install a Start Menu link that can be used to
494 launch a command prompt with the appropriate compiler paths automatically
495 set.
496
497 - [NASM](http://www.nasm.us/) 0.98 or later (NASM 2.05 or later is required for
498 a 64-bit build)
499
500 - If building the TurboJPEG Java wrapper, JDK 1.5 or later is required. This
501 can be downloaded from http://www.java.com.
502
503
504 Out-of-Tree Builds
505 ------------------
506
507 Binary objects, libraries, and executables are generated in the same directory
508 from which `cmake` was executed (the "binary directory"), and this directory
509 need not necessarily be the same as the libjpeg-turbo source directory. You
510 can create multiple independent binary directories, in which different versions
511 of libjpeg-turbo can be built from the same source tree using different
512 compilers or settings. In the sections below, *{build_directory}* refers to
513 the binary directory, whereas *{source_directory}* refers to the libjpeg-turbo
514 source directory. For in-tree builds, these directories are the same.
515
516
517 Building libjpeg-turbo
518 ----------------------
519
520
521 ### Visual C++ (Command Line)
522
523 cd {build_directory}
524 cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release {source_directory}
525 nmake
526
527 This will build either a 32-bit or a 64-bit version of libjpeg-turbo, depending
528 on which version of cl.exe is in the `PATH`.
529
530 The following files will be generated under *{build_directory}*:
531
532 **jpeg-static.lib**
533 Static link library for the libjpeg API
534
535 **sharedlib/jpeg{version}.dll**
536 DLL for the libjpeg API
537
538 **sharedlib/jpeg.lib**
539 Import library for the libjpeg API
540
541 **turbojpeg-static.lib**
542 Static link library for the TurboJPEG API
543
544 **turbojpeg.dll**
545 DLL for the TurboJPEG API
546
547 **turbojpeg.lib**
548 Import library for the TurboJPEG API
549
550 *{version}* is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or
551 v8 emulation is enabled.
552
553
554 ### Visual C++ (IDE)
555
556 Choose the appropriate CMake generator option for your version of Visual Studio
557 (run `cmake` with no arguments for a list of available generators.) For
558 instance:
559
560 cd {build_directory}
561 cmake -G "Visual Studio 10" {source_directory}
562
563 NOTE: Add "Win64" to the generator name (for example, "Visual Studio 10
564 Win64") to build a 64-bit version of libjpeg-turbo. Recent versions of CMake
565 no longer document that. A separate build directory must be used for 32-bit
566 and 64-bit builds.
567
568 You can then open ALL_BUILD.vcproj in Visual Studio and build one of the
569 configurations in that project ("Debug", "Release", etc.) to generate a full
570 build of libjpeg-turbo.
571
572 This will generate the following files under *{build_directory}*:
573
574 **{configuration}/jpeg-static.lib**
575 Static link library for the libjpeg API
576
577 **sharedlib/{configuration}/jpeg{version}.dll**
578 DLL for the libjpeg API
579
580 **sharedlib/{configuration}/jpeg.lib**
581 Import library for the libjpeg API
582
583 **{configuration}/turbojpeg-static.lib**
584 Static link library for the TurboJPEG API
585
586 **{configuration}/turbojpeg.dll**
587 DLL for the TurboJPEG API
588
589 **{configuration}/turbojpeg.lib**
590 Import library for the TurboJPEG API
591
592 *{configuration}* is Debug, Release, RelWithDebInfo, or MinSizeRel, depending
593 on the configuration you built in the IDE, and *{version}* is 62, 7, or 8,
594 depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled.
595
596
597 ### MinGW
598
599 NOTE: This assumes that you are building on a Windows machine. If you are
600 cross-compiling on a Linux/Unix machine, then see "Build Recipes" below.
601
602 cd {build_directory}
603 cmake -G "MinGW Makefiles" {source_directory}
604 mingw32-make
605
606 This will generate the following files under *{build_directory}*:
607
608 **libjpeg.a**
609 Static link library for the libjpeg API
610
611 **sharedlib/libjpeg-{version}.dll**
612 DLL for the libjpeg API
613
614 **sharedlib/libjpeg.dll.a**
615 Import library for the libjpeg API
616
617 **libturbojpeg.a**
618 Static link library for the TurboJPEG API
619
620 **libturbojpeg.dll**
621 DLL for the TurboJPEG API
622
623 **libturbojpeg.dll.a**
624 Import library for the TurboJPEG API
625
626 *{version}* is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or
627 v8 emulation is enabled.
628
629
630 ### Debug Build
631
632 Add `-DCMAKE_BUILD_TYPE=Debug` to the `cmake` command line. Or, if building
633 with NMake, remove `-DCMAKE_BUILD_TYPE=Release` (Debug builds are the default
634 with NMake.)
635
636
637 ### libjpeg v7 or v8 API/ABI Emulation
638
639 Add `-DWITH_JPEG7=1` to the `cmake` command line to build a version of
640 libjpeg-turbo that is API/ABI-compatible with libjpeg v7. Add `-DWITH_JPEG8=1`
641 to the `cmake` command line to build a version of libjpeg-turbo that is
642 API/ABI-compatible with libjpeg v8. See [README.md](README.md) for more
643 information on libjpeg v7 and v8 emulation.
644
645
646 ### In-Memory Source/Destination Managers
647
648 When using libjpeg v6b or v7 API/ABI emulation, add `-DWITH_MEM_SRCDST=0` to
649 the `cmake` command line to build a version of libjpeg-turbo that lacks the
650 `jpeg_mem_src()` and `jpeg_mem_dest()` functions. These functions were not
651 part of the original libjpeg v6b and v7 APIs, so removing them ensures strict
652 conformance with those APIs. See [README.md](README.md) for more information.
653
654
655 ### Arithmetic Coding Support
656
657 Since the patent on arithmetic coding has expired, this functionality has been
658 included in this release of libjpeg-turbo. libjpeg-turbo's implementation is
659 based on the implementation in libjpeg v8, but it works when emulating libjpeg
660 v7 or v6b as well. The default is to enable both arithmetic encoding and
661 decoding, but those who have philosophical objections to arithmetic coding can
662 add `-DWITH_ARITH_ENC=0` or `-DWITH_ARITH_DEC=0` to the `cmake` command line to
663 disable encoding or decoding (respectively.)
664
665
666 ### TurboJPEG Java Wrapper
667
668 Add `-DWITH_JAVA=1` to the `cmake` command line to incorporate an optional Java
669 Native Interface wrapper into the TurboJPEG shared library and build the Java
670 front-end classes to support it. This allows the TurboJPEG shared library to
671 be used directly from Java applications. See [java/README](java/README) for
672 more details.
673
674 If you are using CMake 2.8, you can set the `Java_JAVAC_EXECUTABLE`,
675 `Java_JAVA_EXECUTABLE`, and `Java_JAR_EXECUTABLE` CMake variables to specify
676 alternate commands or locations for javac, jar, and java (respectively.) You
677 can also set the `JAVACFLAGS` CMake variable to specify arguments that should
678 be passed to the Java compiler when building the front-end classes.
679
680
681 Installing libjpeg-turbo
682 ------------------------
683
684 You can use the build system to install libjpeg-turbo into a directory of your
685 choosing (as opposed to creating an installer.) To do this, add:
686
687 -DCMAKE_INSTALL_PREFIX={install_directory}
688
689 to the cmake command line.
690
691 For example,
692
693 cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release \
694 -DCMAKE_INSTALL_PREFIX=c:\libjpeg-turbo {source_directory}
695 nmake install
696
697 will install the header files in c:\libjpeg-turbo\include, the library files
698 in c:\libjpeg-turbo\lib, the DLL's in c:\libjpeg-turbo\bin, and the
699 documentation in c:\libjpeg-turbo\doc.
700
701
702 Build Recipes
703 -------------
704
705
706 ### 64-bit MinGW Build on Cygwin
707
708 cd {build_directory}
709 CC=/usr/bin/x86_64-w64-mingw32-gcc \
710 cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
711 -DCMAKE_RC_COMPILER=/usr/bin/x86_64-w64-mingw32-windres.exe \
712 {source_directory}
713 make
714
715 This produces a 64-bit build of libjpeg-turbo that does not depend on
716 cygwin1.dll or other Cygwin DLL's. The mingw64-x86\_64-gcc-core and
717 mingw64-x86\_64-gcc-g++ packages (and their dependencies) must be installed.
718
719
720 ### 32-bit MinGW Build on Cygwin
721
722 cd {build_directory}
723 CC=/usr/bin/i686-w64-mingw32-gcc \
724 cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
725 -DCMAKE_RC_COMPILER=/usr/bin/i686-w64-mingw32-windres.exe \
726 {source_directory}
727 make
728
729 This produces a 32-bit build of libjpeg-turbo that does not depend on
730 cygwin1.dll or other Cygwin DLL's. The mingw64-i686-gcc-core and
731 mingw64-i686-gcc-g++ packages (and their dependencies) must be installed.
732
733
734 ### MinGW Build on Linux
735
736 cd {build_directory}
737 CC={mingw_binary_path}/i686-pc-mingw32-gcc \
738 cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
739 -DCMAKE_RC_COMPILER={mingw_binary_path}/i686-pc-mingw32-windres \
740 -DCMAKE_AR={mingw_binary_path}/i686-pc-mingw32-ar \
741 -DCMAKE_RANLIB={mingw_binary_path}/i686-pc-mingw32-ranlib \
742 {source_directory}
743 make
744
745
746 Creating Release Packages
747 =========================
748
749 The following commands can be used to create various types of release packages:
750
751
752 Unix/Linux
753 ----------
754
755 make rpm
756
757 Create Red Hat-style binary RPM package. Requires RPM v4 or later.
758
759 make srpm
760
761 This runs `make dist` to create a pristine source tarball, then creates a
762 Red Hat-style source RPM package from the tarball. Requires RPM v4 or later.
763
764 make deb
765
766 Create Debian-style binary package. Requires dpkg.
767
768 make dmg
769
770 Create Macintosh package/disk image. This requires pkgbuild and
771 productbuild, which are installed by default on OS X 10.7 and later and which
772 can be obtained by installing Xcode 3.2.6 (with the "Unix Development"
773 option) on OS X 10.6. Packages built in this manner can be installed on OS X
774 10.5 and later, but they must be built on OS X 10.6 or later.
775
776 make udmg [BUILDDIR32={32-bit build directory}]
777
778 On 64-bit OS X systems, this creates a Macintosh package and disk image that
779 contains universal i386/x86-64 binaries. You should first configure a 32-bit
780 out-of-tree build of libjpeg-turbo, then configure a 64-bit out-of-tree
781 build, then run `make udmg` from the 64-bit build directory. The build
782 system will look for the 32-bit build under *{source_directory}*/osxx86 by
783 default, but you can override this by setting the `BUILDDIR32` variable on the
784 make command line as shown above.
785
786 make iosdmg [BUILDDIR32={32-bit build directory}] \
787 [BUILDDIRARMV6={ARMv6 build directory}] \
788 [BUILDDIRARMV7={ARMv7 build directory}] \
789 [BUILDDIRARMV7S={ARMv7s build directory}] \
790 [BUILDDIRARMV8={ARMv8 build directory}]
791
792 On OS X systems, this creates a Macintosh package and disk image in which the
793 libjpeg-turbo static libraries contain ARM architectures necessary to build
794 iOS applications. If building on an x86-64 system, the binaries will also
795 contain the i386 architecture, as with `make udmg` above. You should first
796 configure ARMv6, ARMv7, ARMv7s, and/or ARMv8 out-of-tree builds of
797 libjpeg-turbo (see "Building libjpeg-turbo for iOS" above.) If you are
798 building an x86-64 version of libjpeg-turbo, you should configure a 32-bit
799 out-of-tree build as well. Next, build libjpeg-turbo as you would normally,
800 using an out-of-tree build. When it is built, run `make iosdmg` from the
801 build directory. The build system will look for the ARMv6 build under
802 *{source_directory}*/iosarmv6 by default, the ARMv7 build under
803 *{source_directory}*/iosarmv7 by default, the ARMv7s build under
804 *{source_directory}*/iosarmv7s by default, the ARMv8 build under
805 *{source_directory}*/iosarmv8 by default, and (if applicable) the 32-bit build
806 under *{source_directory}*/osxx86 by default, but you can override this by
807 setting the `BUILDDIR32`, `BUILDDIRARMV6`, `BUILDDIRARMV7`, `BUILDDIRARMV7S`,
808 and/or `BUILDDIRARMV8` variables on the `make` command line as shown above.
809
810 NOTE: If including an ARMv8 build in the package, then you may need to use
811 Xcode's version of lipo instead of the operating system's. To do this, pass
812 an argument of `LIPO="xcrun lipo"` on the make command line.
813
814 make cygwinpkg
815
816 Build a Cygwin binary package.
817
818
819 Windows
820 -------
821
822 If using NMake:
823
824 cd {build_directory}
825 nmake installer
826
827 If using MinGW:
828
829 cd {build_directory}
830 make installer
831
832 If using the Visual Studio IDE, build the "installer" project.
833
834 The installer package (libjpeg-turbo[-gcc][64].exe) will be located under
835 *{build_directory}*. If building using the Visual Studio IDE, then the
836 installer package will be located in a subdirectory with the same name as the
837 configuration you built (such as *{build_directory}*\Debug\ or
838 *{build_directory}*\Release\).
839
840 Building a Windows installer requires the Nullsoft Install System
841 (http://nsis.sourceforge.net/.) makensis.exe should be in your `PATH`.
842
843
844 Regression testing
845 ==================
846
847 The most common way to test libjpeg-turbo is by invoking `make test` on
848 Unix/Linux platforms or `ctest` on Windows platforms, once the build has
849 completed. This runs a series of tests to ensure that mathematical
850 compatibility has been maintained between libjpeg-turbo and libjpeg v6b. This
851 also invokes the TurboJPEG unit tests, which ensure that the colorspace
852 extensions, YUV encoding, decompression scaling, and other features of the
853 TurboJPEG C and Java APIs are working properly (and, by extension, that the
854 equivalent features of the underlying libjpeg API are also working.)
855
856 Invoking `make testclean` or `nmake testclean` (if using NMake) or building
857 the 'testclean' target (if using the Visual Studio IDE) will clean up the
858 output images generated by `make test`.
859
860 On Unix/Linux platforms, more extensive tests of the TurboJPEG C and Java
861 wrappers can be run by invoking `make tjtest`. These extended TurboJPEG tests
862 essentially iterate through all of the available features of the TurboJPEG APIs
863 that are not covered by the TurboJPEG unit tests (this includes the lossless
864 transform options) and compare the images generated by each feature to images
865 generated using the equivalent feature in the libjpeg API. The extended
866 TurboJPEG tests are meant to test for regressions in the TurboJPEG wrappers,
867 not in the underlying libjpeg API library.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698