aboutsummaryrefslogtreecommitdiff
path: root/BUILDING.txt
blob: 9611766746e02d839fa68ebd06bb5f223b0dae29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
*******************************************************************************
**     Building on Unix Platforms, Cygwin, and MinGW
*******************************************************************************

==================
Build Requirements
==================

-- autoconf 2.56 or later
   * If using MinGW, this can be obtained by installing the MSYS DTK

-- automake 1.7 or later
   * If using MinGW, this can be obtained by installing the MSYS DTK

-- libtool 1.4 or later
   * If using MinGW, this can be obtained by installing the MSYS DTK

-- NASM
   * 0.98 or later is required for a 32-bit build
   * NASM 2.05 or later is required for a 64-bit build
   * NASM 2.07 or later is required for a 64-bit build on OS/X (10.6 "Snow
     Leopard" or later.)  This can be obtained from MacPorts
     (http://www.macports.org/).

   The NASM 2.05 RPMs do not work on older Linux systems, such as Enterprise
   Linux 4.  On such systems, you can easily build and install NASM 2.05
   from the source RPM by executing the following as root:

     ARCH=`uname -m`
     wget http://www.nasm.us/pub/nasm/releasebuilds/2.05.01/nasm-2.05.01-1.src.rpm
     rpmbuild --rebuild nasm-2.05.01-1.src.rpm
     rpm -Uvh /usr/src/redhat/RPMS/$ARCH/nasm-2.05.01-1.$ARCH.rpm

   NOTE: NASM build will fail if texinfo is not installed.

-- GCC v4.1 or later recommended for best performance

======================
Building libjpeg-turbo
======================

The following procedure will build libjpeg-turbo on Linux, 32-bit OS X, and
Solaris/x86 systems (on Solaris, this generates a 32-bit library.  See below
for 64-bit build instructions.)

  cd libjpeg-turbo
  autoreconf -fiv
  sh ./configure
  make

NOTE: Running autoreconf is only necessary if building libjpeg-turbo from the
SVN repository.

This will generate the following files under .libs/

  libjpeg.a
      Static link library for libjpeg-turbo

  libjpeg.so.62.0.0 (Linux, Solaris)
  libjpeg.62.dylib (OS X)
  libjpeg-62.dll (MinGW)
  cygjpeg-62.dll (Cygwin)
      Shared library for libjpeg-turbo

  libjpeg.so (Linux, Solaris)
  libjpeg.dylib (OS X)
  libjpeg.dll.a (Cygwin, MinGW)
      Development stub for libjpeg-turbo shared library

  libturbojpeg.a
      Static link library for TurboJPEG/OSS

  libturbojpeg.so (Linux, Solaris)
  libturbojpeg.dylib (OS X)
      Shared library and development stub for TurboJPEG/OSS

  libturbojpeg.dll (MinGW)
  cygturbojpeg.dll (Cygwin)
      Shared library for TurboJPEG/OSS

  libturbojpeg.dll.a (Cygwin, MinGW)
      Development stub for TurboJPEG/OSS shared library

========================
Installing libjpeg-turbo
========================

If you intend to install these libraries and the associated header files, then
replace 'make' in the instructions above with

  make install prefix={base dir} libdir={library directory}

For example,

  make install prefix=/usr/local libdir=/usr/local/lib64

will install the header files in /usr/local/include and the library files in
/usr/local/lib64.  If 'prefix' and 'libdir' are not specified, then the default
is to install the header files in /opt/libjpeg-turbo/include and the library
files in /opt/libjpeg-turbo/lib.

NOTE: You can specify a prefix of /usr and a libdir of, for instance,
/usr/lib64 to overwrite the system's version of libjpeg.  If you do this,
however, then be sure to BACK UP YOUR SYSTEM'S INSTALLATION OF LIBJPEG before
overwriting it.  It is recommended that you instead install libjpeg-turbo into
a non-system directory and manipulate the LD_LIBRARY_PATH or create sym links
to force applications to use libjpeg-turbo instead of libjpeg.  See
README-turbo.txt for more information.

=============
Build Recipes
=============

32-bit Library Build on 64-bit Linux
------------------------------------

Add

  --host i686-pc-linux-gnu CFLAGS='-O3 -m32' CXXFLAGS='-O3 -m32'

to the configure command line.


64-bit Library Build on 64-bit OS/X
-----------------------------------

Add

  --host x86_64-apple-darwin10.0.0 NASM=/opt/local/bin/nasm

to the configure command line.  NASM 2.07 from MacPorts must be installed.


32-bit Library Build on 64-bit OS/X
-----------------------------------

Add

  CFLAGS='-O3 -m32' CXXFLAGS='-O3 -m32' LDFLAGS=-m32

to the configure command line.


32-bit Backward-Compatible Library Build on 64-bit OS/X
-------------------------------------------------------

Add

  CFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
    -mmacosx-version-min=10.4 -O3 -m32' \
    CXXFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
    -mmacosx-version-min=10.4 -O3 -m32' \
    LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
    -mmacosx-version-min=10.4 -m32'

to the configure command line.  The OS X 10.4 SDK must be installed.


64-bit Library Build on 64-bit Solaris
--------------------------------------

Add

  --host x86_64-pc-solaris CFLAGS='-O3 -m64' CXXFLAGS='-O3 -m64' LDFLAGS=-m64

to the configure command line.


MinGW Build on Cygwin
---------------------

Add

  --host mingw32

to the configure command line.  This will produce libraries which do not
depend on cygwin1.dll or other Cygwin DLL's.


Sun Studio
----------

Add

  CC=cc CXX=CC

to the configure command line.  libjpeg-turbo will automatically be built with
the maximum optimization level (-xO5) unless you override CFLAGS and CXXFLAGS.

To build a 64-bit version of libjpeg-turbo using Sun Studio, add

  --host x86_64-pc-solaris CC=cc CXX=CC CFLAGS='-xO5 -m64' \
    CXXFLAGS='-xO5 -m64' LDFLAGS=-m64

to the configure command line.


*******************************************************************************
**     Building on Windows (Visual C++)
*******************************************************************************

==================
Build Requirements
==================

-- GNU Make v3.7 or later
   * Can be found in MSYS (http://www.mingw.org/download.shtml) or
     Cygwin (http://www.cygwin.com/)

-- Windows SDK for Windows Server 2008 and .NET Framework 3.5 (or a later
   version)

   http://msdn.microsoft.com/en-us/windows/dd146047.aspx

   * The Windows SDK includes both 32-bit and 64-bit Visual C++ compilers and
     everything necessary to build libjpeg-turbo.  If you do not already have
     Visual C++ installed, then this is the recommended solution.  Also tested
     with Microsoft Visual C++ 2008 Express Edition (both are free downloads.)
   * Add the compiler and SDK binary directories (for instance,
     c:\Program Files\Microsoft Visual Studio 9.0\VC\BIN;
     c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE;
     c:\Program Files\Microsoft SDKs\Windows\v6.1\bin)
     to the system or user PATH environment variable prior to building
     libjpeg-turbo.
   * Add the compiler and SDK include directories (for instance,
     c:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE;
     c:\Program Files\Microsoft SDKs\Windows\v6.1\include)
     to the system or user INCLUDE environment variable prior to building
     libjpeg-turbo.
   * Add the compiler library directory (for instance,
     c:\Program Files\Microsoft Visual Studio 9.0\VC\LIB;
     c:\Program Files\Microsoft SDKs\Windows\v6.1\lib)
     to the system or user LIB environment variable prior to building
     libjpeg-turbo.

-- NASM (http://www.nasm.us/) 0.98 or later

======================
Building libjpeg-turbo
======================

  cd libjpeg-turbo
  make -f win/Makefile

This will generate the following files under libjpeg-turbo\windows\:

  jpeg-static.lib        Static link library for libjpeg-turbo
  jpeg62.dll             Shared library for libjpeg-turbo
  jpeg.lib               Development stub for libjpeg-turbo shared library
  turbojpeg-static.lib   Static link library for TurboJPEG/OSS
  turbojpeg.dll          Shared library for TurboJPEG/OSS
  turbojpeg.lib          Development stub for TurboJPEG/OSS shared library

#If a 64-bit Windows platform is detected, then the build system will attempt
#to build a 64-bit version of libjpeg-turbo.  You can override this by running
#
#  make -f win/Makefile WIN64=no

NOTE:  For unknown reasons, Win64 support doesn't work yet, so at the moment,
you have to run 'make -f win/Makefile WIN64=yes' to get a 64-bit build on
64-bit Windows.  The paragraph above will apply once Win64 support is working.


*******************************************************************************
**     Creating Release Packages
*******************************************************************************

The following commands can be used to create various types of release packages:

make rpm

  Create RedHat-style binary RPM package.  Requires RPM v4 or later.

make srpm

  This runs 'make dist' to create a pristine source tarball, then creates a
  RedHat-style source RPM package from the tarball.  Requires RPM v4 or later.

make deb

  Create Debian-style binary package.  Requires dpkg.

make dmg

  Create Macintosh package/disk image.  This requires the PackageMaker
  application, which must be installed in /Developer/Applications/Utilities.

make udmg

  On 64-bit OS X (10.6 "Snow Leopard" or later), this creates a version of the
  Macintosh package/disk image which contains universal i386/x86-64 binaries.
  The 32-bit fork of these binaries is backward compatible with OS X 10.4 and
  later, whereas the 64-bit fork is compatible with OS X 10.6 and later.  OS X
  10.4 compatibility SDK required.

make -f win/Makefile dist

  This creates a Win32 installer for the libjpeg-turbo SDK.  This requires the
  Nullsoft Install System (http://nsis.sourceforge.net/.)  makensis.exe should
  be in your PATH.