1 Build Guide for HandBrake svn2252 on Mac OS X
2 *********************************************
11 5 Building via Terminal
19 5.4.4 Contrib Touch and Untouch
20 5.4.5 Contrib Aggregates
22 5.6 Universal Binaries
27 6.4 User-Defined Settings
28 Appendix A Project Repository Details
34 This guide documents the recommended process to build HandBrake on
35 Mac OS X hosts from the official source-code repository. Building from
36 any other source is not supported.
41 Building on Mac OS X is well supported. It is the reference platform
42 for HandBrake. The following are the recommended specifications for
43 this platform; but is not necessarily the only configuration that is
52 * gcc 4.0.1 (Apple Inc. build 5490)
54 * yasm 0.7.2.2153 (for i386 and x86_64 architectures)
56 Note: It is recommended to use the platform distribution's bundled
57 compiler for maximum C++ compatibility. If you build with a custom
58 compiler it will likely introduce non-standard runtime
59 requirements. There are of course many valid reasons to build with
60 unbundled compilers, but be aware it is generally unsupported and
61 left as an exercise to the reader.
63 The following general tools are used on various platforms and it is
64 recommended you use these versions or similar:
68 * python - Python 2.4.6
70 * curl - curl 7.19.3 (or wget)
74 * make - GNU Make 3.81
78 * tar - GNU tar 1.15.1
80 * wget - GNU Wget 1.11.4 (or curl)
85 This chapter is for building from a terminal/shell environment in as
86 few commands as possible. Upon completion of the following commands you
87 should have a fresh build of HandBrake. Further instructions are
88 available beginning with *Note overview:: which describes procedures
89 suitable for repeating builds. This chapter should be skipped by those
90 seeking more than a minimalist build.
92 svn checkout svn://svn.handbrake.fr/HandBrake/trunk hb-trunk
96 The special option `--launch' selects launch mode and performs the
99 * assert scratch directory `build/' does not exist
101 * create scratch directory `build/'
103 * change to directory `build/'
107 * capture build output to `build/log/build.txt'
113 * indicate if build ultimately succeeded or failed
118 The two general methods to build on Mac OS X are building from terminal
119 or Xcode. The preferred method for automated and repeatable builds is
120 to use the terminal. Otherwise the choice is generally up to the
121 individual. In essence, the terminal actually invokes `xcodebuild' to
122 build the very same targets contained in the Xcode project.
124 5 Building via Terminal
125 ***********************
130 Checkout HandBrake from the official source-code repository.
132 svn checkout svn://svn.handbrake.fr/HandBrake/trunk hb-trunk
135 Sources are checked out from the `trunk' branch. This document was
136 generated from that very branch, and for example purposes, we will use
137 exactly the same branch.
139 If you have write-access to the repository, then you may add the
140 appropriate login/password information as needed. It is recommended to
141 use Subversion 1.5.0 or higher. Lower versions should also work.
146 Configure the build system.
150 Configure will automatically create a scratch build directory `build'
151 unless you use GNU-style build procedures and first `cd' to a directory
152 other than top-level source. Additionally you may specify use `--build'
153 to specify the directory. The name of the directory is arbitrary but it
154 is recommended to use something which indicates transient files which
155 are not checked into the repository.
157 The `configure' utility accepts many options. It is recommended that
158 you specify `--help' for the complete list of options. The following
159 options are also documented here:
162 List available options.
165 Specify top-level source directory for HandBrake sources.
168 Specify destination directory for final product install. The
169 default is to use either `build' if in the top-level source
170 directory, otherwise `.'
173 Specify destination directory for final product install. This
174 defaults to a reasonable platform-specific value.
177 All-in-one option which launches the build and logs output
178 automatically. Useful for novices and quickstart procedures.
181 Disable shunting the build through Xcode. If this option is
182 applied, `HandBrakeCLI' will be produced in a similare fashion as
183 it is on other platforms; sans Xcode. Mac OS X only.
186 Disable building the GTK GUI on applicable platforms such as
190 Select debug mode. Must be one of `none', `min', `std', `max'.
191 This generally maps to gcc options `-g0', `-g1', `-g2', `-g3'.
194 Select optimize mode. Must be one of `none', `speed', `size'.
195 This generally maps to gcc options `-g0', `-O0', `-O3', `-Os'.
198 Select build architecture. The available architectures vary by
199 platform. Most platforms support exactly one architecture except
200 Mac OS X which has support for various universal binary
201 architectures. The available choices are hard-coded per platform
202 and no sanity checks for the required tools are performed.
205 Clean-room procedures dictate that when certain factors change, old
206 builds should be scrapped and new builds configured. This is the main
207 reason for requiring a scratch directory; to promote consistent,
208 reliable and clean software builds. The following is a short list of
209 some of the reasons why someone may choose to scrap an existing build:
211 * configure with different options
213 * subversion working dir is updated and you want configure to
214 re-evaluate working dir metadata.
216 * build corruption is suspected
218 There are generally two methods for scrapping a build. The `build'
219 directory can be recusrively removed which has the effect of loosing
220 your existing configuration but does guarantee no residuals are left
221 behind. The other method is to ask the build system to perform an `make
222 xclean'. This is known to work well but will leave empty directories
223 behind. However, the configuration is left intact.
228 Build main product. All necessary dependencies are also built if
233 Parallel builds may optionally be enabled. Be aware that while a
234 parallel build may save time on systems with additional cores, the
235 output is often mixed, overlapped and sometimes even corrupted with
236 binary characters. Thus if you experience a build issue, you should
237 clean and redo the build in default serial mode to produce a readable
238 log. The following command allows for up to 4 concurrent jobs via make:
245 The build system supports passing many kinds of targets some of which
246 become very useful in normal development cycles. The targets by
247 convention are lower-case words passed to `make'. Global targets are
248 one-word targets. Scoped targets are usually two-words seperated by a
255 Alias for `make build'.
258 Build main product. All necessary dependencies are also built if
262 Clean all build output excluding contrib modules. Configuration is
266 Perform final product(s) install. This will install build
267 products to a standard directory or one specified via `configure
271 Perform final product(s) uninstall. This will uninstall any
272 products which may have been previously installed.
275 Clean all build output including contrib modules. Configuration is
279 Build auto-generated project documentation. Various articles are
280 produced and may be found in `build/doc/articles'.
283 Print list of available makefile vars report targets. These
284 reports detail var definitions and expanded values used by the
285 build system. For experts only.
288 Convenience target which aggregates all reports. For experts only.
290 5.4.2 General Modules
291 ---------------------
293 General modules such as `libhb', `test' and `gtk' have the following
300 Clean build output for MODULE.
302 5.4.3 Contrib Modules
303 ---------------------
305 Contrib modules such as `a52dec', `bzip2', `faac', `faad2', `ffmpeg',
306 `lame', `libdca', `libdvdread', `libmkv', `libmp4v2', `libogg',
307 `libsamplerate', `libtheora', `libvorbis', `mpeg2dec', `x264',
308 `xvidcore' and `zlib' have the following scoped targets:
311 Download source tarball from the Internet and save to
312 `TOP/downloads' directory. No checksumming is performed.
314 `make MODULE.extract'
315 Extract source tarball into `build' tree.
318 Apply appropriate patches (if any) to module sources.
320 `make MODULE.configure'
321 Configure module sources. This usually invokes autotool configure.
324 Build module. This usually invokes autotool build.
326 `make MODULE.install'
327 Install module products such as headers and libraries into `build'
328 tree. This usually invokes autotool install.
330 `make MODULE.uninstall'
331 Uninstall module products; generally the reverse of install. This
332 usually invokes autotool uninstall.
335 Clean module; generally the reverse of build. This usually
336 invokes autotool clean.
339 Extra clean module; first invokes uninstall then recursively
340 removes the module build directory.
342 5.4.4 Contrib Touch and Untouch
343 -------------------------------
345 Also available are some very granular targets which help force builds
346 from specific cycle points. The following targets are available to
347 touch and untouch the respective module target; this will force the
348 build system to treat the target as satisfied after a touch or
349 unsatisfied after an untouch:
351 * make MODULE.extract.touch
353 * make MODULE.extract.untouch
355 * make MODULE.patch.touch
357 * make MODULE.patch.untouch
359 * make MODULE.configure.touch
361 * make MODULE.configure.untouch
363 * make MODULE.build.touch
365 * make MODULE.build.untouch
367 * make MODULE.install.touch
369 * make MODULE.install.untouch
371 5.4.5 Contrib Aggregates
372 ------------------------
374 For convenience, the following targets aggregate the all contrib
375 modules' respective targets together:
379 * make contrib.extract
383 * make contrib.configure
387 * make contrib.install
389 * make contrib.uninstall
393 * make contrib.xclean
398 If the need arises to override settings in the build system
399 (essentially gnu-make variables) the recommended method is to create
400 optional include files which are automatically included if present and
401 follow this naming convention; Do not check these files into the
405 Custom makevar definitions outside `build'. Suitable for settings
406 which apply across all builds for a particular checkout; or which
407 survives manual removal of `build'.
410 Custom make rules outside `build'. Suitable for rules which apply
411 across all builds for a particular checkout; or which survives
412 manual removal of `build'.
414 `_BUILD_/GNUmakefile.custom.defs'
415 Custom makevar definitions specific to a `build' directory.
417 `_BUILD_/GNUmakefile.custom.rules'
418 Custom makevar rules specific to a `build' directory.
421 The purpose is to allow a place to store local build settings for
422 testing, tweaking, and experimenting with build configuration without
423 losing your settings if `configure' is invoked; ie: `configure' would
424 overwrite `GNUmakefile' and any customizations contained therein would
425 be lost. Here is a short example of what the contents of
426 `_SRC_/custom.defs' might contain:
428 ## bump to gcc-4.2 in current path
431 ## replace optimize for 'speed' with more agressive settings
432 GCC.args.O.speed = -O3 -fomit-frame-pointer -msse4.2
434 See also `make report.help' which displays a set of reports used to
437 5.6 Universal Binaries
438 ======================
440 This section outlines convenience procedures for creating Universal
441 Binaries for all the architectures.
443 Note: The dummy (container) build configuration uses
444 `--disable-xcode'; but the nested architecture builds will all
445 make full use of Xcode.
447 Create a dummy (container) build configuration and use it to launch a
448 nested-build for each architecture serially; optionally you may
449 substitute `make ub.build.serial' for `make ub.build.parallel' if your
450 machine has the horsepower:
452 ./configure --disable-xcode
457 To specify a subset of architectures to be built first create/edit
458 `_SRC_/custom.defs' with the following override to build UB for `i386'
459 and `x86_64' before invoking `make':
461 ## prefer i386 (order is important)
462 UB.archs = i386 x86_64
470 Checkout HandBrake from the official source-code repository.
472 svn checkout svn://svn.handbrake.fr/HandBrake/trunk hb-trunk
475 Sources are checked out from the `trunk' branch. This document was
476 generated from that very branch, and for example purposes, we will use
477 exactly the same branch.
479 If you have write-access to the repository, then you may add the
480 appropriate login/password information as needed. It is recommended to
481 use Subversion 1.5.0 or higher. Lower versions should also work.
486 In Xcode perform the following steps to build the default configuration:
488 * open `macosx/HandBrake.xcodeproj'
490 * select active configuration standard
492 * select active target HandBrake
494 * click Build or Build and Go
496 The first build (on an empty `build' directory) will take a bit of
497 time. You may use the Build Results window to observe progress. The
498 most time-consuming part of the build is when the external build system
499 (essentially the terminal method) is triggered by Xcode and a
500 substantial amount of log transcript ensues. Much of that transcript
501 are warnings and errors that are part of the normal build process for
502 3rd-party contributed modules so in general you need not do anything.
503 However, if Xcode itself reports the build failed, then you must take
506 Unfortunately, due to limitations of Xcode we do not have hooks in
507 place to offer finer-grained control over per-module make actions for
508 the (external) build system. Thus, you will have to use terminal to
509 accomplish those tasks. Just `cd' into the build directory which is
510 associated with your active configuration and perform any necessary
511 `make' commands. Be careful not to issue commands from the terminal
512 simultaneously with Xcode tasks as that will confuse both Xcode and
513 make and likely corrupt your build directory.
515 When you click clean in Xcode it will not perform an external build
516 clean. Basically HandBrakeCLI and HandBrake.app are the only products
517 which have full Xcode iterative development flexibility.
519 Each configuration uses a different `build' directory. This makes it
520 possible to build each configuration and switch between them without
521 losing their respective build state. The description of each
522 configuration and the name convention for build directories are as
526 This configuration will build host native architecture. Build
527 directory is `build.standard' . The standard variant produces
528 optimized code without debug information.
531 This configuration will build i386 architecture. Build directory
532 is `build.standard.i386' .
535 This configuration will build x86_64 architecture. Build directory
536 is `build.standard.x86_64' .
539 This configuration will build ppc architecture. Build directory is
540 `build.standard.ppc' .
543 This configuration will build ppc64 architecture. Build directory
544 is `build.standard.ppc64' .
547 This configuration will build host native architecture. Build
548 directory is `build.debug' . The debug variant produces
549 unoptimized code with debug information.
552 This configuration will build i386 architecture. Build directory
553 is `build.debug.i386' . The debug variant produces unoptimized
554 code with debug information.
557 This configuration will build x86_64 architecture. Build directory
558 is `build.debug.x86_64' . The debug variant produces unoptimized
559 code with debug information.
562 This configuration will build ppc architecture. Build directory is
563 `build.debug.ppc' . The debug variant produces unoptimized code
564 with debug information.
567 This configuration will build ppc64 architecture. Build directory
568 is `build.debug.ppc64' . The debug variant produces unoptimized
569 code with debug information.
574 The following external targets appear in the Xcode project and perform
575 build and clean actions.
578 Target maps to `make build' and `make clean' for everything Xcode
579 products depend upon from the external build system.
582 Target maps to `make libhb.build' and `make libhb.clean'.
585 Target maps to `make contrib.build' and `make contrib.xclean'.
588 6.4 User-Defined Settings
589 =========================
591 The following user defined settings are used in Xcode project for the
592 external build system:
595 Specifies the build (scratch) directory for each configuration.
598 Specifies the concurrency factor for the external build system
599 when builds are launched from within Xcode. Modify for faster
600 external builds if your system has the horsepower and resources.
601 Specifying a value greater than the number of CPU cores (or
602 virtual cores) in your system is unlikely to produce gains and
603 will needlessly consume extra resources.
606 Do not modify; Used for internal/external build coordination and
607 must always be `xcode'.
610 Specifies the top-level source directory for HandBrake.
613 Appendix A Project Repository Details
614 *************************************
616 url: svn://svn.handbrake.fr/HandBrake/trunk
617 root: svn://svn.handbrake.fr/HandBrake
619 uuid: b64f7644-9d1e-0410-96f1-a4d463321fa5
621 date: 2009-03-10 18:43:11 -0400