1 Guide to Building HandBrake svn2213 (2009030301) on Linux
2 *********************************************************
11 5 Building via Terminal
19 5.4.4 Contrib Aggregates
26 This guide documents the recommended process to build HandBrake on
27 Linux hosts from the official source-code repository. Building from any
28 other source is not supported.
33 The following are the recommended specifications for building on
34 Linux; but is not necessarily the only configuration that is possible:
36 * Intel 32-bit or 64-bit kernel
38 * Ubuntu 8.0.4, gcc 4.3.0, yasm 0.7.1.2093
40 * Ubuntu 8.10, gcc 4.3.2, yasm 0.7.1.2093
42 * Fedora 9, gcc 4.3.0, yasm 0.7.1.2093
44 * Fedora 10, gcc 4.3.2, yasm 0.7.1.2093
46 * gcc 4.0.0 or higher is reported to work
48 Note: It is recommended to use the platform distribution's bundled
49 compiler for maximum C++ compatibility. If you build with a custom
50 compiler it will likely introduce non-standard runtime
51 requirements. There are of course many valid reasons to build with
52 unbundled compilers, but be aware it is generally unsupported and
53 left as an exercise to the reader.
55 The following general tools are used on various platforms and it is
56 recommended you use these versions or similar:
60 * python - Python 2.4.6
62 * curl - curl 7.19.3 (or wget)
66 * make - GNU Make 3.81
70 * tar - GNU tar 1.15.1
72 * wget - GNU Wget 1.11.4 (or curl)
74 The GTK UI introduces some significant extra build requirements. If you
75 intend to disable building the GUI with `configure --disable-gtk' you
76 will not need many of these packages installed:
91 * libglib2.0-dev (gui)
93 * libdbus-glib-1-dev (gui)
99 * libhal-storage-dev (gui)
101 * libgtkhtml3.14-dev (gui)
103 * libgstreamer0.10-dev (gui)
105 * libgstreamer-plugins-base0.10-dev (gui)
107 To install these packages:
108 sudo apt-get install subversion yasm build-essential \
109 autoconf intltool libtool zlib1g-dev libbz2-dev libglib2.0-dev \
110 libdbus-glib-1-dev libgtk2.0-dev libhal-dev libhal-storage-dev \
111 libgtkhtml3.14-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev
113 Fedora 10 package groups:
116 * Development Libraries
118 * X Software Development (gui)
120 * GNOME Software Development (gui)
122 To install these package groups:
123 sudo yum groupinstall "Development Tools" "Development Libraries" \
124 "X Software Development" "GNOME Software Development"
126 Additional Fedora 10 packages:
131 * dbus-glib-devel (gui)
135 * gtkhtml3-devel (gui)
137 * gstreamer-devel (gui)
139 * gstreamer-plugins-base-devel (gui)
141 To install these packages:
142 sudo yum install yasm zlib-devel bzip2-devel \
143 dbus-glib-devel hal-devel gtkhtml3-devel \
144 gstreamer-devel gstreamer-plugins-base-devel
149 This chapter is for building from a terminal/shell environment in as
150 few commands as possible. If more flexibility is required you should
151 skip this chapter and jump to *Note overview::.
153 svn checkout svn://svn.handbrake.fr/HandBrake/trunk hb-trunk
157 The special option `--launch' selected launch mode and performs the
160 * assert scratch directory `build/' does not exist
162 * create scratch directory `build/'
164 * change to directory `build/'
168 * capture build output to `build/log.txt'
175 Linux builds are performed from a terminal. There is no support for
176 building from any IDEs.
178 5 Building via Terminal
179 ***********************
184 Checkout HandBrake from the official source-code repository.
186 svn checkout svn://svn.handbrake.fr/HandBrake/trunk hb-trunk
189 Sources are checked out from the `trunk' branch. This document was
190 generated from that very branch, and for example purposes, we will use
191 exactly the same branch.
193 If you have write-access to the repository, then you may add the
194 appropriate login/password information as needed. It is recommended to
195 use Subversion 1.5.0 or higher. Lower versions should also work.
200 Configure the build system.
207 Create a scratch directory which will contain all files created during
208 the build process. The directory name is arbitrary but we recommend
209 something simple and descriptive. One directory is required for each
210 distinctly configured build. We name our directory `build' for example
213 The `configure' utility accepts many options. It is recommended that
214 you specify `--help' for the complete list of options. The following
215 options are also documented here:
218 List available options.
221 Specify destination directory for final product install. This
222 defaults to a reasonable platform-specific value.
225 Disable driving the build through Xcode. If this option is
226 disabled only `HandBrakeCLI' will be produced and Xcode will not
227 be invoked. Mac OS X only.
230 Disable building the GTK GUI on applicable platforms such as
234 Select debug mode. Must be one of `none', `min', `std', `max'.
235 This generally maps to gcc options `-g0', `-g1', `-g2', `-g3'.
238 Select optimize mode. Must be one of `none', `speed', `size'.
239 This generally maps to gcc options `-g0', `-O0', `-O3', `-Os'.
242 Select build architecture. The available architectures vary by
243 platform. Most platforms support exactly one architecture except
244 Mac OS X which has support for various universal binary
245 architectures. The available choices are hard-coded per platform
246 and no sanity checks for the required tools are performed.
249 Specify the `gcc' executable to use where EXE is the executable
250 name which is either absolute or environment `PATH' is searched
253 Clean-room procedures dictate that when certain factors change, old
254 builds should be scrapped and new builds configured. This is the main
255 reason for requiring a scratch directory; to promote consistent,
256 reliable and clean software builds. The following is a short list of
257 some of the reasons why someone may choose to scrap an existing build:
259 * configure with different options
261 * subversion working dir is updated and you want configure to
262 re-evaluate working dir metadata.
264 * build corruption is suspected
266 There are generally two methods for scrapping a build. The `build'
267 directory can be recusrively removed which has the effect of loosing
268 your existing configuration but does guarantee no residuals are left
269 behind. The other method is to ask the build system to perform an `make
270 xclean'. This is known to work well but will leave empty directories
271 behind. However, the configuration is left intact.
276 Build main product. All necessary dependencies are also built if
281 Parallel builds may optionally be enabled. Be aware that while a
282 parallel build may save time on systems with additional cores, the
283 output is often mixed, overlapped and sometimes even corrupted with
284 binary characters. Thus if you experience a build issue, you should
285 clean and redo the build in default serial mode to produce a readable
286 log. The following command allows for up to 4 concurrent jobs via make:
293 The build system supports passing many kinds of targets some of which
294 become very useful in normal development cycles. The targets by
295 convention are lower-case words passed to `make'. Global targets are
296 one-word targets. Scoped targets are usually two-words seperated by a
303 Alias for `make build'.
306 Build main product. All necessary dependencies are also built if
310 Clean all build output excluding contrib modules. Configuration is
314 Perform final product(s) install. This will install build
315 products to a standard directory or one specified via `configure
319 Perform final product(s) uninstall. This will uninstall any
320 products which may have been previously installed.
323 Clean all build output including contrib modules. Configuration is
327 Build auto-generated project documentation. Various articles are
328 produced and may be found in `build/doc/articles'.
330 5.4.2 General Modules
331 ---------------------
333 General modules such as `libhb', `test' and `gtk' have the following
340 Clean build output for MODULE.
342 5.4.3 Contrib Modules
343 ---------------------
345 Contrib modules such as `a52dec', `bzip2', `faac', `faad2', `ffmpeg',
346 `lame', `libdca', `libdvdread', `libmkv', `libmp4v2', `libogg',
347 `libsamplerate', `libtheora', `libvorbis', `mpeg2dec', `x264',
348 `xvidcore' and `zlib' have the following scoped targets:
351 Download source tarball from the Internet and save to
352 `TOP/downloads' directory. No checksumming is performed.
354 `make MODULE.extract'
355 Extract source tarball into `build' tree.
358 Apply appropriate patches (if any) to module sources.
360 `make MODULE.configure'
361 Configure module sources. This usually invokes autotool configure.
364 Build module. This usually invokes autotool build.
366 `make MODULE.install'
367 Install module products such as headers and libraries into `build'
368 tree. This usually invokes autotool install.
370 `make MODULE.uninstall'
371 Uninstall module products; generally the reverse of install. This
372 usually invokes autotool uninstall.
375 Clean module; generally the reverse of build. This usually
376 invokes autotool clean.
379 Extra clean module; first invokes uninstall then recursively
380 removes the module build directory.
382 5.4.4 Contrib Aggregates
383 ------------------------
385 For convenience, the following targets aggregate the all contrib
386 modules' respective targets together:
390 * make contrib.extract
394 * make contrib.configure
398 * make contrib.install
400 * make contrib.uninstall
404 * make contrib.xclean
409 If the need arises to override settings in the build system
410 (essentially gnu-make variables) the recommended method is to
411 create/edit the optional include file `build/GNUmakefile.custom' which
412 sits adjacent to the top-level makefile. Do not check this file into
413 the respository. The sole purpose is to allow a place to store local
414 build settings for testing, tweaking, and experimenting with build
415 configuration without losing your settings if `configure' is invoked;
416 ie: `configure' would overwrite `GNUmakefile' and any customizations
417 contained therein would be lost. Here is a short example of what the
418 contents of `build/GNUmakefile.custom' might contain:
420 ## bump to gcc-4.2 in current path
423 ## replace optimize for 'speed' with more agressive settings
424 GCC.args.O.speed = -O3 -fomit-frame-pointer -msse4.2