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