BUILDING.txt 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807
  1. *******************************************************************************
  2. ** Building on Un*x Platforms (including Cygwin and OS X)
  3. *******************************************************************************
  4. ==================
  5. Build Requirements
  6. ==================
  7. -- autoconf 2.56 or later
  8. -- automake 1.7 or later
  9. -- libtool 1.4 or later
  10. * If using Xcode 4.3 or later on OS X, autoconf and automake are no longer
  11. provided. The easiest way to obtain them is from MacPorts
  12. (http://www.macports.org/).
  13. -- NASM (if building x86 or x86-64 SIMD extensions)
  14. * 0.98, or 2.01 or later is required for a 32-bit build
  15. * NASM 2.00 or later is required for a 64-bit build
  16. * NASM 2.07 or later is required for a 64-bit build on OS X. This can be
  17. obtained from MacPorts (http://www.macports.org/).
  18. The binary RPMs released by the NASM project do not work on older Linux
  19. systems, such as Red Hat Enterprise Linux 4. On such systems, you can
  20. easily build and install NASM from a source RPM by downloading one of the
  21. SRPMs from
  22. http://www.nasm.us/pub/nasm/releasebuilds
  23. and executing the following as root:
  24. ARCH=`uname -m`
  25. rpmbuild --rebuild nasm-{version}.src.rpm
  26. rpm -Uvh /usr/src/redhat/RPMS/$ARCH/nasm-{version}.$ARCH.rpm
  27. NOTE: the NASM build will fail if texinfo is not installed.
  28. -- GCC v4.1 or later recommended for best performance
  29. * Beginning with Xcode 4, Apple stopped distributing GCC and switched to
  30. the LLVM compiler. Xcode v4.0 through v4.6 provides a GCC front end
  31. called LLVM-GCC. Unfortunately, as of this writing, neither LLVM-GCC nor
  32. the LLVM (clang) compiler produces optimal performance with libjpeg-turbo.
  33. Building libjpeg-turbo with LLVM-GCC v4.2 results in a 10% performance
  34. degradation when compressing using 64-bit code, relative to building
  35. libjpeg-turbo with GCC v4.2. Building libjpeg-turbo with LLVM (clang)
  36. results in a 20% performance degradation when compressing using 64-bit
  37. code, relative to building libjpeg-turbo with GCC v4.2. If you are
  38. running Snow Leopard or earlier, it is suggested that you continue to use
  39. Xcode v3.2.6, which provides GCC v4.2. If you are using Lion or later, it
  40. is suggested that you install Apple GCC v4.2 through MacPorts.
  41. -- If building the TurboJPEG Java wrapper, JDK or OpenJDK 1.5 or later is
  42. required. Some systems, such as OS X 10.4, Solaris 10 and later, and Red
  43. Hat Enterprise Linux 5 and later, have this pre-installed. On OS X 10.5 and
  44. later, it will be necessary to install the Java Developer Package, which can
  45. be downloaded from http://developer.apple.com/downloads (Apple ID required.)
  46. For systems that do not have a JDK installed, you can obtain the Oracle Java
  47. Development Kit from http://www.java.com.
  48. ==================
  49. Out-of-Tree Builds
  50. ==================
  51. Binary objects, libraries, and executables are generated in the same directory
  52. from which configure was executed (the "binary directory"), and this directory
  53. need not necessarily be the same as the libjpeg-turbo source directory. You
  54. can create multiple independent binary directories, in which different versions
  55. of libjpeg-turbo can be built from the same source tree using different
  56. compilers or settings. In the sections below, {build_directory} refers to the
  57. binary directory, whereas {source_directory} refers to the libjpeg-turbo source
  58. directory. For in-tree builds, these directories are the same.
  59. ======================
  60. Building libjpeg-turbo
  61. ======================
  62. The following procedure will build libjpeg-turbo on Linux, FreeBSD, Cygwin, and
  63. Solaris/x86 systems (on Solaris, this generates a 32-bit library. See below
  64. for 64-bit build instructions.)
  65. cd {source_directory}
  66. autoreconf -fiv
  67. cd {build_directory}
  68. sh {source_directory}/configure [additional configure flags]
  69. make
  70. NOTE: Running autoreconf in the source directory is usually only necessary if
  71. building libjpeg-turbo from the SVN repository.
  72. This will generate the following files under .libs/
  73. libjpeg.a
  74. Static link library for the libjpeg API
  75. libjpeg.so.{version} (Linux, Unix)
  76. libjpeg.{version}.dylib (OS X)
  77. cygjpeg-{version}.dll (Cygwin)
  78. Shared library for the libjpeg API
  79. By default, {version} is 62.1.0, 7.1.0, or 8.0.2, depending on whether
  80. libjpeg v6b (default), v7, or v8 emulation is enabled. If using Cygwin,
  81. {version} is 62, 7, or 8.
  82. libjpeg.so (Linux, Unix)
  83. libjpeg.dylib (OS X)
  84. Development symlink for the libjpeg API
  85. libjpeg.dll.a (Cygwin)
  86. Import library for the libjpeg API
  87. libturbojpeg.a
  88. Static link library for the TurboJPEG API
  89. libturbojpeg.so.0.0.0 (Linux, Unix)
  90. libturbojpeg.0.0.0.dylib (OS X)
  91. cygturbojpeg-0.dll (Cygwin)
  92. Shared library for the TurboJPEG API
  93. libturbojpeg.so (Linux, Unix)
  94. libturbojpeg.dylib (OS X)
  95. Development symlink for the TurboJPEG API
  96. libturbojpeg.dll.a (Cygwin)
  97. Import library for the TurboJPEG API
  98. libjpeg v7 or v8 API/ABI Emulation
  99. ----------------------------------
  100. Add --with-jpeg7 to the configure command line to build a version of
  101. libjpeg-turbo that is API/ABI-compatible with libjpeg v7. Add --with-jpeg8 to
  102. the configure command to build a version of libjpeg-turbo that is
  103. API/ABI-compatible with libjpeg v8. See README-turbo.txt for more information
  104. on libjpeg v7 and v8 emulation.
  105. In-Memory Source/Destination Managers
  106. -------------------------------------
  107. When using libjpeg v6b or v7 API/ABI emulation, add --without-mem-srcdst to the
  108. configure command line to build a version of libjpeg-turbo that lacks the
  109. jpeg_mem_src() and jpeg_mem_dest() functions. These functions were not part of
  110. the original libjpeg v6b and v7 APIs, so removing them ensures strict
  111. conformance with those APIs. See README-turbo.txt for more information.
  112. Arithmetic Coding Support
  113. -------------------------
  114. Since the patent on arithmetic coding has expired, this functionality has been
  115. included in this release of libjpeg-turbo. libjpeg-turbo's implementation is
  116. based on the implementation in libjpeg v8, but it works when emulating libjpeg
  117. v7 or v6b as well. The default is to enable both arithmetic encoding and
  118. decoding, but those who have philosophical objections to arithmetic coding can
  119. add --without-arith-enc or --without-arith-dec to the configure command line to
  120. disable encoding or decoding (respectively.)
  121. TurboJPEG Java Wrapper
  122. ----------------------
  123. Add --with-java to the configure command line to incorporate an optional Java
  124. Native Interface wrapper into the TurboJPEG shared library and build the Java
  125. front-end classes to support it. This allows the TurboJPEG shared library to
  126. be used directly from Java applications. See java/README for more details.
  127. You can set the JAVAC, JAR, and JAVA configure variables to specify
  128. alternate commands for javac, jar, and java (respectively.) You can also
  129. set the JAVACFLAGS configure variable to specify arguments that should be
  130. passed to the Java compiler when building the front-end classes, and JNI_CFLAGS
  131. to specify arguments that should be passed to the C compiler when building the
  132. JNI wrapper. Run 'configure --help' for more details.
  133. ========================
  134. Installing libjpeg-turbo
  135. ========================
  136. If you intend to install these libraries and the associated header files, then
  137. replace 'make' in the instructions above with
  138. make install prefix={base dir} libdir={library directory}
  139. For example,
  140. make install prefix=/usr/local libdir=/usr/local/lib64
  141. will install the header files in /usr/local/include and the library files in
  142. /usr/local/lib64. If 'prefix' and 'libdir' are not specified, then the default
  143. is to install the header files in /opt/libjpeg-turbo/include and the library
  144. files in /opt/libjpeg-turbo/lib32 (32-bit) or /opt/libjpeg-turbo/lib64
  145. (64-bit.)
  146. NOTE: You can specify a prefix of /usr and a libdir of, for instance,
  147. /usr/lib64 to overwrite the system's version of libjpeg. If you do this,
  148. however, then be sure to BACK UP YOUR SYSTEM'S INSTALLATION OF LIBJPEG before
  149. overwriting it. It is recommended that you instead install libjpeg-turbo into
  150. a non-system directory and manipulate the LD_LIBRARY_PATH or create symlinks
  151. to force applications to use libjpeg-turbo instead of libjpeg. See
  152. README-turbo.txt for more information.
  153. =============
  154. Build Recipes
  155. =============
  156. 32-bit Build on 64-bit Linux
  157. ----------------------------
  158. Add
  159. --host i686-pc-linux-gnu CFLAGS='-O3 -m32' LDFLAGS=-m32
  160. to the configure command line.
  161. 64-bit Build on 64-bit OS X
  162. ---------------------------
  163. Add
  164. --host x86_64-apple-darwin NASM=/opt/local/bin/nasm
  165. to the configure command line. NASM 2.07 or later from MacPorts must be
  166. installed.
  167. 32-bit Build on 64-bit OS X
  168. ---------------------------
  169. Add
  170. --host i686-apple-darwin CFLAGS='-O3 -m32' LDFLAGS=-m32
  171. to the configure command line.
  172. 64-bit Backward-Compatible Build on 64-bit OS X
  173. -----------------------------------------------
  174. Add
  175. --host x86_64-apple-darwin NASM=/opt/local/bin/nasm \
  176. CFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
  177. -mmacosx-version-min=10.4 -O3' \
  178. LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
  179. -mmacosx-version-min=10.4'
  180. to the configure command line. The OS X 10.4 SDK, and NASM 2.07 or later from
  181. MacPorts, must be installed.
  182. 32-bit Backward-Compatible Build on OS X
  183. ----------------------------------------
  184. Add
  185. --host i686-apple-darwin \
  186. CFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
  187. -mmacosx-version-min=10.4 -O3 -m32' \
  188. LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
  189. -mmacosx-version-min=10.4 -m32'
  190. to the configure command line. The OS X 10.4 SDK must be installed.
  191. 64-bit Library Build on 64-bit Solaris
  192. --------------------------------------
  193. Add
  194. --host x86_64-pc-solaris CFLAGS='-O3 -m64' LDFLAGS=-m64
  195. to the configure command line.
  196. 32-bit Build on 64-bit FreeBSD
  197. ------------------------------
  198. Add
  199. --host i386-unknown-freebsd CC='gcc -B /usr/lib32' CFLAGS='-O3 -m32' \
  200. LDFLAGS='-B/usr/lib32'
  201. to the configure command line. NASM 2.07 or later from FreeBSD ports must be
  202. installed.
  203. Oracle Solaris Studio
  204. ---------------------
  205. Add
  206. CC=cc
  207. to the configure command line. libjpeg-turbo will automatically be built with
  208. the maximum optimization level (-xO5) unless you override CFLAGS.
  209. To build a 64-bit version of libjpeg-turbo using Oracle Solaris Studio, add
  210. --host x86_64-pc-solaris CC=cc CFLAGS='-xO5 -m64' LDFLAGS=-m64
  211. to the configure command line.
  212. MinGW Build on Cygwin
  213. ---------------------
  214. Use CMake (see recipes below)
  215. ===========
  216. ARM Support
  217. ===========
  218. This release of libjpeg-turbo can use ARM NEON SIMD instructions to accelerate
  219. JPEG compression/decompression by approximately 2-4x on ARMv7 and later
  220. platforms. If libjpeg-turbo is configured on an ARM Linux platform, then the
  221. build system will automatically include the NEON SIMD routines, if they are
  222. supported.
  223. Building libjpeg-turbo for iOS
  224. ------------------------------
  225. iOS platforms, such as the iPhone and iPad, also use ARM processors, some of
  226. which support NEON instructions. Additional steps are required to build
  227. libjpeg-turbo for these platforms. The steps below assume iOS SDK v4.3. If
  228. you are using a different SDK version, then you will need to modify the
  229. examples accordingly.
  230. Additional build requirements:
  231. gas-preprocessor.pl
  232. (https://sourceforge.net/p/libjpeg-turbo/code/HEAD/tree/gas-preprocessor)
  233. should be installed in your PATH.
  234. Set the following shell variables for simplicity:
  235. Xcode 3.2.x / iOS 4.3 SDK:
  236. IOS_PLATFORMDIR=/Developer/Platforms/iPhoneOS.platform
  237. IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS4.3.sdk
  238. IOS_GCC=$IOS_PLATFORMDIR/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2
  239. Xcode 4.5.x / iOS 6.0 SDK:
  240. IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
  241. IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS6.0.sdk
  242. IOS_GCC=$IOS_PLATFORMDIR/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2
  243. Xcode 4.6.x / iOS 6.1 SDK:
  244. IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
  245. IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS6.1.sdk
  246. IOS_GCC=$IOS_PLATFORMDIR/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2
  247. Xcode 5.0.x / iOS 7.0 SDK:
  248. IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
  249. IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS7.0.sdk
  250. IOS_GCC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
  251. ARM v6 only (up to and including iPhone 3G):
  252. [NOTE: Requires Xcode 4.4.x or earlier]
  253. IOS_CFLAGS="-march=armv6 -mcpu=arm1176jzf-s -mfpu=vfp"
  254. ARM v7 only (iPhone 3GS-4S, iPad 1st-3rd Generation):
  255. GCC:
  256. IOS_CFLAGS="-march=armv7 -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon"
  257. Clang:
  258. IOS_CFLAGS="-arch armv7 -no-integrated-as"
  259. ARM v7s only (iPhone 5, iPad 4th Generation):
  260. [NOTE: Requires Xcode 4.5 or later]
  261. GCC
  262. IOS_CFLAGS="-march=armv7s -mcpu=swift -mtune=swift -mfpu=neon"
  263. Clang:
  264. IOS_CFLAGS="-arch armv7s -no-integrated-as"
  265. Follow the procedure under "Building libjpeg-turbo" above, adding
  266. --host arm-apple-darwin10 --enable-static --disable-shared \
  267. CC="$IOS_GCC" LD="$IOS_GCC" \
  268. CFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT -O3 $IOS_CFLAGS" \
  269. LDFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT $IOS_CFLAGS"
  270. to the configure command line.
  271. Once built, lipo can be used to combine the ARM v6, v7, and/or v7s variants
  272. into a universal library.
  273. NOTE: If you are building libjpeg-turbo from the "official" project tarball,
  274. then it is highly likely that you will need to run 'autoreconf -fiv' in the
  275. source tree prior to building ARM v7 or v7s iOS binaries using the techniques
  276. described above. Otherwise, you may get a libtool error such as "unable to
  277. infer tagged configuration."
  278. *******************************************************************************
  279. ** Building on Windows (Visual C++ or MinGW)
  280. *******************************************************************************
  281. ==================
  282. Build Requirements
  283. ==================
  284. -- CMake (http://www.cmake.org) v2.6 or later
  285. -- Microsoft Visual C++ 2005 or later
  286. If you don't already have Visual C++, then the easiest way to get it is by
  287. installing the Windows SDK:
  288. http://msdn.microsoft.com/en-us/windows/bb980924.aspx
  289. The Windows SDK includes both 32-bit and 64-bit Visual C++ compilers and
  290. everything necessary to build libjpeg-turbo.
  291. * For 32-bit builds, you can also use Microsoft Visual C++ Express
  292. Edition. Visual C++ Express Edition is a free download.
  293. * If you intend to build libjpeg-turbo from the command line, then add the
  294. appropriate compiler and SDK directories to the INCLUDE, LIB, and PATH
  295. environment variables. This is generally accomplished by executing
  296. vcvars32.bat or vcvars64.bat and SetEnv.cmd. vcvars32.bat and
  297. vcvars64.bat are part of Visual C++ and are located in the same directory
  298. as the compiler. SetEnv.cmd is part of the Windows SDK. You can pass
  299. optional arguments to SetEnv.cmd to specify a 32-bit or 64-bit build
  300. environment.
  301. ... OR ...
  302. -- MinGW
  303. GCC v4.1 or later recommended for best performance
  304. -- NASM (http://www.nasm.us/) 0.98 or later (NASM 2.05 or later is required for
  305. a 64-bit build)
  306. -- If building the TurboJPEG Java wrapper, JDK 1.5 or later is required. This
  307. can be downloaded from http://www.java.com.
  308. ==================
  309. Out-of-Tree Builds
  310. ==================
  311. Binary objects, libraries, and executables are generated in the same directory
  312. from which cmake was executed (the "binary directory"), and this directory need
  313. not necessarily be the same as the libjpeg-turbo source directory. You can
  314. create multiple independent binary directories, in which different versions of
  315. libjpeg-turbo can be built from the same source tree using different compilers
  316. or settings. In the sections below, {build_directory} refers to the binary
  317. directory, whereas {source_directory} refers to the libjpeg-turbo source
  318. directory. For in-tree builds, these directories are the same.
  319. ======================
  320. Building libjpeg-turbo
  321. ======================
  322. Visual C++ (Command Line)
  323. -------------------------
  324. cd {build_directory}
  325. cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release {source_directory}
  326. nmake
  327. This will build either a 32-bit or a 64-bit version of libjpeg-turbo, depending
  328. on which version of cl.exe is in the PATH.
  329. The following files will be generated under {build_directory}:
  330. jpeg-static.lib
  331. Static link library for the libjpeg API
  332. sharedlib/jpeg{version}.dll
  333. DLL for the libjpeg API
  334. sharedlib/jpeg.lib
  335. Import library for the libjpeg API
  336. turbojpeg-static.lib
  337. Static link library for the TurboJPEG API
  338. turbojpeg.dll
  339. DLL for the TurboJPEG API
  340. turbojpeg.lib
  341. Import library for the TurboJPEG API
  342. {version} is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or
  343. v8 emulation is enabled.
  344. Visual C++ (IDE)
  345. ----------------
  346. Choose the appropriate CMake generator option for your version of Visual Studio
  347. (run "cmake" with no arguments for a list of available generators.) For
  348. instance:
  349. cd {build_directory}
  350. cmake -G "Visual Studio 9 2008" {source_directory}
  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. This will generate the following files under {build_directory}:
  355. {configuration}/jpeg-static.lib
  356. Static link library for the libjpeg API
  357. sharedlib/{configuration}/jpeg{version}.dll
  358. DLL for the libjpeg API
  359. sharedlib/{configuration}/jpeg.lib
  360. Import library for the libjpeg API
  361. {configuration}/turbojpeg-static.lib
  362. Static link library for the TurboJPEG API
  363. {configuration}/turbojpeg.dll
  364. DLL for the TurboJPEG API
  365. {configuration}/turbojpeg.lib
  366. Import library for the TurboJPEG API
  367. {configuration} is Debug, Release, RelWithDebInfo, or MinSizeRel, depending on
  368. the configuration you built in the IDE, and {version} is 62, 7, or 8,
  369. depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled.
  370. MinGW
  371. -----
  372. cd {build_directory}
  373. cmake -G "MSYS Makefiles" {source_directory}
  374. make
  375. This will generate the following files under {build_directory}
  376. libjpeg.a
  377. Static link library for the libjpeg API
  378. sharedlib/libjpeg-{version}.dll
  379. DLL for the libjpeg API
  380. sharedlib/libjpeg.dll.a
  381. Import library for the libjpeg API
  382. libturbojpeg.a
  383. Static link library for the TurboJPEG API
  384. libturbojpeg.dll
  385. DLL for the TurboJPEG API
  386. libturbojpeg.dll.a
  387. Import library for the TurboJPEG API
  388. {version} is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or
  389. v8 emulation is enabled.
  390. Debug Build
  391. -----------
  392. Add "-DCMAKE_BUILD_TYPE=Debug" to the cmake command line. Or, if building with
  393. NMake, remove "-DCMAKE_BUILD_TYPE=Release" (Debug builds are the default with
  394. NMake.)
  395. libjpeg v7 or v8 API/ABI Emulation
  396. -----------------------------------
  397. Add "-DWITH_JPEG7=1" to the cmake command line to build a version of
  398. libjpeg-turbo that is API/ABI-compatible with libjpeg v7. Add "-DWITH_JPEG8=1"
  399. to the cmake command to build a version of libjpeg-turbo that is
  400. API/ABI-compatible with libjpeg v8. See README-turbo.txt for more information
  401. on libjpeg v7 and v8 emulation.
  402. In-Memory Source/Destination Managers
  403. -------------------------------------
  404. When using libjpeg v6b or v7 API/ABI emulation, add -DWITH_MEM_SRCDST=0 to the
  405. CMake command line to build a version of libjpeg-turbo that lacks the
  406. jpeg_mem_src() and jpeg_mem_dest() functions. These functions were not part of
  407. the original libjpeg v6b and v7 APIs, so removing them ensures strict
  408. conformance with those APIs. See README-turbo.txt for more information.
  409. Arithmetic Coding Support
  410. -------------------------
  411. Since the patent on arithmetic coding has expired, this functionality has been
  412. included in this release of libjpeg-turbo. libjpeg-turbo's implementation is
  413. based on the implementation in libjpeg v8, but it works when emulating libjpeg
  414. v7 or v6b as well. The default is to enable both arithmetic encoding and
  415. decoding, but those who have philosophical objections to arithmetic coding can
  416. add "-DWITH_ARITH_ENC=0" or "-DWITH_ARITH_DEC=0" to the cmake command line to
  417. disable encoding or decoding (respectively.)
  418. TurboJPEG Java Wrapper
  419. ----------------------
  420. Add "-DWITH_JAVA=1" to the cmake command line to incorporate an optional Java
  421. Native Interface wrapper into the TurboJPEG shared library and build the Java
  422. front-end classes to support it. This allows the TurboJPEG shared library to
  423. be used directly from Java applications. See java/README for more details.
  424. If you are using CMake 2.8, you can set the Java_JAVAC_EXECUTABLE,
  425. Java_JAVA_EXECUTABLE, and Java_JAR_EXECUTABLE CMake variables to specify
  426. alternate commands or locations for javac, jar, and java (respectively.) If
  427. you are using CMake 2.6, set JAVA_COMPILE, JAVA_RUNTIME, and JAVA_ARCHIVE
  428. instead. You can also set the JAVACFLAGS CMake variable to specify arguments
  429. that should be passed to the Java compiler when building the front-end classes.
  430. ========================
  431. Installing libjpeg-turbo
  432. ========================
  433. You can use the build system to install libjpeg-turbo into a directory of your
  434. choosing (as opposed to creating an installer.) To do this, add:
  435. -DCMAKE_INSTALL_PREFIX={install_directory}
  436. to the cmake command line.
  437. For example,
  438. cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release \
  439. -DCMAKE_INSTALL_PREFIX=c:\libjpeg-turbo {source_directory}
  440. nmake install
  441. will install the header files in c:\libjpeg-turbo\include, the library files
  442. in c:\libjpeg-turbo\lib, the DLL's in c:\libjpeg-turbo\bin, and the
  443. documentation in c:\libjpeg-turbo\doc.
  444. =============
  445. Build Recipes
  446. =============
  447. 64-bit MinGW Build on Cygwin
  448. ----------------------------
  449. cd {build_directory}
  450. CC=/usr/bin/x86_64-w64-mingw32-gcc \
  451. cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
  452. -DCMAKE_AR=/usr/bin/x86_64-w64-mingw32-ar \
  453. -DCMAKE_RANLIB=/usr/bin/x86_64-w64-mingw32-ranlib {source_directory}
  454. make
  455. This produces a 64-bit build of libjpeg-turbo that does not depend on
  456. cygwin1.dll or other Cygwin DLL's. The mingw64-x86_64-gcc-core and
  457. mingw64-x86_64-gcc-g++ packages (and their dependencies) must be installed.
  458. 32-bit MinGW Build on Cygwin
  459. ----------------------------
  460. cd {build_directory}
  461. CC=/usr/bin/i686-w64-mingw32-gcc \
  462. cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
  463. -DDCMAKE_AR=/usr/bin/i686-w64-mingw32-ar \
  464. -DCMAKE_RANLIB=/usr/bin/i686-w64-mingw32-ranlib {source_directory}
  465. make
  466. This produces a 32-bit build of libjpeg-turbo that does not depend on
  467. cygwin1.dll or other Cygwin DLL's. The mingw64-i686-gcc-core and
  468. mingw64-i686-gcc-g++ packages (and their dependencies) must be installed.
  469. MinGW-w64 Build on Windows
  470. --------------------------
  471. This produces a 64-bit build of libjpeg-turbo using the "native" MinGW-w64
  472. toolchain (which is faster than the Cygwin version):
  473. cd {build_directory}
  474. CC={mingw-w64_binary_path}/x86_64-w64-mingw32-gcc \
  475. cmake -G "MSYS Makefiles" \
  476. -DCMAKE_AR={mingw-w64_binary_path}/x86_64-w64-mingw32-ar \
  477. -DCMAKE_RANLIB={mingw-w64_binary_path}/x86_64-w64-mingw32-ranlib \
  478. {source_directory}
  479. make
  480. MinGW Build on Linux
  481. --------------------
  482. cd {build_directory}
  483. CC={mingw_binary_path}/i386-mingw32-gcc \
  484. cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
  485. -DCMAKE_AR={mingw_binary_path}/i386-mingw32-ar \
  486. -DCMAKE_RANLIB={mingw_binary_path}/i386-mingw32-ranlib \
  487. {source_directory}
  488. make
  489. *******************************************************************************
  490. ** Creating Release Packages
  491. *******************************************************************************
  492. The following commands can be used to create various types of release packages:
  493. Unix/Linux
  494. ----------
  495. make rpm
  496. Create Red Hat-style binary RPM package. Requires RPM v4 or later.
  497. make srpm
  498. This runs 'make dist' to create a pristine source tarball, then creates a
  499. Red Hat-style source RPM package from the tarball. Requires RPM v4 or later.
  500. make deb
  501. Create Debian-style binary package. Requires dpkg.
  502. make dmg
  503. Create Macintosh package/disk image. This requires the PackageMaker
  504. application, which must be installed in /Developer/Applications/Utilities.
  505. Note that PackageMaker is not included in recent releases of Xcode, but it
  506. can be obtained by downloading the "Auxiliary Tools for Xcode" package from
  507. http://developer.apple.com/downloads.
  508. make udmg [BUILDDIR32={32-bit build directory}]
  509. On 64-bit OS X systems, this creates a Macintosh package and disk image that
  510. contains universal i386/x86-64 binaries. You should first configure a 32-bit
  511. out-of-tree build of libjpeg-turbo, then configure a 64-bit out-of-tree
  512. build, then run 'make udmg' from the 64-bit build directory. The build
  513. system will look for the 32-bit build under {source_directory}/osxx86 by
  514. default, but you can override this by setting the BUILDDIR32 variable on the
  515. make command line as shown above.
  516. make iosdmg [BUILDDIR32={32-bit build directory}] \
  517. [BUILDDIRARMV6={ARM v6 build directory}] \
  518. [BUILDDIRARMV7={ARM v7 build directory}] \
  519. [BUILDDIRARMV7S={ARM v7s build directory}]
  520. On OS X systems, this creates a Macintosh package and disk image in which the
  521. libjpeg-turbo static libraries contain ARM architectures necessary to build
  522. iOS applications. If building on an x86-64 system, the binaries will also
  523. contain the i386 architecture, as with 'make udmg' above. You should first
  524. configure ARM v6, ARM v7, and/or ARM v7s out-of-tree builds of libjpeg-turbo
  525. (see "Building libjpeg-turbo for iOS" above.) If you are building an x86-64
  526. version of libjpeg-turbo, you should configure a 32-bit out-of-tree build as
  527. well. Next, build libjpeg-turbo as you would normally, using an out-of-tree
  528. build. When it is built, run 'make iosdmg' from the build directory. The
  529. build system will look for the ARM v6 build under {source_directory}/iosarmv6
  530. by default, the ARM v7 build under {source_directory}/iosarmv7 by default,
  531. the ARM v7s build under {source_directory}/iosarmv7s by default, and (if
  532. applicable) the 32-bit build under {source_directory}/osxx86 by default, but
  533. you can override this by setting the BUILDDIR32, BUILDDIRARMV6,
  534. BUILDDIRARMV7, and/or BUILDDIRARMV7S variables on the make command line as
  535. shown above.
  536. make cygwinpkg
  537. Build a Cygwin binary package.
  538. Windows
  539. -------
  540. If using NMake:
  541. cd {build_directory}
  542. nmake installer
  543. If using MinGW:
  544. cd {build_directory}
  545. make installer
  546. If using the Visual Studio IDE, build the "installer" project.
  547. The installer package (libjpeg-turbo[-gcc][64].exe) will be located under
  548. {build_directory}. If building using the Visual Studio IDE, then the installer
  549. package will be located in a subdirectory with the same name as the
  550. configuration you built (such as {build_directory}\Debug\ or
  551. {build_directory}\Release\).
  552. Building a Windows installer requires the Nullsoft Install System
  553. (http://nsis.sourceforge.net/.) makensis.exe should be in your PATH.
  554. *******************************************************************************
  555. ** Regression testing
  556. *******************************************************************************
  557. The most common way to test libjpeg-turbo is by invoking 'make test' on
  558. Unix/Linux platforms or 'ctest' on Windows platforms, once the build has
  559. completed. This runs a series of tests to ensure that mathematical
  560. compatibility has been maintained between libjpeg-turbo and libjpeg v6b. This
  561. also invokes the TurboJPEG unit tests, which ensure that the colorspace
  562. extensions, YUV encoding, decompression scaling, and other features of the
  563. TurboJPEG C and Java APIs are working properly (and, by extension, that the
  564. equivalent features of the underlying libjpeg API are also working.)
  565. Invoking 'make testclean' or 'nmake testclean' (if using NMake) or building
  566. the 'testclean' target (if using the Visual Studio IDE) will clean up the
  567. output images generated by 'make test'.
  568. On Unix/Linux platforms, more extensive tests of the TurboJPEG C and Java
  569. wrappers can be run by invoking 'make tjtest'. These extended TurboJPEG tests
  570. essentially iterate through all of the available features of the TurboJPEG APIs
  571. that are not covered by the TurboJPEG unit tests (this includes the lossless
  572. transform options) and compare the images generated by each feature to images
  573. generated using the equivalent feature in the libjpeg API. The extended
  574. TurboJPEG tests are meant to test for regressions in the TurboJPEG wrappers,
  575. not in the underlying libjpeg API library.