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