1Building libjpeg-turbo 2====================== 3 4 5Build Requirements 6------------------ 7 8 9### All Systems 10 11- [CMake](http://www.cmake.org) v2.8.12 or later 12 13- [NASM](http://www.nasm.us) or [YASM](http://yasm.tortall.net) 14 (if building x86 or x86-64 SIMD extensions) 15 * If using NASM, 2.13 or later is required. 16 * If using YASM, 1.2.0 or later is required. 17 * If building on macOS, NASM or YASM can be obtained from 18 [MacPorts](http://www.macports.org/) or [Homebrew](http://brew.sh/). 19 - NOTE: Currently, if it is desirable to hide the SIMD function symbols in 20 Mac executables or shared libraries that statically link with 21 libjpeg-turbo, then NASM 2.14 or later or YASM must be used when 22 building libjpeg-turbo. 23 * If building on Windows, **nasm.exe**/**yasm.exe** should be in your `PATH`. 24 * NASM and YASM are located in the CRB (Code Ready Builder) repository on 25 Red Hat Enterprise Linux 8 and in the PowerTools repository on CentOS 8, 26 which is not enabled by default. 27 28 The binary RPMs released by the NASM project do not work on older Linux 29 systems, such as Red Hat Enterprise Linux 5. On such systems, you can easily 30 build and install NASM from a source RPM by downloading one of the SRPMs from 31 32 <http://www.nasm.us/pub/nasm/releasebuilds> 33 34 and executing the following as root: 35 36 ARCH=`uname -m` 37 rpmbuild --rebuild nasm-{version}.src.rpm 38 rpm -Uvh /usr/src/redhat/RPMS/$ARCH/nasm-{version}.$ARCH.rpm 39 40 NOTE: the NASM build will fail if texinfo is not installed. 41 42 43### Un*x Platforms (including Linux, Mac, FreeBSD, Solaris, and Cygwin) 44 45- GCC v4.1 (or later) or Clang recommended for best performance 46 47- If building the TurboJPEG Java wrapper, JDK or OpenJDK 1.5 or later is 48 required. Most modern Linux distributions, as well as Solaris 10 and later, 49 include JDK or OpenJDK. For other systems, you can obtain the Oracle Java 50 Development Kit from 51 <http://www.oracle.com/technetwork/java/javase/downloads>. 52 53 * If using JDK 11 or later, CMake 3.10.x or later must also be used. 54 55### Windows 56 57- Microsoft Visual C++ 2005 or later 58 59 If you don't already have Visual C++, then the easiest way to get it is by 60 installing 61 [Visual Studio Community Edition](https://visualstudio.microsoft.com), 62 which includes everything necessary to build libjpeg-turbo. 63 64 * You can also download and install the standalone Windows SDK (for Windows 7 65 or later), which includes command-line versions of the 32-bit and 64-bit 66 Visual C++ compilers. 67 * If you intend to build libjpeg-turbo from the command line, then add the 68 appropriate compiler and SDK directories to the `INCLUDE`, `LIB`, and 69 `PATH` environment variables. This is generally accomplished by 70 executing `vcvars32.bat` or `vcvars64.bat`, which are located in the same 71 directory as the compiler. 72 * If built with Visual C++ 2015 or later, the libjpeg-turbo static libraries 73 cannot be used with earlier versions of Visual C++, and vice versa. 74 * The libjpeg API DLL (**jpeg{version}.dll**) will depend on the C run-time 75 DLLs corresponding to the version of Visual C++ that was used to build it. 76 77 ... OR ... 78 79- MinGW 80 81 [MSYS2](http://msys2.github.io/) or [tdm-gcc](http://tdm-gcc.tdragon.net/) 82 recommended if building on a Windows machine. Both distributions install a 83 Start Menu link that can be used to launch a command prompt with the 84 appropriate compiler paths automatically set. 85 86- If building the TurboJPEG Java wrapper, JDK 1.5 or later is required. This 87 can be downloaded from 88 <http://www.oracle.com/technetwork/java/javase/downloads>. 89 90 * If using JDK 11 or later, CMake 3.10.x or later must also be used. 91 92 93Out-of-Tree Builds 94------------------ 95 96Binary objects, libraries, and executables are generated in the directory from 97which CMake is executed (the "binary directory"), and this directory need not 98necessarily be the same as the libjpeg-turbo source directory. You can create 99multiple independent binary directories, in which different versions of 100libjpeg-turbo can be built from the same source tree using different compilers 101or settings. In the sections below, *{build_directory}* refers to the binary 102directory, whereas *{source_directory}* refers to the libjpeg-turbo source 103directory. For in-tree builds, these directories are the same. 104 105 106Ninja 107----- 108 109In all of the procedures and recipes below, replace `make` with `ninja` and 110`Unix Makefiles` with `Ninja` if using Ninja. 111 112 113Build Procedure 114--------------- 115 116NOTE: The build procedures below assume that CMake is invoked from the command 117line, but all of these procedures can be adapted to the CMake GUI as 118well. 119 120 121### Un*x 122 123The following procedure will build libjpeg-turbo on Unix and Unix-like systems. 124(On Solaris, this generates a 32-bit build. See "Build Recipes" below for 12564-bit build instructions.) 126 127 cd {build_directory} 128 cmake -G"Unix Makefiles" [additional CMake flags] {source_directory} 129 make 130 131This will generate the following files under *{build_directory}*: 132 133**libjpeg.a**<br> 134Static link library for the libjpeg API 135 136**libjpeg.so.{version}** (Linux, Unix)<br> 137**libjpeg.{version}.dylib** (Mac)<br> 138**cygjpeg-{version}.dll** (Cygwin)<br> 139Shared library for the libjpeg API 140 141By default, *{version}* is 62.2.0, 7.2.0, or 8.1.2, depending on whether 142libjpeg v6b (default), v7, or v8 emulation is enabled. If using Cygwin, 143*{version}* is 62, 7, or 8. 144 145**libjpeg.so** (Linux, Unix)<br> 146**libjpeg.dylib** (Mac)<br> 147Development symlink for the libjpeg API 148 149**libjpeg.dll.a** (Cygwin)<br> 150Import library for the libjpeg API 151 152**libturbojpeg.a**<br> 153Static link library for the TurboJPEG API 154 155**libturbojpeg.so.0.2.0** (Linux, Unix)<br> 156**libturbojpeg.0.2.0.dylib** (Mac)<br> 157**cygturbojpeg-0.dll** (Cygwin)<br> 158Shared library for the TurboJPEG API 159 160**libturbojpeg.so** (Linux, Unix)<br> 161**libturbojpeg.dylib** (Mac)<br> 162Development symlink for the TurboJPEG API 163 164**libturbojpeg.dll.a** (Cygwin)<br> 165Import library for the TurboJPEG API 166 167 168### Visual C++ (Command Line) 169 170 cd {build_directory} 171 cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release [additional CMake flags] {source_directory} 172 nmake 173 174This will build either a 32-bit or a 64-bit version of libjpeg-turbo, depending 175on which version of **cl.exe** is in the `PATH`. 176 177The following files will be generated under *{build_directory}*: 178 179**jpeg-static.lib**<br> 180Static link library for the libjpeg API 181 182**jpeg{version}.dll**<br> 183DLL for the libjpeg API 184 185**jpeg.lib**<br> 186Import library for the libjpeg API 187 188**turbojpeg-static.lib**<br> 189Static link library for the TurboJPEG API 190 191**turbojpeg.dll**<br> 192DLL for the TurboJPEG API 193 194**turbojpeg.lib**<br> 195Import library for the TurboJPEG API 196 197*{version}* is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or 198v8 emulation is enabled. 199 200 201### Visual C++ (IDE) 202 203Choose the appropriate CMake generator option for your version of Visual Studio 204(run `cmake` with no arguments for a list of available generators.) For 205instance: 206 207 cd {build_directory} 208 cmake -G"Visual Studio 10" [additional CMake flags] {source_directory} 209 210NOTE: Add "Win64" to the generator name (for example, "Visual Studio 10 Win64") 211to build a 64-bit version of libjpeg-turbo. A separate build directory must be 212used for 32-bit and 64-bit builds. 213 214You can then open **ALL_BUILD.vcproj** in Visual Studio and build one of the 215configurations in that project ("Debug", "Release", etc.) to generate a full 216build of libjpeg-turbo. 217 218This will generate the following files under *{build_directory}*: 219 220**{configuration}/jpeg-static.lib**<br> 221Static link library for the libjpeg API 222 223**{configuration}/jpeg{version}.dll**<br> 224DLL for the libjpeg API 225 226**{configuration}/jpeg.lib**<br> 227Import library for the libjpeg API 228 229**{configuration}/turbojpeg-static.lib**<br> 230Static link library for the TurboJPEG API 231 232**{configuration}/turbojpeg.dll**<br> 233DLL for the TurboJPEG API 234 235**{configuration}/turbojpeg.lib**<br> 236Import library for the TurboJPEG API 237 238*{configuration}* is Debug, Release, RelWithDebInfo, or MinSizeRel, depending 239on the configuration you built in the IDE, and *{version}* is 62, 7, or 8, 240depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled. 241 242 243### MinGW 244 245NOTE: This assumes that you are building on a Windows machine using the MSYS 246environment. If you are cross-compiling on a Un*x platform (including Mac and 247Cygwin), then see "Build Recipes" below. 248 249 cd {build_directory} 250 cmake -G"MSYS Makefiles" [additional CMake flags] {source_directory} 251 make 252 253This will generate the following files under *{build_directory}*: 254 255**libjpeg.a**<br> 256Static link library for the libjpeg API 257 258**libjpeg-{version}.dll**<br> 259DLL for the libjpeg API 260 261**libjpeg.dll.a**<br> 262Import library for the libjpeg API 263 264**libturbojpeg.a**<br> 265Static link library for the TurboJPEG API 266 267**libturbojpeg.dll**<br> 268DLL for the TurboJPEG API 269 270**libturbojpeg.dll.a**<br> 271Import library for the TurboJPEG API 272 273*{version}* is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or 274v8 emulation is enabled. 275 276 277### Debug Build 278 279Add `-DCMAKE_BUILD_TYPE=Debug` to the CMake command line. Or, if building 280with NMake, remove `-DCMAKE_BUILD_TYPE=Release` (Debug builds are the default 281with NMake.) 282 283 284### libjpeg v7 or v8 API/ABI Emulation 285 286Add `-DWITH_JPEG7=1` to the CMake command line to build a version of 287libjpeg-turbo that is API/ABI-compatible with libjpeg v7. Add `-DWITH_JPEG8=1` 288to the CMake command line to build a version of libjpeg-turbo that is 289API/ABI-compatible with libjpeg v8. See [README.md](README.md) for more 290information about libjpeg v7 and v8 emulation. 291 292 293### In-Memory Source/Destination Managers 294 295When using libjpeg v6b or v7 API/ABI emulation, add `-DWITH_MEM_SRCDST=0` to 296the CMake command line to build a version of libjpeg-turbo that lacks the 297`jpeg_mem_src()` and `jpeg_mem_dest()` functions. These functions were not 298part of the original libjpeg v6b and v7 APIs, so removing them ensures strict 299conformance with those APIs. See [README.md](README.md) for more information. 300 301 302### Arithmetic Coding Support 303 304Since the patent on arithmetic coding has expired, this functionality has been 305included in this release of libjpeg-turbo. libjpeg-turbo's implementation is 306based on the implementation in libjpeg v8, but it works when emulating libjpeg 307v7 or v6b as well. The default is to enable both arithmetic encoding and 308decoding, but those who have philosophical objections to arithmetic coding can 309add `-DWITH_ARITH_ENC=0` or `-DWITH_ARITH_DEC=0` to the CMake command line to 310disable encoding or decoding (respectively.) 311 312 313### TurboJPEG Java Wrapper 314 315Add `-DWITH_JAVA=1` to the CMake command line to incorporate an optional Java 316Native Interface (JNI) wrapper into the TurboJPEG shared library and build the 317Java front-end classes to support it. This allows the TurboJPEG shared library 318to be used directly from Java applications. See [java/README](java/README) for 319more details. 320 321If Java is not in your `PATH`, or if you wish to use an alternate JDK to 322build/test libjpeg-turbo, then (prior to running CMake) set the `JAVA_HOME` 323environment variable to the location of the JDK that you wish to use. The 324`Java_JAVAC_EXECUTABLE`, `Java_JAVA_EXECUTABLE`, and `Java_JAR_EXECUTABLE` 325CMake variables can also be used to specify alternate commands or locations for 326javac, jar, and java (respectively.) You can also set the 327`CMAKE_JAVA_COMPILE_FLAGS` CMake variable or the `JAVAFLAGS` environment 328variable to specify arguments that should be passed to the Java compiler when 329building the TurboJPEG classes, and the `JAVAARGS` CMake variable to specify 330arguments that should be passed to the JRE when running the TurboJPEG Java unit 331tests. 332 333 334Build Recipes 335------------- 336 337 338### 32-bit Build on 64-bit Linux/Unix 339 340Use export/setenv to set the following environment variables before running 341CMake: 342 343 CFLAGS=-m32 344 LDFLAGS=-m32 345 346 347### 64-bit Build on Solaris 348 349Use export/setenv to set the following environment variables before running 350CMake: 351 352 CFLAGS=-m64 353 LDFLAGS=-m64 354 355 356### Other Compilers 357 358On Un*x systems, prior to running CMake, you can set the `CC` environment 359variable to the command used to invoke the C compiler. 360 361 362### 32-bit MinGW Build on Un*x (including Mac and Cygwin) 363 364Create a file called **toolchain.cmake** under *{build_directory}*, with the 365following contents: 366 367 set(CMAKE_SYSTEM_NAME Windows) 368 set(CMAKE_SYSTEM_PROCESSOR X86) 369 set(CMAKE_C_COMPILER {mingw_binary_path}/i686-w64-mingw32-gcc) 370 set(CMAKE_RC_COMPILER {mingw_binary_path}/i686-w64-mingw32-windres) 371 372*{mingw\_binary\_path}* is the directory under which the MinGW binaries are 373located (usually **/usr/bin**.) Next, execute the following commands: 374 375 cd {build_directory} 376 cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \ 377 [additional CMake flags] {source_directory} 378 make 379 380 381### 64-bit MinGW Build on Un*x (including Mac and Cygwin) 382 383Create a file called **toolchain.cmake** under *{build_directory}*, with the 384following contents: 385 386 set(CMAKE_SYSTEM_NAME Windows) 387 set(CMAKE_SYSTEM_PROCESSOR AMD64) 388 set(CMAKE_C_COMPILER {mingw_binary_path}/x86_64-w64-mingw32-gcc) 389 set(CMAKE_RC_COMPILER {mingw_binary_path}/x86_64-w64-mingw32-windres) 390 391*{mingw\_binary\_path}* is the directory under which the MinGW binaries are 392located (usually **/usr/bin**.) Next, execute the following commands: 393 394 cd {build_directory} 395 cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \ 396 [additional CMake flags] {source_directory} 397 make 398 399 400Building libjpeg-turbo for iOS 401------------------------------ 402 403iOS platforms, such as the iPhone and iPad, use Arm processors, and all 404currently supported models include Neon instructions. Thus, they can take 405advantage of libjpeg-turbo's SIMD extensions to significantly accelerate JPEG 406compression/decompression. This section describes how to build libjpeg-turbo 407for these platforms. 408 409 410### Armv8 (64-bit) 411 412**Xcode 5 or later required, Xcode 6.3.x or later recommended** 413 414The following script demonstrates how to build libjpeg-turbo to run on the 415iPhone 5S/iPad Mini 2/iPad Air and newer. 416 417 IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform 418 IOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk) 419 export CFLAGS="-Wall -arch arm64 -miphoneos-version-min=8.0 -funwind-tables" 420 421 cd {build_directory} 422 423 cat <<EOF >toolchain.cmake 424 set(CMAKE_SYSTEM_NAME Darwin) 425 set(CMAKE_SYSTEM_PROCESSOR aarch64) 426 set(CMAKE_C_COMPILER /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang) 427 EOF 428 429 cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \ 430 -DCMAKE_OSX_SYSROOT=${IOS_SYSROOT[0]} \ 431 [additional CMake flags] {source_directory} 432 make 433 434 435Building libjpeg-turbo for Android 436---------------------------------- 437 438Building libjpeg-turbo for Android platforms requires v13b or later of the 439[Android NDK](https://developer.android.com/tools/sdk/ndk). 440 441 442### Armv7 (32-bit) 443 444**NDK r19 or later with Clang recommended** 445 446The following is a general recipe script that can be modified for your specific 447needs. 448 449 # Set these variables to suit your needs 450 NDK_PATH={full path to the NDK directory-- for example, 451 /opt/android/android-ndk-r16b} 452 TOOLCHAIN={"gcc" or "clang"-- "gcc" must be used with NDK r16b and earlier, 453 and "clang" must be used with NDK r17c and later} 454 ANDROID_VERSION={the minimum version of Android to support-- for example, 455 "16", "19", etc.} 456 457 cd {build_directory} 458 cmake -G"Unix Makefiles" \ 459 -DANDROID_ABI=armeabi-v7a \ 460 -DANDROID_ARM_MODE=arm \ 461 -DANDROID_PLATFORM=android-${ANDROID_VERSION} \ 462 -DANDROID_TOOLCHAIN=${TOOLCHAIN} \ 463 -DCMAKE_ASM_FLAGS="--target=arm-linux-androideabi${ANDROID_VERSION}" \ 464 -DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \ 465 [additional CMake flags] {source_directory} 466 make 467 468 469### Armv8 (64-bit) 470 471**Clang recommended** 472 473The following is a general recipe script that can be modified for your specific 474needs. 475 476 # Set these variables to suit your needs 477 NDK_PATH={full path to the NDK directory-- for example, 478 /opt/android/android-ndk-r16b} 479 TOOLCHAIN={"gcc" or "clang"-- "gcc" must be used with NDK r14b and earlier, 480 and "clang" must be used with NDK r17c and later} 481 ANDROID_VERSION={the minimum version of Android to support. "21" or later 482 is required for a 64-bit build.} 483 484 cd {build_directory} 485 cmake -G"Unix Makefiles" \ 486 -DANDROID_ABI=arm64-v8a \ 487 -DANDROID_ARM_MODE=arm \ 488 -DANDROID_PLATFORM=android-${ANDROID_VERSION} \ 489 -DANDROID_TOOLCHAIN=${TOOLCHAIN} \ 490 -DCMAKE_ASM_FLAGS="--target=aarch64-linux-android${ANDROID_VERSION}" \ 491 -DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \ 492 [additional CMake flags] {source_directory} 493 make 494 495 496### x86 (32-bit) 497 498The following is a general recipe script that can be modified for your specific 499needs. 500 501 # Set these variables to suit your needs 502 NDK_PATH={full path to the NDK directory-- for example, 503 /opt/android/android-ndk-r16b} 504 TOOLCHAIN={"gcc" or "clang"-- "gcc" must be used with NDK r14b and earlier, 505 and "clang" must be used with NDK r17c and later} 506 ANDROID_VERSION={The minimum version of Android to support-- for example, 507 "16", "19", etc.} 508 509 cd {build_directory} 510 cmake -G"Unix Makefiles" \ 511 -DANDROID_ABI=x86 \ 512 -DANDROID_PLATFORM=android-${ANDROID_VERSION} \ 513 -DANDROID_TOOLCHAIN=${TOOLCHAIN} \ 514 -DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \ 515 [additional CMake flags] {source_directory} 516 make 517 518 519### x86-64 (64-bit) 520 521The following is a general recipe script that can be modified for your specific 522needs. 523 524 # Set these variables to suit your needs 525 NDK_PATH={full path to the NDK directory-- for example, 526 /opt/android/android-ndk-r16b} 527 TOOLCHAIN={"gcc" or "clang"-- "gcc" must be used with NDK r14b and earlier, 528 and "clang" must be used with NDK r17c and later} 529 ANDROID_VERSION={the minimum version of Android to support. "21" or later 530 is required for a 64-bit build.} 531 532 cd {build_directory} 533 cmake -G"Unix Makefiles" \ 534 -DANDROID_ABI=x86_64 \ 535 -DANDROID_PLATFORM=android-${ANDROID_VERSION} \ 536 -DANDROID_TOOLCHAIN=${TOOLCHAIN} \ 537 -DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \ 538 [additional CMake flags] {source_directory} 539 make 540 541 542Advanced CMake Options 543---------------------- 544 545To list and configure other CMake options not specifically mentioned in this 546guide, run 547 548 ccmake {source_directory} 549 550or 551 552 cmake-gui {source_directory} 553 554from the build directory after initially configuring the build. CCMake is a 555text-based interactive version of CMake, and CMake-GUI is a GUI version. Both 556will display all variables that are relevant to the libjpeg-turbo build, their 557current values, and a help string describing what they do. 558 559 560Installing libjpeg-turbo 561======================== 562 563You can use the build system to install libjpeg-turbo (as opposed to creating 564an installer package.) To do this, run `make install` or `nmake install` 565(or build the "install" target in the Visual Studio IDE.) Running 566`make uninstall` or `nmake uninstall` (or building the "uninstall" target in 567the Visual Studio IDE) will uninstall libjpeg-turbo. 568 569The `CMAKE_INSTALL_PREFIX` CMake variable can be modified in order to install 570libjpeg-turbo into a directory of your choosing. If you don't specify 571`CMAKE_INSTALL_PREFIX`, then the default is: 572 573**c:\libjpeg-turbo**<br> 574Visual Studio 32-bit build 575 576**c:\libjpeg-turbo64**<br> 577Visual Studio 64-bit build 578 579**c:\libjpeg-turbo-gcc**<br> 580MinGW 32-bit build 581 582**c:\libjpeg-turbo-gcc64**<br> 583MinGW 64-bit build 584 585**/opt/libjpeg-turbo**<br> 586Un*x 587 588The default value of `CMAKE_INSTALL_PREFIX` causes the libjpeg-turbo files to 589be installed with a directory structure resembling that of the official 590libjpeg-turbo binary packages. Changing the value of `CMAKE_INSTALL_PREFIX` 591(for instance, to **/usr/local**) causes the libjpeg-turbo files to be 592installed with a directory structure that conforms to GNU standards. 593 594The `CMAKE_INSTALL_BINDIR`, `CMAKE_INSTALL_DATAROOTDIR`, 595`CMAKE_INSTALL_DOCDIR`, `CMAKE_INSTALL_INCLUDEDIR`, `CMAKE_INSTALL_JAVADIR`, 596`CMAKE_INSTALL_LIBDIR`, and `CMAKE_INSTALL_MANDIR` CMake variables allow a 597finer degree of control over where specific files in the libjpeg-turbo 598distribution should be installed. These directory variables can either be 599specified as absolute paths or as paths relative to `CMAKE_INSTALL_PREFIX` (for 600instance, setting `CMAKE_INSTALL_DOCDIR` to **doc** would cause the 601documentation to be installed in **${CMAKE\_INSTALL\_PREFIX}/doc**.) If a 602directory variable contains the name of another directory variable in angle 603brackets, then its final value will depend on the final value of that other 604variable. For instance, the default value of `CMAKE_INSTALL_MANDIR` is 605**\<CMAKE\_INSTALL\_DATAROOTDIR\>/man**. 606 607NOTE: If setting one of these directory variables to a relative path using the 608CMake command line, you must specify that the variable is of type `PATH`. 609For example: 610 611 cmake -G"{generator type}" -DCMAKE_INSTALL_LIBDIR:PATH=lib {source_directory} 612 613Otherwise, CMake will assume that the path is relative to the build directory 614rather than the install directory. 615 616 617Creating Distribution Packages 618============================== 619 620The following commands can be used to create various types of distribution 621packages: 622 623 624Linux 625----- 626 627 make rpm 628 629Create Red Hat-style binary RPM package. Requires RPM v4 or later. 630 631 make srpm 632 633This runs `make dist` to create a pristine source tarball, then creates a 634Red Hat-style source RPM package from the tarball. Requires RPM v4 or later. 635 636 make deb 637 638Create Debian-style binary package. Requires dpkg. 639 640 641Mac 642--- 643 644 make dmg 645 646Create Mac package/disk image. This requires pkgbuild and productbuild, which 647are installed by default on OS X/macOS 10.7 and later. 648 649In order to create a Mac package/disk image that contains universal 650x86-64/Arm binaries, set the following CMake variable: 651 652* `ARMV8_BUILD`: Directory containing an Armv8 (64-bit) iOS or macOS build of 653 libjpeg-turbo to include in the universal binaries 654 655You should first use CMake to configure an Armv8 sub-build of libjpeg-turbo 656(see "Building libjpeg-turbo for iOS" above, if applicable) in a build 657directory that matches the one specified in the aforementioned CMake variable. 658Next, configure the primary (x86-64) build of libjpeg-turbo as an out-of-tree 659build, specifying the aforementioned CMake variable, and build it. Once the 660primary build has been built, run `make dmg` from the build directory. The 661packaging system will build the sub-build, use lipo to combine it with the 662primary build into a single set of universal binaries, then package the 663universal binaries. 664 665 666Windows 667------- 668 669If using NMake: 670 671 cd {build_directory} 672 nmake installer 673 674If using MinGW: 675 676 cd {build_directory} 677 make installer 678 679If using the Visual Studio IDE, build the "installer" target. 680 681The installer package (libjpeg-turbo-*{version}*[-gcc|-vc][64].exe) will be 682located under *{build_directory}*. If building using the Visual Studio IDE, 683then the installer package will be located in a subdirectory with the same name 684as the configuration you built (such as *{build_directory}*\Debug\ or 685*{build_directory}*\Release\). 686 687Building a Windows installer requires the 688[Nullsoft Install System](http://nsis.sourceforge.net/). makensis.exe should 689be in your `PATH`. 690 691 692Regression testing 693================== 694 695The most common way to test libjpeg-turbo is by invoking `make test` (Un*x) or 696`nmake test` (Windows command line) or by building the "RUN_TESTS" target 697(Visual Studio IDE), once the build has completed. This runs a series of tests 698to ensure that mathematical compatibility has been maintained between 699libjpeg-turbo and libjpeg v6b. This also invokes the TurboJPEG unit tests, 700which ensure that the colorspace extensions, YUV encoding, decompression 701scaling, and other features of the TurboJPEG C and Java APIs are working 702properly (and, by extension, that the equivalent features of the underlying 703libjpeg API are also working.) 704 705Invoking `make testclean` (Un*x) or `nmake testclean` (Windows command line) or 706building the "testclean" target (Visual Studio IDE) will clean up the output 707images generated by the tests. 708 709On Un*x platforms, more extensive tests of the TurboJPEG C and Java wrappers 710can be run by invoking `make tjtest`. These extended TurboJPEG tests 711essentially iterate through all of the available features of the TurboJPEG APIs 712that are not covered by the TurboJPEG unit tests (including the lossless 713transform options) and compare the images generated by each feature to images 714generated using the equivalent feature in the libjpeg API. The extended 715TurboJPEG tests are meant to test for regressions in the TurboJPEG wrappers, 716not in the underlying libjpeg API library. 717