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