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