DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 1 | ******************************************************************************* |
DRC | f32640e | 2013-03-23 09:57:03 +0000 | [diff] [blame] | 2 | ** Building on Un*x Platforms (including Cygwin and OS X) |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 3 | ******************************************************************************* |
| 4 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 5 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 6 | ================== |
| 7 | Build Requirements |
| 8 | ================== |
| 9 | |
| 10 | -- autoconf 2.56 or later |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 11 | -- automake 1.7 or later |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 12 | -- libtool 1.4 or later |
DRC | f32640e | 2013-03-23 09:57:03 +0000 | [diff] [blame] | 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 MacPorts |
| 15 | (http://www.macports.org/). |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 16 | |
DRC | 94755ce | 2011-10-19 05:13:27 +0000 | [diff] [blame] | 17 | -- NASM (if building x86 or x86-64 SIMD extensions) |
DRC | 254937b | 2011-04-16 13:35:35 +0000 | [diff] [blame] | 18 | * 0.98, or 2.01 or later is required for a 32-bit build |
| 19 | * NASM 2.00 or later is required for a 64-bit build |
DRC | 9026b37 | 2011-04-16 13:37:22 +0000 | [diff] [blame] | 20 | * NASM 2.07 or later is required for a 64-bit build on OS X. This can be |
DRC | 0dedd1a | 2010-07-02 09:20:12 +0000 | [diff] [blame] | 21 | obtained from MacPorts (http://www.macports.org/). |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 22 | |
DRC | 254937b | 2011-04-16 13:35:35 +0000 | [diff] [blame] | 23 | The binary RPMs released by the NASM project do not work on older Linux |
| 24 | systems, such as Red Hat Enterprise Linux 4. On such systems, you can |
| 25 | easily build and install NASM from a source RPM by downloading one of the |
| 26 | SRPMs from |
| 27 | |
| 28 | http://www.nasm.us/pub/nasm/releasebuilds |
| 29 | |
| 30 | and executing the following as root: |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 31 | |
| 32 | ARCH=`uname -m` |
DRC | 254937b | 2011-04-16 13:35:35 +0000 | [diff] [blame] | 33 | rpmbuild --rebuild nasm-{version}.src.rpm |
| 34 | rpm -Uvh /usr/src/redhat/RPMS/$ARCH/nasm-{version}.$ARCH.rpm |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 35 | |
DRC | 254937b | 2011-04-16 13:35:35 +0000 | [diff] [blame] | 36 | NOTE: the NASM build will fail if texinfo is not installed. |
DRC | c3f4ac0 | 2010-02-19 21:51:26 +0000 | [diff] [blame] | 37 | |
DRC | 8f870c2 | 2010-02-24 00:30:00 +0000 | [diff] [blame] | 38 | -- GCC v4.1 or later recommended for best performance |
DRC | f32640e | 2013-03-23 09:57:03 +0000 | [diff] [blame] | 39 | * Beginning with Xcode 4, Apple stopped distributing GCC and switched to |
DRC | 08769b3 | 2013-03-23 21:35:41 +0000 | [diff] [blame] | 40 | the LLVM compiler. Xcode v4.0 through v4.6 provides a GCC front end |
| 41 | called LLVM-GCC. Unfortunately, as of this writing, neither LLVM-GCC nor |
| 42 | the LLVM (clang) compiler produces optimal performance with libjpeg-turbo. |
DRC | f32640e | 2013-03-23 09:57:03 +0000 | [diff] [blame] | 43 | Building libjpeg-turbo with LLVM-GCC v4.2 results in a 10% performance |
| 44 | degradation when compressing using 64-bit code, relative to building |
| 45 | libjpeg-turbo with GCC v4.2. Building libjpeg-turbo with LLVM (clang) |
| 46 | results in a 20% performance degradation when compressing using 64-bit |
| 47 | code, relative to building libjpeg-turbo with GCC v4.2. If you are |
| 48 | running Snow Leopard or earlier, it is suggested that you continue to use |
| 49 | Xcode v3.2.6, which provides GCC v4.2. If you are using Lion or later, it |
| 50 | is suggested that you install Apple GCC v4.2 through MacPorts. |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 51 | |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 52 | -- If building the TurboJPEG Java wrapper, JDK or OpenJDK 1.5 or later is |
DRC | 279bd34 | 2011-04-02 05:17:12 +0000 | [diff] [blame] | 53 | required. Some systems, such as OS X 10.4, Solaris 10 and later, and Red |
| 54 | Hat Enterprise Linux 5 and later, have this pre-installed. On OS X 10.5 and |
| 55 | later, it will be necessary to install the Java Developer Package, which can |
DRC | 24f11a7 | 2013-09-23 18:38:20 +0000 | [diff] [blame] | 56 | be downloaded from http://developer.apple.com/downloads (Apple ID required.) |
| 57 | For systems that do not have a JDK installed, you can obtain the Oracle Java |
| 58 | Development Kit from http://www.java.com. |
DRC | f8e0055 | 2011-02-04 11:06:36 +0000 | [diff] [blame] | 59 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 60 | |
| 61 | ================== |
| 62 | Out-of-Tree Builds |
| 63 | ================== |
| 64 | |
| 65 | Binary objects, libraries, and executables are generated in the same directory |
| 66 | from which configure was executed (the "binary directory"), and this directory |
| 67 | need not necessarily be the same as the libjpeg-turbo source directory. You |
| 68 | can create multiple independent binary directories, in which different versions |
| 69 | of libjpeg-turbo can be built from the same source tree using different |
| 70 | compilers or settings. In the sections below, {build_directory} refers to the |
| 71 | binary directory, whereas {source_directory} refers to the libjpeg-turbo source |
| 72 | directory. For in-tree builds, these directories are the same. |
| 73 | |
| 74 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 75 | ====================== |
| 76 | Building libjpeg-turbo |
| 77 | ====================== |
| 78 | |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 79 | The following procedure will build libjpeg-turbo on Linux, FreeBSD, Cygwin, and |
| 80 | Solaris/x86 systems (on Solaris, this generates a 32-bit library. See below |
| 81 | for 64-bit build instructions.) |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 82 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 83 | cd {source_directory} |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 84 | autoreconf -fiv |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 85 | cd {build_directory} |
DRC | 98dbe91 | 2010-11-04 22:22:30 +0000 | [diff] [blame] | 86 | sh {source_directory}/configure [additional configure flags] |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 87 | make |
| 88 | |
DRC | fde862b | 2013-02-11 03:38:53 +0000 | [diff] [blame] | 89 | NOTE: Running autoreconf in the source directory is usually only necessary if |
| 90 | building libjpeg-turbo from the SVN repository. |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 91 | |
| 92 | This will generate the following files under .libs/ |
| 93 | |
| 94 | libjpeg.a |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 95 | Static link library for the libjpeg API |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 96 | |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 97 | libjpeg.so.{version} (Linux, Unix) |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 98 | libjpeg.{version}.dylib (OS X) |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 99 | cygjpeg-{version}.dll (Cygwin) |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 100 | Shared library for the libjpeg API |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 101 | |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 102 | By default, {version} is 62.1.0, 7.1.0, or 8.0.2, depending on whether |
| 103 | libjpeg v6b (default), v7, or v8 emulation is enabled. If using Cygwin, |
| 104 | {version} is 62, 7, or 8. |
| 105 | |
| 106 | libjpeg.so (Linux, Unix) |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 107 | libjpeg.dylib (OS X) |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 108 | Development symlink for the libjpeg API |
| 109 | |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 110 | libjpeg.dll.a (Cygwin) |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 111 | Import library for the libjpeg API |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 112 | |
| 113 | libturbojpeg.a |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 114 | Static link library for the TurboJPEG API |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 115 | |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 116 | libturbojpeg.so.0.0.0 (Linux, Unix) |
| 117 | libturbojpeg.0.0.0.dylib (OS X) |
| 118 | cygturbojpeg-0.dll (Cygwin) |
| 119 | Shared library for the TurboJPEG API |
| 120 | |
| 121 | libturbojpeg.so (Linux, Unix) |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 122 | libturbojpeg.dylib (OS X) |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 123 | Development symlink for the TurboJPEG API |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 124 | |
| 125 | libturbojpeg.dll.a (Cygwin) |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 126 | Import library for the TurboJPEG API |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 127 | |
| 128 | |
DRC | 3091354 | 2012-01-27 09:53:33 +0000 | [diff] [blame] | 129 | libjpeg v7 or v8 API/ABI Emulation |
| 130 | ---------------------------------- |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 131 | |
| 132 | Add --with-jpeg7 to the configure command line to build a version of |
DRC | 3091354 | 2012-01-27 09:53:33 +0000 | [diff] [blame] | 133 | libjpeg-turbo that is API/ABI-compatible with libjpeg v7. Add --with-jpeg8 to |
| 134 | the configure command to build a version of libjpeg-turbo that is |
| 135 | API/ABI-compatible with libjpeg v8. See README-turbo.txt for more information |
| 136 | on libjpeg v7 and v8 emulation. |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 137 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 138 | |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 139 | In-Memory Source/Destination Managers |
| 140 | ------------------------------------- |
| 141 | |
| 142 | When using libjpeg v6b or v7 API/ABI emulation, add --without-mem-srcdst to the |
| 143 | configure command line to build a version of libjpeg-turbo that lacks the |
| 144 | jpeg_mem_src() and jpeg_mem_dest() functions. These functions were not part of |
| 145 | the original libjpeg v6b and v7 APIs, so removing them ensures strict |
| 146 | conformance with those APIs. See README-turbo.txt for more information. |
| 147 | |
| 148 | |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 149 | Arithmetic Coding Support |
| 150 | ------------------------- |
| 151 | |
| 152 | Since the patent on arithmetic coding has expired, this functionality has been |
| 153 | included in this release of libjpeg-turbo. libjpeg-turbo's implementation is |
DRC | f38eee0 | 2011-02-18 07:00:38 +0000 | [diff] [blame] | 154 | based on the implementation in libjpeg v8, but it works when emulating libjpeg |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 155 | v7 or v6b as well. The default is to enable both arithmetic encoding and |
| 156 | decoding, but those who have philosophical objections to arithmetic coding can |
| 157 | add --without-arith-enc or --without-arith-dec to the configure command line to |
| 158 | disable encoding or decoding (respectively.) |
| 159 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 160 | |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 161 | TurboJPEG Java Wrapper |
| 162 | ---------------------- |
DRC | 88f54a4 | 2011-04-01 01:21:22 +0000 | [diff] [blame] | 163 | Add --with-java to the configure command line to incorporate an optional Java |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 164 | Native Interface wrapper into the TurboJPEG shared library and build the Java |
| 165 | front-end classes to support it. This allows the TurboJPEG shared library to |
| 166 | be used directly from Java applications. See java/README for more details. |
DRC | 88f54a4 | 2011-04-01 01:21:22 +0000 | [diff] [blame] | 167 | |
| 168 | You can set the JAVAC, JAR, and JAVA configure variables to specify |
| 169 | alternate commands for javac, jar, and java (respectively.) You can also |
| 170 | set the JAVACFLAGS configure variable to specify arguments that should be |
| 171 | passed to the Java compiler when building the front-end classes, and JNI_CFLAGS |
| 172 | to specify arguments that should be passed to the C compiler when building the |
| 173 | JNI wrapper. Run 'configure --help' for more details. |
DRC | f8e0055 | 2011-02-04 11:06:36 +0000 | [diff] [blame] | 174 | |
| 175 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 176 | ======================== |
| 177 | Installing libjpeg-turbo |
| 178 | ======================== |
| 179 | |
| 180 | If you intend to install these libraries and the associated header files, then |
| 181 | replace 'make' in the instructions above with |
| 182 | |
| 183 | make install prefix={base dir} libdir={library directory} |
| 184 | |
| 185 | For example, |
| 186 | |
| 187 | make install prefix=/usr/local libdir=/usr/local/lib64 |
| 188 | |
| 189 | will install the header files in /usr/local/include and the library files in |
| 190 | /usr/local/lib64. If 'prefix' and 'libdir' are not specified, then the default |
| 191 | is to install the header files in /opt/libjpeg-turbo/include and the library |
DRC | d7a642b | 2013-04-24 06:40:25 +0000 | [diff] [blame] | 192 | files in /opt/libjpeg-turbo/lib32 (32-bit) or /opt/libjpeg-turbo/lib64 |
| 193 | (64-bit.) |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 194 | |
| 195 | NOTE: You can specify a prefix of /usr and a libdir of, for instance, |
| 196 | /usr/lib64 to overwrite the system's version of libjpeg. If you do this, |
| 197 | however, then be sure to BACK UP YOUR SYSTEM'S INSTALLATION OF LIBJPEG before |
| 198 | overwriting it. It is recommended that you instead install libjpeg-turbo into |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 199 | a non-system directory and manipulate the LD_LIBRARY_PATH or create symlinks |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 200 | to force applications to use libjpeg-turbo instead of libjpeg. See |
| 201 | README-turbo.txt for more information. |
| 202 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 203 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 204 | ============= |
| 205 | Build Recipes |
| 206 | ============= |
| 207 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 208 | |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 209 | 32-bit Build on 64-bit Linux |
| 210 | ---------------------------- |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 211 | |
DRC | ca5e7d1 | 2010-02-17 02:25:06 +0000 | [diff] [blame] | 212 | Add |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 213 | |
DRC | 2e4d044 | 2011-02-08 01:18:37 +0000 | [diff] [blame] | 214 | --host i686-pc-linux-gnu CFLAGS='-O3 -m32' LDFLAGS=-m32 |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 215 | |
| 216 | to the configure command line. |
| 217 | |
| 218 | |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 219 | 64-bit Build on 64-bit OS X |
| 220 | --------------------------- |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 221 | |
DRC | ca5e7d1 | 2010-02-17 02:25:06 +0000 | [diff] [blame] | 222 | Add |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 223 | |
DRC | 0dedd1a | 2010-07-02 09:20:12 +0000 | [diff] [blame] | 224 | --host x86_64-apple-darwin NASM=/opt/local/bin/nasm |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 225 | |
DRC | 7bac07b | 2010-04-10 05:53:35 +0000 | [diff] [blame] | 226 | to the configure command line. NASM 2.07 or later from MacPorts must be |
| 227 | installed. |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 228 | |
| 229 | |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 230 | 32-bit Build on 64-bit OS X |
| 231 | --------------------------- |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 232 | |
DRC | ca5e7d1 | 2010-02-17 02:25:06 +0000 | [diff] [blame] | 233 | Add |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 234 | |
DRC | 5950c5d | 2012-06-28 23:22:03 +0000 | [diff] [blame] | 235 | --host i686-apple-darwin CFLAGS='-O3 -m32' LDFLAGS=-m32 |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 236 | |
| 237 | to the configure command line. |
| 238 | |
| 239 | |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 240 | 64-bit Backward-Compatible Build on 64-bit OS X |
| 241 | ----------------------------------------------- |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 242 | |
DRC | ca5e7d1 | 2010-02-17 02:25:06 +0000 | [diff] [blame] | 243 | Add |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 244 | |
DRC | 0dedd1a | 2010-07-02 09:20:12 +0000 | [diff] [blame] | 245 | --host x86_64-apple-darwin NASM=/opt/local/bin/nasm \ |
| 246 | CFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \ |
| 247 | -mmacosx-version-min=10.4 -O3' \ |
DRC | 0dedd1a | 2010-07-02 09:20:12 +0000 | [diff] [blame] | 248 | LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \ |
| 249 | -mmacosx-version-min=10.4' |
| 250 | |
DRC | 575c342 | 2010-07-08 07:01:20 +0000 | [diff] [blame] | 251 | to the configure command line. The OS X 10.4 SDK, and NASM 2.07 or later from |
| 252 | MacPorts, must be installed. |
DRC | 0dedd1a | 2010-07-02 09:20:12 +0000 | [diff] [blame] | 253 | |
| 254 | |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 255 | 32-bit Backward-Compatible Build on OS X |
| 256 | ---------------------------------------- |
DRC | 0dedd1a | 2010-07-02 09:20:12 +0000 | [diff] [blame] | 257 | |
| 258 | Add |
| 259 | |
DRC | 5950c5d | 2012-06-28 23:22:03 +0000 | [diff] [blame] | 260 | --host i686-apple-darwin \ |
| 261 | CFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \ |
DRC | 485cd80 | 2010-02-23 23:23:42 +0000 | [diff] [blame] | 262 | -mmacosx-version-min=10.4 -O3 -m32' \ |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 263 | LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \ |
| 264 | -mmacosx-version-min=10.4 -m32' |
| 265 | |
| 266 | to the configure command line. The OS X 10.4 SDK must be installed. |
| 267 | |
| 268 | |
| 269 | 64-bit Library Build on 64-bit Solaris |
| 270 | -------------------------------------- |
| 271 | |
DRC | ca5e7d1 | 2010-02-17 02:25:06 +0000 | [diff] [blame] | 272 | Add |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 273 | |
DRC | 2e4d044 | 2011-02-08 01:18:37 +0000 | [diff] [blame] | 274 | --host x86_64-pc-solaris CFLAGS='-O3 -m64' LDFLAGS=-m64 |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 275 | |
| 276 | to the configure command line. |
| 277 | |
| 278 | |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 279 | 32-bit Build on 64-bit FreeBSD |
| 280 | ------------------------------ |
DRC | 7bac07b | 2010-04-10 05:53:35 +0000 | [diff] [blame] | 281 | |
| 282 | Add |
| 283 | |
DRC | 2e4d044 | 2011-02-08 01:18:37 +0000 | [diff] [blame] | 284 | --host i386-unknown-freebsd CC='gcc -B /usr/lib32' CFLAGS='-O3 -m32' \ |
| 285 | LDFLAGS='-B/usr/lib32' |
DRC | 7bac07b | 2010-04-10 05:53:35 +0000 | [diff] [blame] | 286 | |
| 287 | to the configure command line. NASM 2.07 or later from FreeBSD ports must be |
| 288 | installed. |
| 289 | |
| 290 | |
DRC | 0559e94 | 2012-03-23 03:12:35 +0000 | [diff] [blame] | 291 | Oracle Solaris Studio |
| 292 | --------------------- |
DRC | ca5e7d1 | 2010-02-17 02:25:06 +0000 | [diff] [blame] | 293 | |
| 294 | Add |
| 295 | |
DRC | 2e4d044 | 2011-02-08 01:18:37 +0000 | [diff] [blame] | 296 | CC=cc |
DRC | ca5e7d1 | 2010-02-17 02:25:06 +0000 | [diff] [blame] | 297 | |
| 298 | to the configure command line. libjpeg-turbo will automatically be built with |
DRC | 2e4d044 | 2011-02-08 01:18:37 +0000 | [diff] [blame] | 299 | the maximum optimization level (-xO5) unless you override CFLAGS. |
DRC | ca5e7d1 | 2010-02-17 02:25:06 +0000 | [diff] [blame] | 300 | |
DRC | 0559e94 | 2012-03-23 03:12:35 +0000 | [diff] [blame] | 301 | To build a 64-bit version of libjpeg-turbo using Oracle Solaris Studio, add |
DRC | ca5e7d1 | 2010-02-17 02:25:06 +0000 | [diff] [blame] | 302 | |
DRC | 2e4d044 | 2011-02-08 01:18:37 +0000 | [diff] [blame] | 303 | --host x86_64-pc-solaris CC=cc CFLAGS='-xO5 -m64' LDFLAGS=-m64 |
DRC | ca5e7d1 | 2010-02-17 02:25:06 +0000 | [diff] [blame] | 304 | |
| 305 | to the configure command line. |
| 306 | |
DRC | 8b014d7 | 2010-02-18 13:03:41 +0000 | [diff] [blame] | 307 | |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 308 | MinGW Build on Cygwin |
| 309 | --------------------- |
| 310 | |
| 311 | Use CMake (see recipes below) |
| 312 | |
| 313 | |
DRC | 94755ce | 2011-10-19 05:13:27 +0000 | [diff] [blame] | 314 | =========== |
| 315 | ARM Support |
| 316 | =========== |
| 317 | |
| 318 | This release of libjpeg-turbo can use ARM NEON SIMD instructions to accelerate |
| 319 | JPEG compression/decompression by approximately 2-4x on ARMv7 and later |
| 320 | platforms. If libjpeg-turbo is configured on an ARM Linux platform, then the |
| 321 | build system will automatically include the NEON SIMD routines, if they are |
| 322 | supported. |
| 323 | |
| 324 | |
| 325 | Building libjpeg-turbo for iOS |
| 326 | ------------------------------ |
| 327 | |
| 328 | iOS platforms, such as the iPhone and iPad, also use ARM processors, some of |
| 329 | which support NEON instructions. Additional steps are required to build |
| 330 | libjpeg-turbo for these platforms. The steps below assume iOS SDK v4.3. If |
| 331 | you are using a different SDK version, then you will need to modify the |
| 332 | examples accordingly. |
| 333 | |
| 334 | Additional build requirements: |
| 335 | |
| 336 | gas-preprocessor.pl (https://github.com/yuvi/gas-preprocessor) should be |
| 337 | installed in your PATH. |
| 338 | |
| 339 | Set the following shell variables for simplicity: |
| 340 | |
DRC | a2a2cd6 | 2013-02-04 22:29:57 +0000 | [diff] [blame] | 341 | Xcode 3.2.x / iOS 4.3 SDK: |
DRC | 94755ce | 2011-10-19 05:13:27 +0000 | [diff] [blame] | 342 | IOS_PLATFORMDIR="/Developer/Platforms/iPhoneOS.platform" |
| 343 | IOS_SYSROOT="$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS4.3.sdk" |
| 344 | IOS_GCC="$IOS_PLATFORMDIR/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2" |
| 345 | |
DRC | a2a2cd6 | 2013-02-04 22:29:57 +0000 | [diff] [blame] | 346 | Xcode 4.5.x / iOS 6.0 SDK: |
| 347 | IOS_PLATFORMDIR="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform" |
| 348 | IOS_SYSROOT="$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS6.0.sdk" |
| 349 | IOS_GCC="$IOS_PLATFORMDIR/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2" |
| 350 | |
DRC | 94755ce | 2011-10-19 05:13:27 +0000 | [diff] [blame] | 351 | ARM v6 only (up to and including iPhone 3G): |
DRC | a2a2cd6 | 2013-02-04 22:29:57 +0000 | [diff] [blame] | 352 | [NOTE: Requires Xcode 4.4.x or earlier] |
DRC | 94755ce | 2011-10-19 05:13:27 +0000 | [diff] [blame] | 353 | IOS_CFLAGS="-march=armv6 -mcpu=arm1176jzf-s -mfpu=vfp" |
| 354 | |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 355 | ARM v7 only (iPhone 3GS-4S, iPad 1st-3rd Generation): |
DRC | 94755ce | 2011-10-19 05:13:27 +0000 | [diff] [blame] | 356 | IOS_CFLAGS="-march=armv7 -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon" |
| 357 | |
DRC | a2a2cd6 | 2013-02-04 22:29:57 +0000 | [diff] [blame] | 358 | ARM v7s only (iPhone 5, iPad 4th Generation): |
| 359 | [NOTE: Requires Xcode 4.5 or later] |
| 360 | IOS_CFLAGS="-march=armv7s -mcpu=swift -mtune=swift -mfpu=neon" |
| 361 | |
DRC | 94755ce | 2011-10-19 05:13:27 +0000 | [diff] [blame] | 362 | Follow the procedure under "Building libjpeg-turbo" above, adding |
| 363 | |
DRC | 89c59dd | 2011-10-27 20:40:21 +0000 | [diff] [blame] | 364 | --host arm-apple-darwin10 --enable-static --disable-shared \ |
DRC | 94755ce | 2011-10-19 05:13:27 +0000 | [diff] [blame] | 365 | CC="$IOS_GCC" LD="$IOS_GCC" \ |
| 366 | CFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT -O3 $IOS_CFLAGS" \ |
| 367 | LDFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT $IOS_CFLAGS" |
| 368 | |
| 369 | to the configure command line. |
| 370 | |
DRC | a2a2cd6 | 2013-02-04 22:29:57 +0000 | [diff] [blame] | 371 | Once built, lipo can be used to combine the ARM v6, v7, and/or v7s variants |
| 372 | into a universal library. |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 373 | |
DRC | fde862b | 2013-02-11 03:38:53 +0000 | [diff] [blame] | 374 | NOTE: If you are building libjpeg-turbo from the "official" project tarball, |
| 375 | then it is highly likely that you will need to run 'autoreconf -fiv' in the |
| 376 | source tree prior to building ARM v7 or v7s iOS binaries using the techniques |
| 377 | described above. Otherwise, you may get a libtool error such as "unable to |
| 378 | infer tagged configuration." |
| 379 | |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 380 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 381 | ******************************************************************************* |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 382 | ** Building on Windows (Visual C++ or MinGW) |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 383 | ******************************************************************************* |
| 384 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 385 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 386 | ================== |
| 387 | Build Requirements |
| 388 | ================== |
| 389 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 390 | -- CMake (http://www.cmake.org) v2.6 or later |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 391 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 392 | -- Microsoft Visual C++ 2005 or later |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 393 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 394 | If you don't already have Visual C++, then the easiest way to get it is by |
| 395 | installing the Windows SDK: |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 396 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 397 | http://msdn.microsoft.com/en-us/windows/bb980924.aspx |
| 398 | |
| 399 | The Windows SDK includes both 32-bit and 64-bit Visual C++ compilers and |
| 400 | everything necessary to build libjpeg-turbo. |
| 401 | |
| 402 | * For 32-bit builds, you can also use Microsoft Visual C++ Express |
| 403 | Edition. Visual C++ Express Edition is a free download. |
| 404 | * If you intend to build libjpeg-turbo from the command line, then add the |
| 405 | appropriate compiler and SDK directories to the INCLUDE, LIB, and PATH |
| 406 | environment variables. This is generally accomplished by executing |
| 407 | vcvars32.bat or vcvars64.bat and SetEnv.cmd. vcvars32.bat and |
| 408 | vcvars64.bat are part of Visual C++ and are located in the same directory |
| 409 | as the compiler. SetEnv.cmd is part of the Windows SDK. You can pass |
| 410 | optional arguments to SetEnv.cmd to specify a 32-bit or 64-bit build |
| 411 | environment. |
| 412 | |
| 413 | ... OR ... |
| 414 | |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 415 | -- MinGW |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 416 | |
| 417 | GCC v4.1 or later recommended for best performance |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 418 | |
DRC | 377add7 | 2010-05-17 16:41:12 +0000 | [diff] [blame] | 419 | -- NASM (http://www.nasm.us/) 0.98 or later (NASM 2.05 or later is required for |
| 420 | a 64-bit build) |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 421 | |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 422 | -- If building the TurboJPEG Java wrapper, JDK 1.5 or later is required. This |
| 423 | can be downloaded from http://www.java.com. |
DRC | 218c0c1 | 2011-02-05 06:01:18 +0000 | [diff] [blame] | 424 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 425 | |
| 426 | ================== |
| 427 | Out-of-Tree Builds |
| 428 | ================== |
| 429 | |
| 430 | Binary objects, libraries, and executables are generated in the same directory |
| 431 | from which cmake was executed (the "binary directory"), and this directory need |
| 432 | not necessarily be the same as the libjpeg-turbo source directory. You can |
| 433 | create multiple independent binary directories, in which different versions of |
| 434 | libjpeg-turbo can be built from the same source tree using different compilers |
| 435 | or settings. In the sections below, {build_directory} refers to the binary |
| 436 | directory, whereas {source_directory} refers to the libjpeg-turbo source |
| 437 | directory. For in-tree builds, these directories are the same. |
| 438 | |
| 439 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 440 | ====================== |
| 441 | Building libjpeg-turbo |
| 442 | ====================== |
| 443 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 444 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 445 | Visual C++ (Command Line) |
| 446 | ------------------------- |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 447 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 448 | cd {build_directory} |
| 449 | cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release {source_directory} |
| 450 | nmake |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 451 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 452 | This will build either a 32-bit or a 64-bit version of libjpeg-turbo, depending |
| 453 | on which version of cl.exe is in the PATH. |
DRC | 8b014d7 | 2010-02-18 13:03:41 +0000 | [diff] [blame] | 454 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 455 | The following files will be generated under {build_directory}: |
| 456 | |
| 457 | jpeg-static.lib |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 458 | Static link library for the libjpeg API |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 459 | sharedlib/jpeg{version}.dll |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 460 | DLL for the libjpeg API |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 461 | sharedlib/jpeg.lib |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 462 | Import library for the libjpeg API |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 463 | turbojpeg-static.lib |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 464 | Static link library for the TurboJPEG API |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 465 | turbojpeg.dll |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 466 | DLL for the TurboJPEG API |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 467 | turbojpeg.lib |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 468 | Import library for the TurboJPEG API |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 469 | |
| 470 | {version} is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or |
DRC | f38eee0 | 2011-02-18 07:00:38 +0000 | [diff] [blame] | 471 | v8 emulation is enabled. |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 472 | |
| 473 | |
| 474 | Visual C++ (IDE) |
| 475 | ---------------- |
| 476 | |
| 477 | Choose the appropriate CMake generator option for your version of Visual Studio |
| 478 | (run "cmake" with no arguments for a list of available generators.) For |
| 479 | instance: |
| 480 | |
| 481 | cd {build_directory} |
| 482 | cmake -G "Visual Studio 9 2008" {source_directory} |
| 483 | |
| 484 | You can then open ALL_BUILD.vcproj in Visual Studio and build one of the |
| 485 | configurations in that project ("Debug", "Release", etc.) to generate a full |
| 486 | build of libjpeg-turbo. |
| 487 | |
| 488 | This will generate the following files under {build_directory}: |
| 489 | |
| 490 | {configuration}/jpeg-static.lib |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 491 | Static link library for the libjpeg API |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 492 | sharedlib/{configuration}/jpeg{version}.dll |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 493 | DLL for the libjpeg API |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 494 | sharedlib/{configuration}/jpeg.lib |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 495 | Import library for the libjpeg API |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 496 | {configuration}/turbojpeg-static.lib |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 497 | Static link library for the TurboJPEG API |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 498 | {configuration}/turbojpeg.dll |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 499 | DLL for the TurboJPEG API |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 500 | {configuration}/turbojpeg.lib |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 501 | Import library for the TurboJPEG API |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 502 | |
| 503 | {configuration} is Debug, Release, RelWithDebInfo, or MinSizeRel, depending on |
| 504 | the configuration you built in the IDE, and {version} is 62, 7, or 8, |
DRC | f38eee0 | 2011-02-18 07:00:38 +0000 | [diff] [blame] | 505 | depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled. |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 506 | |
| 507 | |
| 508 | MinGW |
| 509 | ----- |
| 510 | |
| 511 | cd {build_directory} |
| 512 | cmake -G "MSYS Makefiles" {source_directory} |
| 513 | make |
| 514 | |
| 515 | This will generate the following files under {build_directory} |
| 516 | |
| 517 | libjpeg.a |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 518 | Static link library for the libjpeg API |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 519 | sharedlib/libjpeg-{version}.dll |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 520 | DLL for the libjpeg API |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 521 | sharedlib/libjpeg.dll.a |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 522 | Import library for the libjpeg API |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 523 | libturbojpeg.a |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 524 | Static link library for the TurboJPEG API |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 525 | libturbojpeg.dll |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 526 | DLL for the TurboJPEG API |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 527 | libturbojpeg.dll.a |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 528 | Import library for the TurboJPEG API |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 529 | |
| 530 | {version} is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or |
DRC | f38eee0 | 2011-02-18 07:00:38 +0000 | [diff] [blame] | 531 | v8 emulation is enabled. |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 532 | |
| 533 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 534 | Debug Build |
| 535 | ----------- |
| 536 | |
| 537 | Add "-DCMAKE_BUILD_TYPE=Debug" to the cmake command line. Or, if building with |
| 538 | NMake, remove "-DCMAKE_BUILD_TYPE=Release" (Debug builds are the default with |
| 539 | NMake.) |
| 540 | |
| 541 | |
DRC | 3091354 | 2012-01-27 09:53:33 +0000 | [diff] [blame] | 542 | libjpeg v7 or v8 API/ABI Emulation |
| 543 | ----------------------------------- |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 544 | |
| 545 | Add "-DWITH_JPEG7=1" to the cmake command line to build a version of |
DRC | 3091354 | 2012-01-27 09:53:33 +0000 | [diff] [blame] | 546 | libjpeg-turbo that is API/ABI-compatible with libjpeg v7. Add "-DWITH_JPEG8=1" |
| 547 | to the cmake command to build a version of libjpeg-turbo that is |
| 548 | API/ABI-compatible with libjpeg v8. See README-turbo.txt for more information |
| 549 | on libjpeg v7 and v8 emulation. |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 550 | |
| 551 | |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 552 | In-Memory Source/Destination Managers |
| 553 | ------------------------------------- |
| 554 | |
| 555 | When using libjpeg v6b or v7 API/ABI emulation, add -DWITH_MEM_SRCDST=0 to the |
| 556 | CMake command line to build a version of libjpeg-turbo that lacks the |
| 557 | jpeg_mem_src() and jpeg_mem_dest() functions. These functions were not part of |
| 558 | the original libjpeg v6b and v7 APIs, so removing them ensures strict |
| 559 | conformance with those APIs. See README-turbo.txt for more information. |
| 560 | |
| 561 | |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 562 | Arithmetic Coding Support |
| 563 | ------------------------- |
| 564 | |
| 565 | Since the patent on arithmetic coding has expired, this functionality has been |
| 566 | included in this release of libjpeg-turbo. libjpeg-turbo's implementation is |
DRC | f38eee0 | 2011-02-18 07:00:38 +0000 | [diff] [blame] | 567 | based on the implementation in libjpeg v8, but it works when emulating libjpeg |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 568 | v7 or v6b as well. The default is to enable both arithmetic encoding and |
| 569 | decoding, but those who have philosophical objections to arithmetic coding can |
| 570 | add "-DWITH_ARITH_ENC=0" or "-DWITH_ARITH_DEC=0" to the cmake command line to |
| 571 | disable encoding or decoding (respectively.) |
| 572 | |
| 573 | |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 574 | TurboJPEG Java Wrapper |
| 575 | ---------------------- |
DRC | 279bd34 | 2011-04-02 05:17:12 +0000 | [diff] [blame] | 576 | Add "-DWITH_JAVA=1" to the cmake command line to incorporate an optional Java |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 577 | Native Interface wrapper into the TurboJPEG shared library and build the Java |
| 578 | front-end classes to support it. This allows the TurboJPEG shared library to |
| 579 | be used directly from Java applications. See java/README for more details. |
DRC | 218c0c1 | 2011-02-05 06:01:18 +0000 | [diff] [blame] | 580 | |
DRC | db42506 | 2011-04-03 06:10:18 +0000 | [diff] [blame] | 581 | If you are using CMake 2.8, you can set the Java_JAVAC_EXECUTABLE, |
| 582 | Java_JAVA_EXECUTABLE, and Java_JAR_EXECUTABLE CMake variables to specify |
| 583 | alternate commands or locations for javac, jar, and java (respectively.) If |
| 584 | you are using CMake 2.6, set JAVA_COMPILE, JAVA_RUNTIME, and JAVA_ARCHIVE |
| 585 | instead. You can also set the JAVACFLAGS CMake variable to specify arguments |
| 586 | that should be passed to the Java compiler when building the front-end classes. |
| 587 | |
DRC | 218c0c1 | 2011-02-05 06:01:18 +0000 | [diff] [blame] | 588 | |
DRC | 2665843 | 2010-10-16 22:04:29 +0000 | [diff] [blame] | 589 | ======================== |
| 590 | Installing libjpeg-turbo |
| 591 | ======================== |
| 592 | |
| 593 | You can use the build system to install libjpeg-turbo into a directory of your |
| 594 | choosing (as opposed to creating an installer.) To do this, add: |
| 595 | |
| 596 | -DCMAKE_INSTALL_PREFIX={install_directory} |
| 597 | |
| 598 | to the cmake command line. |
| 599 | |
| 600 | For example, |
| 601 | |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 602 | cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release \ |
DRC | 2665843 | 2010-10-16 22:04:29 +0000 | [diff] [blame] | 603 | -DCMAKE_INSTALL_PREFIX=c:\libjpeg-turbo {source_directory} |
| 604 | nmake install |
| 605 | |
| 606 | will install the header files in c:\libjpeg-turbo\include, the library files |
| 607 | in c:\libjpeg-turbo\lib, the DLL's in c:\libjpeg-turbo\bin, and the |
| 608 | documentation in c:\libjpeg-turbo\doc. |
| 609 | |
| 610 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 611 | ============= |
| 612 | Build Recipes |
| 613 | ============= |
| 614 | |
| 615 | |
DRC | 1c73ce8 | 2010-10-16 21:02:54 +0000 | [diff] [blame] | 616 | 64-bit MinGW Build on Cygwin |
| 617 | ---------------------------- |
| 618 | |
| 619 | cd {build_directory} |
DRC | 2e4d044 | 2011-02-08 01:18:37 +0000 | [diff] [blame] | 620 | CC=/usr/bin/x86_64-w64-mingw32-gcc \ |
DRC | 68bf3f2 | 2010-10-18 07:56:14 +0000 | [diff] [blame] | 621 | cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \ |
| 622 | -DCMAKE_AR=/usr/bin/x86_64-w64-mingw32-ar \ |
DRC | 1c73ce8 | 2010-10-16 21:02:54 +0000 | [diff] [blame] | 623 | -DCMAKE_RANLIB=/usr/bin/x86_64-w64-mingw32-ranlib {source_directory} |
| 624 | make |
| 625 | |
| 626 | This produces a 64-bit build of libjpeg-turbo that does not depend on |
| 627 | cygwin1.dll or other Cygwin DLL's. The mingw64-x86_64-gcc-core and |
| 628 | mingw64-x86_64-gcc-g++ packages (and their dependencies) must be installed. |
| 629 | |
| 630 | |
| 631 | 32-bit MinGW Build on Cygwin |
| 632 | ---------------------------- |
| 633 | |
| 634 | cd {build_directory} |
DRC | 2e4d044 | 2011-02-08 01:18:37 +0000 | [diff] [blame] | 635 | CC=/usr/bin/i686-w64-mingw32-gcc \ |
DRC | 68bf3f2 | 2010-10-18 07:56:14 +0000 | [diff] [blame] | 636 | cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \ |
| 637 | -DDCMAKE_AR=/usr/bin/i686-w64-mingw32-ar \ |
DRC | 1c73ce8 | 2010-10-16 21:02:54 +0000 | [diff] [blame] | 638 | -DCMAKE_RANLIB=/usr/bin/i686-w64-mingw32-ranlib {source_directory} |
| 639 | make |
| 640 | |
| 641 | This produces a 32-bit build of libjpeg-turbo that does not depend on |
| 642 | cygwin1.dll or other Cygwin DLL's. The mingw64-i686-gcc-core and |
| 643 | mingw64-i686-gcc-g++ packages (and their dependencies) must be installed. |
| 644 | |
| 645 | |
| 646 | MinGW-w64 Build on Windows |
| 647 | -------------------------- |
| 648 | |
| 649 | This produces a 64-bit build of libjpeg-turbo using the "native" MinGW-w64 |
| 650 | toolchain (which is faster than the Cygwin version): |
| 651 | |
| 652 | cd {build_directory} |
| 653 | CC={mingw-w64_binary_path}/x86_64-w64-mingw32-gcc \ |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 654 | cmake -G "MSYS Makefiles" \ |
DRC | 1c73ce8 | 2010-10-16 21:02:54 +0000 | [diff] [blame] | 655 | -DCMAKE_AR={mingw-w64_binary_path}/x86_64-w64-mingw32-ar \ |
| 656 | -DCMAKE_RANLIB={mingw-w64_binary_path}/x86_64-w64-mingw32-ranlib \ |
| 657 | {source_directory} |
| 658 | make |
| 659 | |
| 660 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 661 | MinGW Build on Linux |
| 662 | -------------------- |
| 663 | |
| 664 | cd {build_directory} |
| 665 | CC={mingw_binary_path}/i386-mingw32-gcc \ |
DRC | 68bf3f2 | 2010-10-18 07:56:14 +0000 | [diff] [blame] | 666 | cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \ |
| 667 | -DCMAKE_AR={mingw_binary_path}/i386-mingw32-ar \ |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 668 | -DCMAKE_RANLIB={mingw_binary_path}/i386-mingw32-ranlib \ |
DRC | 68bf3f2 | 2010-10-18 07:56:14 +0000 | [diff] [blame] | 669 | {source_directory} |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 670 | make |
DRC | 8b014d7 | 2010-02-18 13:03:41 +0000 | [diff] [blame] | 671 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 672 | |
| 673 | ******************************************************************************* |
| 674 | ** Creating Release Packages |
| 675 | ******************************************************************************* |
| 676 | |
| 677 | The following commands can be used to create various types of release packages: |
| 678 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 679 | |
DRC | d7a642b | 2013-04-24 06:40:25 +0000 | [diff] [blame] | 680 | Unix/Linux |
| 681 | ---------- |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 682 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 683 | make rpm |
| 684 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 685 | Create Red Hat-style binary RPM package. Requires RPM v4 or later. |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 686 | |
| 687 | make srpm |
| 688 | |
| 689 | This runs 'make dist' to create a pristine source tarball, then creates a |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 690 | Red Hat-style source RPM package from the tarball. Requires RPM v4 or later. |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 691 | |
| 692 | make deb |
| 693 | |
| 694 | Create Debian-style binary package. Requires dpkg. |
| 695 | |
| 696 | make dmg |
| 697 | |
| 698 | Create Macintosh package/disk image. This requires the PackageMaker |
| 699 | application, which must be installed in /Developer/Applications/Utilities. |
DRC | 7ed0aeb | 2013-02-24 20:39:30 +0000 | [diff] [blame] | 700 | Note that PackageMaker is not included in recent releases of Xcode, but it |
| 701 | can be obtained by downloading the "Auxiliary Tools for Xcode" package from |
| 702 | http://developer.apple.com/downloads. |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 703 | |
DRC | 9ef93db | 2010-10-18 08:24:42 +0000 | [diff] [blame] | 704 | make udmg [BUILDDIR32={32-bit build directory}] |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 705 | |
DRC | 20b734e | 2012-02-10 01:30:37 +0000 | [diff] [blame] | 706 | On 64-bit OS X systems, this creates a Macintosh package and disk image that |
| 707 | contains universal i386/x86-64 binaries. You should first configure a 32-bit |
| 708 | out-of-tree build of libjpeg-turbo, then configure a 64-bit out-of-tree |
| 709 | build, then run 'make udmg' from the 64-bit build directory. The build |
| 710 | system will look for the 32-bit build under {source_directory}/osxx86 by |
| 711 | default, but you can override this by setting the BUILDDIR32 variable on the |
| 712 | make command line as shown above. |
| 713 | |
| 714 | make iosdmg [BUILDDIR32={32-bit build directory}] \ |
| 715 | [BUILDDIRARMV6={ARM v6 build directory}] \ |
| 716 | [BUILDDIRARMV7={ARM v7 build directory}] \ |
DRC | a2a2cd6 | 2013-02-04 22:29:57 +0000 | [diff] [blame] | 717 | [BUILDDIRARMV7S={ARM v7s build directory}] |
DRC | 20b734e | 2012-02-10 01:30:37 +0000 | [diff] [blame] | 718 | |
| 719 | On OS X systems, this creates a Macintosh package and disk image in which the |
| 720 | libjpeg-turbo static libraries contain ARM architectures necessary to build |
| 721 | iOS applications. If building on an x86-64 system, the binaries will also |
| 722 | contain the i386 architecture, as with 'make udmg' above. You should first |
DRC | a2a2cd6 | 2013-02-04 22:29:57 +0000 | [diff] [blame] | 723 | configure ARM v6, ARM v7, and/or ARM v7s out-of-tree builds of libjpeg-turbo |
| 724 | (see "Building libjpeg-turbo for iOS" above.) If you are building an x86-64 |
DRC | 20b734e | 2012-02-10 01:30:37 +0000 | [diff] [blame] | 725 | version of libjpeg-turbo, you should configure a 32-bit out-of-tree build as |
| 726 | well. Next, build libjpeg-turbo as you would normally, using an out-of-tree |
| 727 | build. When it is built, run 'make iosdmg' from the build directory. The |
| 728 | build system will look for the ARM v6 build under {source_directory}/iosarmv6 |
| 729 | by default, the ARM v7 build under {source_directory}/iosarmv7 by default, |
DRC | a2a2cd6 | 2013-02-04 22:29:57 +0000 | [diff] [blame] | 730 | the ARM v7s build under {source_directory}/iosarmv7s by default, and (if |
| 731 | applicable) the 32-bit build under {source_directory}/osxx86 by default, but |
| 732 | you can override this by setting the BUILDDIR32, BUILDDIRARMV6, |
| 733 | BUILDDIRARMV7, and/or BUILDDIRARMV7S variables on the make command line as |
| 734 | shown above. |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 735 | |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 736 | make cygwinpkg |
| 737 | |
| 738 | Build a Cygwin binary package. |
| 739 | |
DRC | 0a1f68e | 2010-02-24 07:24:26 +0000 | [diff] [blame] | 740 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 741 | Windows |
| 742 | ------- |
DRC | 0a1f68e | 2010-02-24 07:24:26 +0000 | [diff] [blame] | 743 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 744 | If using NMake: |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 745 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 746 | cd {build_directory} |
| 747 | nmake installer |
| 748 | |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 749 | If using MinGW: |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 750 | |
| 751 | cd {build_directory} |
| 752 | make installer |
| 753 | |
| 754 | If using the Visual Studio IDE, build the "installer" project. |
| 755 | |
| 756 | The installer package (libjpeg-turbo[-gcc][64].exe) will be located under |
| 757 | {build_directory}. If building using the Visual Studio IDE, then the installer |
| 758 | package will be located in a subdirectory with the same name as the |
| 759 | configuration you built (such as {build_directory}\Debug\ or |
| 760 | {build_directory}\Release\). |
| 761 | |
| 762 | Building a Windows installer requires the Nullsoft Install System |
| 763 | (http://nsis.sourceforge.net/.) makensis.exe should be in your PATH. |
DRC | 9cd4e4b | 2012-01-31 07:56:44 +0000 | [diff] [blame] | 764 | |
| 765 | |
| 766 | ******************************************************************************* |
| 767 | ** Regression testing |
| 768 | ******************************************************************************* |
| 769 | |
| 770 | The most common way to test libjpeg-turbo is by invoking 'make test' on |
| 771 | Unix/Linux platforms or 'ctest' on Windows platforms, once the build has |
| 772 | completed. This runs a series of tests to ensure that mathematical |
| 773 | compatibility has been maintained between libjpeg-turbo and libjpeg v6b. This |
| 774 | also invokes the TurboJPEG unit tests, which ensure that the colorspace |
| 775 | extensions, YUV encoding, decompression scaling, and other features of the |
| 776 | TurboJPEG C and Java APIs are working properly (and, by extension, that the |
| 777 | equivalent features of the underlying libjpeg API are also working.) |
| 778 | |
| 779 | Invoking 'make testclean' or 'nmake testclean' (if using NMake) or building |
| 780 | the 'testclean' target (if using the Visual Studio IDE) will clean up the |
| 781 | output images generated by 'make test'. |
| 782 | |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 783 | On Unix/Linux platforms, more extensive tests of the TurboJPEG C and Java |
DRC | 9cd4e4b | 2012-01-31 07:56:44 +0000 | [diff] [blame] | 784 | wrappers can be run by invoking 'make tjtest'. These extended TurboJPEG tests |
| 785 | essentially iterate through all of the available features of the TurboJPEG APIs |
| 786 | that are not covered by the TurboJPEG unit tests (this includes the lossless |
| 787 | transform options) and compare the images generated by each feature to images |
| 788 | generated using the equivalent feature in the libjpeg API. The extended |
| 789 | TurboJPEG tests are meant to test for regressions in the TurboJPEG wrappers, |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 790 | not in the underlying libjpeg API library. |