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