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