DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 1 | ******************************************************************************* |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 2 | ** Building on Unix Platforms (including Cygwin) |
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 | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 13 | |
| 14 | -- NASM |
| 15 | * 0.98 or later is required for a 32-bit build |
| 16 | * NASM 2.05 or later is required for a 64-bit build |
DRC | 9026b37 | 2011-04-16 13:37:22 +0000 | [diff] [blame] | 17 | * 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] | 18 | obtained from MacPorts (http://www.macports.org/). |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 19 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 20 | The NASM 2.05 RPMs do not work on older Linux systems, such as Red Hat |
| 21 | Enterprise Linux 4. On such systems, you can easily build and install NASM |
| 22 | 2.05 from the source RPM by executing the following as root: |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 23 | |
| 24 | ARCH=`uname -m` |
| 25 | wget http://www.nasm.us/pub/nasm/releasebuilds/2.05.01/nasm-2.05.01-1.src.rpm |
| 26 | rpmbuild --rebuild nasm-2.05.01-1.src.rpm |
| 27 | rpm -Uvh /usr/src/redhat/RPMS/$ARCH/nasm-2.05.01-1.$ARCH.rpm |
| 28 | |
DRC | c3f4ac0 | 2010-02-19 21:51:26 +0000 | [diff] [blame] | 29 | NOTE: NASM build will fail if texinfo is not installed. |
| 30 | |
DRC | 8f870c2 | 2010-02-24 00:30:00 +0000 | [diff] [blame] | 31 | -- GCC v4.1 or later recommended for best performance |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 32 | |
DRC | 279bd34 | 2011-04-02 05:17:12 +0000 | [diff] [blame] | 33 | -- If building the TurboJPEG/OSS Java wrapper, JDK or OpenJDK 1.5 or later is |
| 34 | required. Some systems, such as OS X 10.4, Solaris 10 and later, and Red |
| 35 | Hat Enterprise Linux 5 and later, have this pre-installed. On OS X 10.5 and |
| 36 | later, it will be necessary to install the Java Developer Package, which can |
| 37 | be downloaded from http://connect.apple.com. For systems that do not have a |
| 38 | JDK installed, you can obtain the Oracle Java Development Kit from |
| 39 | http://www.java.com. |
DRC | f8e0055 | 2011-02-04 11:06:36 +0000 | [diff] [blame] | 40 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 41 | |
| 42 | ================== |
| 43 | Out-of-Tree Builds |
| 44 | ================== |
| 45 | |
| 46 | Binary objects, libraries, and executables are generated in the same directory |
| 47 | from which configure was executed (the "binary directory"), and this directory |
| 48 | need not necessarily be the same as the libjpeg-turbo source directory. You |
| 49 | can create multiple independent binary directories, in which different versions |
| 50 | of libjpeg-turbo can be built from the same source tree using different |
| 51 | compilers or settings. In the sections below, {build_directory} refers to the |
| 52 | binary directory, whereas {source_directory} refers to the libjpeg-turbo source |
| 53 | directory. For in-tree builds, these directories are the same. |
| 54 | |
| 55 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 56 | ====================== |
| 57 | Building libjpeg-turbo |
| 58 | ====================== |
| 59 | |
DRC | 4959787 | 2010-05-17 20:47:57 +0000 | [diff] [blame] | 60 | The following procedure will build libjpeg-turbo on Linux, FreeBSD, 32-bit |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 61 | OS X, Cygwin, and Solaris/x86 systems (on Solaris, this generates a 32-bit |
| 62 | library. See below for 64-bit build instructions.) |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 63 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 64 | cd {source_directory} |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 65 | autoreconf -fiv |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 66 | cd {build_directory} |
DRC | 98dbe91 | 2010-11-04 22:22:30 +0000 | [diff] [blame] | 67 | sh {source_directory}/configure [additional configure flags] |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 68 | make |
| 69 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 70 | NOTE: Running autoreconf in the source directory is only necessary if building |
| 71 | libjpeg-turbo from the SVN repository. |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 72 | |
| 73 | This will generate the following files under .libs/ |
| 74 | |
| 75 | libjpeg.a |
| 76 | Static link library for libjpeg-turbo |
| 77 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 78 | libjpeg.so.{version} (Linux, Solaris) |
| 79 | libjpeg.{version}.dylib (OS X) |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 80 | cygjpeg-{version}.dll (Cygwin) |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 81 | Shared library for libjpeg-turbo |
| 82 | |
| 83 | libjpeg.so (Linux, Solaris) |
| 84 | libjpeg.dylib (OS X) |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 85 | libjpeg.dll.a (Cygwin) |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 86 | Development stub for libjpeg-turbo shared library |
| 87 | |
| 88 | libturbojpeg.a |
| 89 | Static link library for TurboJPEG/OSS |
| 90 | |
| 91 | libturbojpeg.so (Linux, Solaris) |
| 92 | libturbojpeg.dylib (OS X) |
| 93 | Shared library and development stub for TurboJPEG/OSS |
| 94 | |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 95 | cygturbojpeg.dll (Cygwin) |
| 96 | Shared library for TurboJPEG/OSS |
| 97 | |
| 98 | libturbojpeg.dll.a (Cygwin) |
| 99 | Development stub for TurboJPEG/OSS shared library |
| 100 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 101 | {version} is 62.0.0, 7.0.0, or 8.0.2, depending on whether libjpeg v6b |
DRC | f38eee0 | 2011-02-18 07:00:38 +0000 | [diff] [blame] | 102 | (default), v7, or v8 emulation is enabled. If using Cygwin, {version} is |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 103 | 62, 7, or 8. |
| 104 | |
| 105 | |
DRC | f38eee0 | 2011-02-18 07:00:38 +0000 | [diff] [blame] | 106 | libjpeg v7 or v8 Emulation |
| 107 | -------------------------- |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 108 | |
| 109 | Add --with-jpeg7 to the configure command line to build a version of |
| 110 | libjpeg-turbo that is compatible with libjpeg v7. Add --with-jpeg8 to the |
| 111 | configure command to build a version of libjpeg-turbo that is compatible with |
DRC | f38eee0 | 2011-02-18 07:00:38 +0000 | [diff] [blame] | 112 | libjpeg v8. See README-turbo.txt for more information on libjpeg v7 and v8 |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 113 | emulation. |
| 114 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 115 | |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 116 | Arithmetic Coding Support |
| 117 | ------------------------- |
| 118 | |
| 119 | Since the patent on arithmetic coding has expired, this functionality has been |
| 120 | included in this release of libjpeg-turbo. libjpeg-turbo's implementation is |
DRC | f38eee0 | 2011-02-18 07:00:38 +0000 | [diff] [blame] | 121 | based on the implementation in libjpeg v8, but it works when emulating libjpeg |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 122 | v7 or v6b as well. The default is to enable both arithmetic encoding and |
| 123 | decoding, but those who have philosophical objections to arithmetic coding can |
| 124 | add --without-arith-enc or --without-arith-dec to the configure command line to |
| 125 | disable encoding or decoding (respectively.) |
| 126 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 127 | |
DRC | 279bd34 | 2011-04-02 05:17:12 +0000 | [diff] [blame] | 128 | TurboJPEG/OSS Java Wrapper |
| 129 | -------------------------- |
DRC | 88f54a4 | 2011-04-01 01:21:22 +0000 | [diff] [blame] | 130 | Add --with-java to the configure command line to incorporate an optional Java |
| 131 | Native Interface wrapper into the TurboJPEG/OSS dynamic library and build the |
| 132 | Java front-end classes to support it. This allows the TurboJPEG/OSS dynamic |
| 133 | library to be used directly from Java applications. See java/README for more |
| 134 | details. |
| 135 | |
| 136 | You can set the JAVAC, JAR, and JAVA configure variables to specify |
| 137 | alternate commands for javac, jar, and java (respectively.) You can also |
| 138 | set the JAVACFLAGS configure variable to specify arguments that should be |
| 139 | passed to the Java compiler when building the front-end classes, and JNI_CFLAGS |
| 140 | to specify arguments that should be passed to the C compiler when building the |
| 141 | JNI wrapper. Run 'configure --help' for more details. |
DRC | f8e0055 | 2011-02-04 11:06:36 +0000 | [diff] [blame] | 142 | |
| 143 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 144 | ======================== |
| 145 | Installing libjpeg-turbo |
| 146 | ======================== |
| 147 | |
| 148 | If you intend to install these libraries and the associated header files, then |
| 149 | replace 'make' in the instructions above with |
| 150 | |
| 151 | make install prefix={base dir} libdir={library directory} |
| 152 | |
| 153 | For example, |
| 154 | |
| 155 | make install prefix=/usr/local libdir=/usr/local/lib64 |
| 156 | |
| 157 | will install the header files in /usr/local/include and the library files in |
| 158 | /usr/local/lib64. If 'prefix' and 'libdir' are not specified, then the default |
| 159 | is to install the header files in /opt/libjpeg-turbo/include and the library |
| 160 | files in /opt/libjpeg-turbo/lib. |
| 161 | |
| 162 | NOTE: You can specify a prefix of /usr and a libdir of, for instance, |
| 163 | /usr/lib64 to overwrite the system's version of libjpeg. If you do this, |
| 164 | however, then be sure to BACK UP YOUR SYSTEM'S INSTALLATION OF LIBJPEG before |
| 165 | overwriting it. It is recommended that you instead install libjpeg-turbo into |
| 166 | a non-system directory and manipulate the LD_LIBRARY_PATH or create sym links |
| 167 | to force applications to use libjpeg-turbo instead of libjpeg. See |
| 168 | README-turbo.txt for more information. |
| 169 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 170 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 171 | ============= |
| 172 | Build Recipes |
| 173 | ============= |
| 174 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 175 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 176 | 32-bit Library Build on 64-bit Linux |
| 177 | ------------------------------------ |
| 178 | |
DRC | ca5e7d1 | 2010-02-17 02:25:06 +0000 | [diff] [blame] | 179 | Add |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 180 | |
DRC | 2e4d044 | 2011-02-08 01:18:37 +0000 | [diff] [blame] | 181 | --host i686-pc-linux-gnu CFLAGS='-O3 -m32' LDFLAGS=-m32 |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 182 | |
| 183 | to the configure command line. |
| 184 | |
| 185 | |
DRC | 9026b37 | 2011-04-16 13:37:22 +0000 | [diff] [blame] | 186 | 64-bit Library Build on 64-bit OS X |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 187 | ----------------------------------- |
| 188 | |
DRC | ca5e7d1 | 2010-02-17 02:25:06 +0000 | [diff] [blame] | 189 | Add |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 190 | |
DRC | 0dedd1a | 2010-07-02 09:20:12 +0000 | [diff] [blame] | 191 | --host x86_64-apple-darwin NASM=/opt/local/bin/nasm |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 192 | |
DRC | 7bac07b | 2010-04-10 05:53:35 +0000 | [diff] [blame] | 193 | to the configure command line. NASM 2.07 or later from MacPorts must be |
| 194 | installed. |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 195 | |
| 196 | |
DRC | 9026b37 | 2011-04-16 13:37:22 +0000 | [diff] [blame] | 197 | 32-bit Library Build on 64-bit OS X |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 198 | ----------------------------------- |
| 199 | |
DRC | ca5e7d1 | 2010-02-17 02:25:06 +0000 | [diff] [blame] | 200 | Add |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 201 | |
DRC | 2e4d044 | 2011-02-08 01:18:37 +0000 | [diff] [blame] | 202 | CFLAGS='-O3 -m32' LDFLAGS=-m32 |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 203 | |
| 204 | to the configure command line. |
| 205 | |
| 206 | |
DRC | 9026b37 | 2011-04-16 13:37:22 +0000 | [diff] [blame] | 207 | 64-bit Backward-Compatible Library Build on 64-bit OS X |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 208 | ------------------------------------------------------- |
| 209 | |
DRC | ca5e7d1 | 2010-02-17 02:25:06 +0000 | [diff] [blame] | 210 | Add |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 211 | |
DRC | 0dedd1a | 2010-07-02 09:20:12 +0000 | [diff] [blame] | 212 | --host x86_64-apple-darwin NASM=/opt/local/bin/nasm \ |
| 213 | CFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \ |
| 214 | -mmacosx-version-min=10.4 -O3' \ |
DRC | 0dedd1a | 2010-07-02 09:20:12 +0000 | [diff] [blame] | 215 | LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \ |
| 216 | -mmacosx-version-min=10.4' |
| 217 | |
DRC | 575c342 | 2010-07-08 07:01:20 +0000 | [diff] [blame] | 218 | to the configure command line. The OS X 10.4 SDK, and NASM 2.07 or later from |
| 219 | MacPorts, must be installed. |
DRC | 0dedd1a | 2010-07-02 09:20:12 +0000 | [diff] [blame] | 220 | |
| 221 | |
DRC | 9026b37 | 2011-04-16 13:37:22 +0000 | [diff] [blame] | 222 | 32-bit Backward-Compatible Library Build on OS X |
DRC | 0dedd1a | 2010-07-02 09:20:12 +0000 | [diff] [blame] | 223 | ------------------------------------------------ |
| 224 | |
| 225 | Add |
| 226 | |
DRC | 485cd80 | 2010-02-23 23:23:42 +0000 | [diff] [blame] | 227 | CFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \ |
| 228 | -mmacosx-version-min=10.4 -O3 -m32' \ |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 229 | LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \ |
| 230 | -mmacosx-version-min=10.4 -m32' |
| 231 | |
| 232 | to the configure command line. The OS X 10.4 SDK must be installed. |
| 233 | |
| 234 | |
| 235 | 64-bit Library Build on 64-bit Solaris |
| 236 | -------------------------------------- |
| 237 | |
DRC | ca5e7d1 | 2010-02-17 02:25:06 +0000 | [diff] [blame] | 238 | Add |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 239 | |
DRC | 2e4d044 | 2011-02-08 01:18:37 +0000 | [diff] [blame] | 240 | --host x86_64-pc-solaris CFLAGS='-O3 -m64' LDFLAGS=-m64 |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 241 | |
| 242 | to the configure command line. |
| 243 | |
| 244 | |
DRC | 7bac07b | 2010-04-10 05:53:35 +0000 | [diff] [blame] | 245 | 32-bit Library Build on 64-bit FreeBSD |
| 246 | -------------------------------------- |
| 247 | |
| 248 | Add |
| 249 | |
DRC | 2e4d044 | 2011-02-08 01:18:37 +0000 | [diff] [blame] | 250 | --host i386-unknown-freebsd CC='gcc -B /usr/lib32' CFLAGS='-O3 -m32' \ |
| 251 | LDFLAGS='-B/usr/lib32' |
DRC | 7bac07b | 2010-04-10 05:53:35 +0000 | [diff] [blame] | 252 | |
| 253 | to the configure command line. NASM 2.07 or later from FreeBSD ports must be |
| 254 | installed. |
| 255 | |
| 256 | |
DRC | ca5e7d1 | 2010-02-17 02:25:06 +0000 | [diff] [blame] | 257 | Sun Studio |
| 258 | ---------- |
| 259 | |
| 260 | Add |
| 261 | |
DRC | 2e4d044 | 2011-02-08 01:18:37 +0000 | [diff] [blame] | 262 | CC=cc |
DRC | ca5e7d1 | 2010-02-17 02:25:06 +0000 | [diff] [blame] | 263 | |
| 264 | to the configure command line. libjpeg-turbo will automatically be built with |
DRC | 2e4d044 | 2011-02-08 01:18:37 +0000 | [diff] [blame] | 265 | the maximum optimization level (-xO5) unless you override CFLAGS. |
DRC | ca5e7d1 | 2010-02-17 02:25:06 +0000 | [diff] [blame] | 266 | |
| 267 | To build a 64-bit version of libjpeg-turbo using Sun Studio, add |
| 268 | |
DRC | 2e4d044 | 2011-02-08 01:18:37 +0000 | [diff] [blame] | 269 | --host x86_64-pc-solaris CC=cc CFLAGS='-xO5 -m64' LDFLAGS=-m64 |
DRC | ca5e7d1 | 2010-02-17 02:25:06 +0000 | [diff] [blame] | 270 | |
| 271 | to the configure command line. |
| 272 | |
DRC | 8b014d7 | 2010-02-18 13:03:41 +0000 | [diff] [blame] | 273 | |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 274 | MinGW Build on Cygwin |
| 275 | --------------------- |
| 276 | |
| 277 | Use CMake (see recipes below) |
| 278 | |
| 279 | |
| 280 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 281 | ******************************************************************************* |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 282 | ** Building on Windows (Visual C++ or MinGW) |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 283 | ******************************************************************************* |
| 284 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 285 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 286 | ================== |
| 287 | Build Requirements |
| 288 | ================== |
| 289 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 290 | -- CMake (http://www.cmake.org) v2.6 or later |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 291 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 292 | -- Microsoft Visual C++ 2005 or later |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 293 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 294 | If you don't already have Visual C++, then the easiest way to get it is by |
| 295 | installing the Windows SDK: |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 296 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 297 | http://msdn.microsoft.com/en-us/windows/bb980924.aspx |
| 298 | |
| 299 | The Windows SDK includes both 32-bit and 64-bit Visual C++ compilers and |
| 300 | everything necessary to build libjpeg-turbo. |
| 301 | |
| 302 | * For 32-bit builds, you can also use Microsoft Visual C++ Express |
| 303 | Edition. Visual C++ Express Edition is a free download. |
| 304 | * If you intend to build libjpeg-turbo from the command line, then add the |
| 305 | appropriate compiler and SDK directories to the INCLUDE, LIB, and PATH |
| 306 | environment variables. This is generally accomplished by executing |
| 307 | vcvars32.bat or vcvars64.bat and SetEnv.cmd. vcvars32.bat and |
| 308 | vcvars64.bat are part of Visual C++ and are located in the same directory |
| 309 | as the compiler. SetEnv.cmd is part of the Windows SDK. You can pass |
| 310 | optional arguments to SetEnv.cmd to specify a 32-bit or 64-bit build |
| 311 | environment. |
| 312 | |
| 313 | ... OR ... |
| 314 | |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 315 | -- MinGW |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 316 | |
| 317 | GCC v4.1 or later recommended for best performance |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 318 | |
DRC | 377add7 | 2010-05-17 16:41:12 +0000 | [diff] [blame] | 319 | -- NASM (http://www.nasm.us/) 0.98 or later (NASM 2.05 or later is required for |
| 320 | a 64-bit build) |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 321 | |
DRC | 279bd34 | 2011-04-02 05:17:12 +0000 | [diff] [blame] | 322 | -- If building the TurboJPEG/OSS Java wrapper, JDK 1.5 or later is required. |
| 323 | This can be downloaded from http://www.java.com. |
DRC | 218c0c1 | 2011-02-05 06:01:18 +0000 | [diff] [blame] | 324 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 325 | |
| 326 | ================== |
| 327 | Out-of-Tree Builds |
| 328 | ================== |
| 329 | |
| 330 | Binary objects, libraries, and executables are generated in the same directory |
| 331 | from which cmake was executed (the "binary directory"), and this directory need |
| 332 | not necessarily be the same as the libjpeg-turbo source directory. You can |
| 333 | create multiple independent binary directories, in which different versions of |
| 334 | libjpeg-turbo can be built from the same source tree using different compilers |
| 335 | or settings. In the sections below, {build_directory} refers to the binary |
| 336 | directory, whereas {source_directory} refers to the libjpeg-turbo source |
| 337 | directory. For in-tree builds, these directories are the same. |
| 338 | |
| 339 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 340 | ====================== |
| 341 | Building libjpeg-turbo |
| 342 | ====================== |
| 343 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 344 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 345 | Visual C++ (Command Line) |
| 346 | ------------------------- |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 347 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 348 | cd {build_directory} |
| 349 | cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release {source_directory} |
| 350 | nmake |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 351 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 352 | This will build either a 32-bit or a 64-bit version of libjpeg-turbo, depending |
| 353 | on which version of cl.exe is in the PATH. |
DRC | 8b014d7 | 2010-02-18 13:03:41 +0000 | [diff] [blame] | 354 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 355 | The following files will be generated under {build_directory}: |
| 356 | |
| 357 | jpeg-static.lib |
| 358 | Static link library for libjpeg-turbo |
| 359 | sharedlib/jpeg{version}.dll |
| 360 | DLL for libjpeg-turbo |
| 361 | sharedlib/jpeg.lib |
| 362 | Import library for libjpeg-turbo DLL |
| 363 | turbojpeg-static.lib |
| 364 | Static link library for TurboJPEG/OSS |
| 365 | turbojpeg.dll |
| 366 | DLL for TurboJPEG/OSS |
| 367 | turbojpeg.lib |
| 368 | Import library for TurboJPEG/OSS DLL |
| 369 | |
| 370 | {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] | 371 | v8 emulation is enabled. |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 372 | |
| 373 | |
| 374 | Visual C++ (IDE) |
| 375 | ---------------- |
| 376 | |
| 377 | Choose the appropriate CMake generator option for your version of Visual Studio |
| 378 | (run "cmake" with no arguments for a list of available generators.) For |
| 379 | instance: |
| 380 | |
| 381 | cd {build_directory} |
| 382 | cmake -G "Visual Studio 9 2008" {source_directory} |
| 383 | |
| 384 | You can then open ALL_BUILD.vcproj in Visual Studio and build one of the |
| 385 | configurations in that project ("Debug", "Release", etc.) to generate a full |
| 386 | build of libjpeg-turbo. |
| 387 | |
| 388 | This will generate the following files under {build_directory}: |
| 389 | |
| 390 | {configuration}/jpeg-static.lib |
| 391 | Static link library for libjpeg-turbo |
| 392 | sharedlib/{configuration}/jpeg{version}.dll |
| 393 | DLL for libjpeg-turbo |
| 394 | sharedlib/{configuration}/jpeg.lib |
| 395 | Import library for libjpeg-turbo DLL |
| 396 | {configuration}/turbojpeg-static.lib |
| 397 | Static link library for TurboJPEG/OSS |
| 398 | {configuration}/turbojpeg.dll |
| 399 | DLL for TurboJPEG/OSS |
| 400 | {configuration}/turbojpeg.lib |
| 401 | Import library for TurboJPEG/OSS DLL |
| 402 | |
| 403 | {configuration} is Debug, Release, RelWithDebInfo, or MinSizeRel, depending on |
| 404 | 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] | 405 | depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled. |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 406 | |
| 407 | |
| 408 | MinGW |
| 409 | ----- |
| 410 | |
| 411 | cd {build_directory} |
| 412 | cmake -G "MSYS Makefiles" {source_directory} |
| 413 | make |
| 414 | |
| 415 | This will generate the following files under {build_directory} |
| 416 | |
| 417 | libjpeg.a |
| 418 | Static link library for libjpeg-turbo |
| 419 | sharedlib/libjpeg-{version}.dll |
| 420 | DLL for libjpeg-turbo |
| 421 | sharedlib/libjpeg.dll.a |
| 422 | Import library for libjpeg-turbo DLL |
| 423 | libturbojpeg.a |
| 424 | Static link library for TurboJPEG/OSS |
| 425 | libturbojpeg.dll |
| 426 | DLL for TurboJPEG/OSS |
| 427 | libturbojpeg.dll.a |
| 428 | Import library for TurboJPEG/OSS DLL |
| 429 | |
| 430 | {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] | 431 | v8 emulation is enabled. |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 432 | |
| 433 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 434 | Debug Build |
| 435 | ----------- |
| 436 | |
| 437 | Add "-DCMAKE_BUILD_TYPE=Debug" to the cmake command line. Or, if building with |
| 438 | NMake, remove "-DCMAKE_BUILD_TYPE=Release" (Debug builds are the default with |
| 439 | NMake.) |
| 440 | |
| 441 | |
DRC | f38eee0 | 2011-02-18 07:00:38 +0000 | [diff] [blame] | 442 | libjpeg v7 or v8 Emulation |
| 443 | -------------------------- |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 444 | |
| 445 | Add "-DWITH_JPEG7=1" to the cmake command line to build a version of |
| 446 | libjpeg-turbo that is compatible with libjpeg v7. Add "-DWITH_JPEG8=1" to the |
| 447 | cmake command to build a version of libjpeg-turbo that is compatible with |
DRC | f38eee0 | 2011-02-18 07:00:38 +0000 | [diff] [blame] | 448 | libjpeg v8. See README-turbo.txt for more information on libjpeg v7 and v8 |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 449 | emulation. |
| 450 | |
| 451 | |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 452 | Arithmetic Coding Support |
| 453 | ------------------------- |
| 454 | |
| 455 | Since the patent on arithmetic coding has expired, this functionality has been |
| 456 | included in this release of libjpeg-turbo. libjpeg-turbo's implementation is |
DRC | f38eee0 | 2011-02-18 07:00:38 +0000 | [diff] [blame] | 457 | based on the implementation in libjpeg v8, but it works when emulating libjpeg |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 458 | v7 or v6b as well. The default is to enable both arithmetic encoding and |
| 459 | decoding, but those who have philosophical objections to arithmetic coding can |
| 460 | add "-DWITH_ARITH_ENC=0" or "-DWITH_ARITH_DEC=0" to the cmake command line to |
| 461 | disable encoding or decoding (respectively.) |
| 462 | |
| 463 | |
DRC | 279bd34 | 2011-04-02 05:17:12 +0000 | [diff] [blame] | 464 | TurboJPEG/OSS Java Wrapper |
| 465 | -------------------------- |
| 466 | Add "-DWITH_JAVA=1" to the cmake command line to incorporate an optional Java |
| 467 | Native Interface wrapper into the TurboJPEG/OSS dynamic library and build the |
| 468 | Java front-end classes to support it. This allows the TurboJPEG/OSS dynamic |
| 469 | library to be used directly from Java applications. See java/README for more |
| 470 | details. |
DRC | 218c0c1 | 2011-02-05 06:01:18 +0000 | [diff] [blame] | 471 | |
DRC | db42506 | 2011-04-03 06:10:18 +0000 | [diff] [blame] | 472 | If you are using CMake 2.8, you can set the Java_JAVAC_EXECUTABLE, |
| 473 | Java_JAVA_EXECUTABLE, and Java_JAR_EXECUTABLE CMake variables to specify |
| 474 | alternate commands or locations for javac, jar, and java (respectively.) If |
| 475 | you are using CMake 2.6, set JAVA_COMPILE, JAVA_RUNTIME, and JAVA_ARCHIVE |
| 476 | instead. You can also set the JAVACFLAGS CMake variable to specify arguments |
| 477 | that should be passed to the Java compiler when building the front-end classes. |
| 478 | |
DRC | 218c0c1 | 2011-02-05 06:01:18 +0000 | [diff] [blame] | 479 | |
DRC | 2665843 | 2010-10-16 22:04:29 +0000 | [diff] [blame] | 480 | ======================== |
| 481 | Installing libjpeg-turbo |
| 482 | ======================== |
| 483 | |
| 484 | You can use the build system to install libjpeg-turbo into a directory of your |
| 485 | choosing (as opposed to creating an installer.) To do this, add: |
| 486 | |
| 487 | -DCMAKE_INSTALL_PREFIX={install_directory} |
| 488 | |
| 489 | to the cmake command line. |
| 490 | |
| 491 | For example, |
| 492 | |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 493 | cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release \ |
DRC | 2665843 | 2010-10-16 22:04:29 +0000 | [diff] [blame] | 494 | -DCMAKE_INSTALL_PREFIX=c:\libjpeg-turbo {source_directory} |
| 495 | nmake install |
| 496 | |
| 497 | will install the header files in c:\libjpeg-turbo\include, the library files |
| 498 | in c:\libjpeg-turbo\lib, the DLL's in c:\libjpeg-turbo\bin, and the |
| 499 | documentation in c:\libjpeg-turbo\doc. |
| 500 | |
| 501 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 502 | ============= |
| 503 | Build Recipes |
| 504 | ============= |
| 505 | |
| 506 | |
DRC | 1c73ce8 | 2010-10-16 21:02:54 +0000 | [diff] [blame] | 507 | 64-bit MinGW Build on Cygwin |
| 508 | ---------------------------- |
| 509 | |
| 510 | cd {build_directory} |
DRC | 2e4d044 | 2011-02-08 01:18:37 +0000 | [diff] [blame] | 511 | CC=/usr/bin/x86_64-w64-mingw32-gcc \ |
DRC | 68bf3f2 | 2010-10-18 07:56:14 +0000 | [diff] [blame] | 512 | cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \ |
| 513 | -DCMAKE_AR=/usr/bin/x86_64-w64-mingw32-ar \ |
DRC | 1c73ce8 | 2010-10-16 21:02:54 +0000 | [diff] [blame] | 514 | -DCMAKE_RANLIB=/usr/bin/x86_64-w64-mingw32-ranlib {source_directory} |
| 515 | make |
| 516 | |
| 517 | This produces a 64-bit build of libjpeg-turbo that does not depend on |
| 518 | cygwin1.dll or other Cygwin DLL's. The mingw64-x86_64-gcc-core and |
| 519 | mingw64-x86_64-gcc-g++ packages (and their dependencies) must be installed. |
| 520 | |
| 521 | |
| 522 | 32-bit MinGW Build on Cygwin |
| 523 | ---------------------------- |
| 524 | |
| 525 | cd {build_directory} |
DRC | 2e4d044 | 2011-02-08 01:18:37 +0000 | [diff] [blame] | 526 | CC=/usr/bin/i686-w64-mingw32-gcc \ |
DRC | 68bf3f2 | 2010-10-18 07:56:14 +0000 | [diff] [blame] | 527 | cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \ |
| 528 | -DDCMAKE_AR=/usr/bin/i686-w64-mingw32-ar \ |
DRC | 1c73ce8 | 2010-10-16 21:02:54 +0000 | [diff] [blame] | 529 | -DCMAKE_RANLIB=/usr/bin/i686-w64-mingw32-ranlib {source_directory} |
| 530 | make |
| 531 | |
| 532 | This produces a 32-bit build of libjpeg-turbo that does not depend on |
| 533 | cygwin1.dll or other Cygwin DLL's. The mingw64-i686-gcc-core and |
| 534 | mingw64-i686-gcc-g++ packages (and their dependencies) must be installed. |
| 535 | |
| 536 | |
| 537 | MinGW-w64 Build on Windows |
| 538 | -------------------------- |
| 539 | |
| 540 | This produces a 64-bit build of libjpeg-turbo using the "native" MinGW-w64 |
| 541 | toolchain (which is faster than the Cygwin version): |
| 542 | |
| 543 | cd {build_directory} |
| 544 | CC={mingw-w64_binary_path}/x86_64-w64-mingw32-gcc \ |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 545 | cmake -G "MSYS Makefiles" \ |
DRC | 1c73ce8 | 2010-10-16 21:02:54 +0000 | [diff] [blame] | 546 | -DCMAKE_AR={mingw-w64_binary_path}/x86_64-w64-mingw32-ar \ |
| 547 | -DCMAKE_RANLIB={mingw-w64_binary_path}/x86_64-w64-mingw32-ranlib \ |
| 548 | {source_directory} |
| 549 | make |
| 550 | |
| 551 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 552 | MinGW Build on Linux |
| 553 | -------------------- |
| 554 | |
| 555 | cd {build_directory} |
| 556 | CC={mingw_binary_path}/i386-mingw32-gcc \ |
DRC | 68bf3f2 | 2010-10-18 07:56:14 +0000 | [diff] [blame] | 557 | cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \ |
| 558 | -DCMAKE_AR={mingw_binary_path}/i386-mingw32-ar \ |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 559 | -DCMAKE_RANLIB={mingw_binary_path}/i386-mingw32-ranlib \ |
DRC | 68bf3f2 | 2010-10-18 07:56:14 +0000 | [diff] [blame] | 560 | {source_directory} |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 561 | make |
DRC | 8b014d7 | 2010-02-18 13:03:41 +0000 | [diff] [blame] | 562 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 563 | |
| 564 | ******************************************************************************* |
| 565 | ** Creating Release Packages |
| 566 | ******************************************************************************* |
| 567 | |
| 568 | The following commands can be used to create various types of release packages: |
| 569 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 570 | |
| 571 | Unix |
| 572 | ---- |
| 573 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 574 | make rpm |
| 575 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 576 | Create Red Hat-style binary RPM package. Requires RPM v4 or later. |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 577 | |
| 578 | make srpm |
| 579 | |
| 580 | This runs 'make dist' to create a pristine source tarball, then creates a |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 581 | 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] | 582 | |
| 583 | make deb |
| 584 | |
| 585 | Create Debian-style binary package. Requires dpkg. |
| 586 | |
| 587 | make dmg |
| 588 | |
| 589 | Create Macintosh package/disk image. This requires the PackageMaker |
| 590 | application, which must be installed in /Developer/Applications/Utilities. |
| 591 | |
DRC | 9ef93db | 2010-10-18 08:24:42 +0000 | [diff] [blame] | 592 | make udmg [BUILDDIR32={32-bit build directory}] |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 593 | |
DRC | 0dedd1a | 2010-07-02 09:20:12 +0000 | [diff] [blame] | 594 | On 64-bit OS X systems, this creates a version of the Macintosh package and |
DRC | 9ef93db | 2010-10-18 08:24:42 +0000 | [diff] [blame] | 595 | disk image which contains universal i386/x86-64 binaries. You should first |
| 596 | configure a 32-bit out-of-tree build of libjpeg-turbo, then configure a |
| 597 | 64-bit out-of-tree build, then run 'make udmg' from the 64-bit build |
| 598 | directory. The build system will look for the 32-bit build under |
| 599 | {source_directory}/osxx86 by default, but you can override this by setting |
| 600 | the BUILDDIR32 variable on the make command line as shown above. |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 601 | |
DRC | 0f53df8 | 2010-10-21 19:47:06 +0000 | [diff] [blame] | 602 | make sunpkg |
| 603 | |
| 604 | Build a Solaris package. This requires pkgmk, pkgtrans, and bzip2. |
| 605 | |
| 606 | make csunpkg [BUILDDIR32={32-bit build directory}] |
| 607 | |
| 608 | On 64-bit Solaris systems, this creates a combined package which contains |
| 609 | both 32-bit and 64-bit libraries. You should first configure a 32-bit |
| 610 | out-of-tree build of libjpeg-turbo, then configure a 64-bit out-of-tree |
| 611 | build, then run 'make csunpkg' from the 64-bit build directory. The build |
| 612 | system will look for the 32-bit build under {source_directory}/solx86 by |
| 613 | default, but you can override this by setting the BUILDDIR32 variable on the |
| 614 | make command line as shown above. |
| 615 | |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 616 | make cygwinpkg |
| 617 | |
| 618 | Build a Cygwin binary package. |
| 619 | |
DRC | 0a1f68e | 2010-02-24 07:24:26 +0000 | [diff] [blame] | 620 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 621 | Windows |
| 622 | ------- |
DRC | 0a1f68e | 2010-02-24 07:24:26 +0000 | [diff] [blame] | 623 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 624 | If using NMake: |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 625 | |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 626 | cd {build_directory} |
| 627 | nmake installer |
| 628 | |
DRC | 8154331 | 2010-10-18 07:23:58 +0000 | [diff] [blame] | 629 | If using MinGW: |
DRC | cc24374 | 2010-10-16 09:22:43 +0000 | [diff] [blame] | 630 | |
| 631 | cd {build_directory} |
| 632 | make installer |
| 633 | |
| 634 | If using the Visual Studio IDE, build the "installer" project. |
| 635 | |
| 636 | The installer package (libjpeg-turbo[-gcc][64].exe) will be located under |
| 637 | {build_directory}. If building using the Visual Studio IDE, then the installer |
| 638 | package will be located in a subdirectory with the same name as the |
| 639 | configuration you built (such as {build_directory}\Debug\ or |
| 640 | {build_directory}\Release\). |
| 641 | |
| 642 | Building a Windows installer requires the Nullsoft Install System |
| 643 | (http://nsis.sourceforge.net/.) makensis.exe should be in your PATH. |