1 Build Guide for HandBrake svn2322 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
23 6 Building via Xcode.app
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 from terminal or
119 Xcode.app. The preferred method for automated and repeatable builds is
120 to use the terminal. Otherwise the choice is generally up to the
121 individual. To be extra clear, building from the terminal by default
122 actually invokes `xcodebuild' to build the very same targets contained
123 in the Xcode project. Think of it as building with Xcode but without
126 5 Building via Terminal
127 ***********************
132 Checkout HandBrake from the official source-code repository.
134 svn checkout svn://svn.handbrake.fr/HandBrake/trunk hb-trunk
137 Sources are checked out from the `trunk' branch. This document was
138 generated from that very branch, and for example purposes, we will use
139 exactly the same branch.
141 If you have write-access to the repository, then you may add the
142 appropriate login/password information as needed. It is recommended to
143 use Subversion 1.5.0 or higher. Lower versions should also work.
148 Configure the build system.
152 Configure will automatically create a scratch build directory `build'
153 unless you use GNU-style build procedures and first `cd' to a directory
154 other than top-level source. Additionally you may use `--build' to
155 specify the directory. The name of the directory is arbitrary but it is
156 recommended to use something which indicates transient files which are
157 not checked into the repository.
159 The `configure' utility accepts many options. It is recommended that
160 you specify `--help' for the complete list of options. The following
161 options are also documented here:
164 List available options.
167 Specify top-level source directory for HandBrake sources.
170 Specify destination directory for final product install. The
171 default is to use either `build' if in the top-level source
172 directory, otherwise `.'
175 Specify destination directory for final product install. This
176 defaults to a reasonable platform-specific value.
179 All-in-one option which launches the build and logs output
180 automatically. Useful for novices and quick-start procedures.
183 Disable shunting the build through `xcodebuild'. If this option is
184 applied, `HandBrakeCLI' will be produced in a similar fashion as
185 it is on other platforms; sans Xcode and the Cocoa application
186 will not be produced. Mac OS X only.
189 Disable building the GTK GUI on applicable platforms such as
193 Select debug mode. Must be one of `none', `min', `std', `max'.
194 This generally maps to gcc options `-g0', `-g1', `-g2', `-g3'.
197 Select optimize mode. Must be one of `none', `speed', `size'.
198 This generally maps to gcc options `-g0', `-O0', `-O3', `-Os'.
201 Select build architecture. The available architectures vary by
202 platform. Most platforms support exactly one architecture except
203 Mac OS X which has support for various universal binary
204 architectures. The available choices are hard-coded per platform
205 and no sanity checks for the required tools are performed.
208 Clean-room procedures dictate that when certain factors change, old
209 builds should be scrapped and new builds configured. This is the main
210 reason for requiring a scratch directory; to promote consistent,
211 reliable and clean software builds. The following is a short list of
212 some of the reasons why someone may choose to scrap an existing build:
214 * configure with different options
216 * subversion working dir is updated and you want configure to
217 re-evaluate working dir metadata.
219 * build corruption is suspected
221 There are generally two methods for scrapping a build. The `build'
222 directory can be recursively removed which has the effect of loosing
223 your existing configuration but does guarantee no residuals are left
224 behind. The other method is to ask the build system to perform an `make
225 xclean'. This is known to work well but will leave empty directories
226 behind. However, the configuration is left intact.
231 Build main product. All necessary dependencies are also built if
236 Parallel builds may optionally be enabled. Be aware that while a
237 parallel build may save time on systems with additional cores, the
238 output is often mixed, overlapped and sometimes even corrupted with
239 binary characters. Thus if you experience a build issue, you should
240 clean and redo the build in default serial mode to produce a readable
241 log. The following command allows for up to 4 concurrent jobs via make:
248 The build system supports passing many kinds of targets some of which
249 become very useful in normal development cycles. The targets by
250 convention are lower-case words passed to `make'. Global targets are
251 one-word targets. Scoped targets are usually two-words separated by a
258 Alias for `make build'.
261 Build main product. All necessary dependencies are also built if
265 Clean all build output excluding contrib modules. Configuration is
269 Perform final product(s) install. This will install build
270 products to a standard directory or one specified via `configure
274 Perform final product(s) uninstall. This will uninstall any
275 products which may have been previously installed.
278 Clean all build output including contrib modules. Configuration is
282 Build auto-generated project documentation. Various articles are
283 produced and may be found in `build/doc/articles'.
286 Print list of available makefile vars report targets. These
287 reports detail var definitions and expanded values used by the
288 build system. For experts only.
291 Convenience target which aggregates all reports. For experts only.
293 5.4.2 General Modules
294 ---------------------
296 General modules such as `libhb', `test' and `gtk' have the following
303 Clean build output for MODULE.
305 5.4.3 Contrib Modules
306 ---------------------
308 Contrib modules such as `a52dec', `bzip2', `faac', `faad2', `ffmpeg',
309 `lame', `libdca', `libdvdread', `libmkv', `libmp4v2', `libogg',
310 `libsamplerate', `libtheora', `libvorbis', `mpeg2dec', `x264',
311 `xvidcore' and `zlib' have the following scoped targets:
314 Download source tarball from the Internet and save to
315 `TOP/downloads' directory. No check-summing is performed.
317 `make MODULE.extract'
318 Extract source tarball into `build' tree.
321 Apply appropriate patches (if any) to module sources.
323 `make MODULE.configure'
324 Configure module sources. This usually invokes autotool configure.
327 Build module. This usually invokes autotool build.
329 `make MODULE.install'
330 Install module products such as headers and libraries into `build'
331 tree. This usually invokes autotool install.
333 `make MODULE.uninstall'
334 Uninstall module products; generally the reverse of install. This
335 usually invokes autotool uninstall.
338 Clean module; generally the reverse of build. This usually
339 invokes autotool clean.
342 Extra clean module; first invokes uninstall then recursively
343 removes the module build directory.
345 5.4.4 Contrib Touch and Untouch
346 -------------------------------
348 Also available are some very granular targets which help force builds
349 from specific cycle points. The following targets are available to
350 touch and untouch the respective module target; this will force the
351 build system to treat the target as satisfied after a touch or
352 unsatisfied after an untouch:
354 * make MODULE.extract.touch
356 * make MODULE.extract.untouch
358 * make MODULE.patch.touch
360 * make MODULE.patch.untouch
362 * make MODULE.configure.touch
364 * make MODULE.configure.untouch
366 * make MODULE.build.touch
368 * make MODULE.build.untouch
370 * make MODULE.install.touch
372 * make MODULE.install.untouch
374 5.4.5 Contrib Aggregates
375 ------------------------
377 For convenience, the following targets aggregate the all contrib
378 modules' respective targets together:
382 * make contrib.extract
386 * make contrib.configure
390 * make contrib.install
392 * make contrib.uninstall
396 * make contrib.xclean
401 If the need arises to override settings in the build system
402 (essentially gnu-make variables) the recommended method is to create
403 optional include files which are automatically included if present and
404 follow this naming convention; Do not check these files into the
408 Custom makevar definitions outside `build'. Suitable for settings
409 which apply across all builds for a particular checkout; or which
410 survives manual removal of `build'.
413 Custom make rules outside `build'. Suitable for rules which apply
414 across all builds for a particular checkout; or which survives
415 manual removal of `build'.
417 `_BUILD_/GNUmakefile.custom.defs'
418 Custom makevar definitions specific to a `build' directory.
420 `_BUILD_/GNUmakefile.custom.rules'
421 Custom makevar rules specific to a `build' directory.
424 The purpose is to allow a place to store local build settings for
425 testing, tweaking, and experimenting with build configuration without
426 losing your settings if `configure' is invoked; ie: `configure' would
427 overwrite `GNUmakefile' and any customizations contained therein would
428 be lost. Here is a short example of what the contents of
429 `_SRC_/custom.defs' might contain:
431 ## bump to gcc-4.2 in current path
434 ## replace optimize for 'speed' with more aggressive settings
435 GCC.args.O.speed = -O3 -fomit-frame-pointer -msse4.2
437 See also `make report.help' which displays a set of reports used to
440 5.6 Universal Binaries
441 ======================
443 This section outlines convenience procedures for creating Universal
444 Binaries for all the architectures.
446 Note: The dummy (container) build configuration uses
447 `--disable-xcode'; but the nested architecture builds will all
448 make full use of Xcode.
450 Create a dummy (container) build configuration and use it to launch a
451 nested-build for each architecture serially; optionally you may
452 substitute `make ub.build.serial' for `make ub.build.parallel' if your
453 machine has the horsepower:
455 ./configure --disable-xcode
460 To specify a subset of architectures to be built first create/edit
461 `_SRC_/custom.defs' with the following override to build UB for `i386'
462 and `x86_64' before invoking `make':
464 ## prefer i386 (order is important)
465 UB.archs = i386 x86_64
467 6 Building via Xcode.app
468 ************************
473 Checkout HandBrake from the official source-code repository.
475 svn checkout svn://svn.handbrake.fr/HandBrake/trunk hb-trunk
478 Sources are checked out from the `trunk' branch. This document was
479 generated from that very branch, and for example purposes, we will use
480 exactly the same branch.
482 If you have write-access to the repository, then you may add the
483 appropriate login/password information as needed. It is recommended to
484 use Subversion 1.5.0 or higher. Lower versions should also work.
489 Open Xcode.app from a terminal by using the `open' command which passes
490 your shell environment and its `PATH' setting to Xcode. Do not attempt
491 to launch Xcode.app from Finder or by using Finder to open
492 `HandBrake.xcodeproj' - doing so will defeat any custom path settings
493 which contain required tools.
495 open `macosx/HandBrake.xcodeproj'
497 Once the HandBrake Xcode project is open, perform the following steps
498 to build the default configuration:
500 * select active configuration standard
502 * select active target HandBrake
504 * click Build or Build and Go
506 The first build (on an empty `build' directory) will take a bit of
507 time. You may use the Build Results window to observe progress. The
508 most time-consuming part of the build is when the external build system
509 (essentially the terminal method) is triggered by Xcode and a
510 substantial amount of log transcript ensues. Much of that transcript
511 are warnings and errors that are part of the normal build process for
512 3rd-party contributed modules so in general you need not do anything.
513 However, if Xcode itself reports the build failed, then you must take
516 Unfortunately, due to limitations of Xcode we do not have hooks in
517 place to offer finer-grained control over per-module make actions for
518 the (external) build system. Thus, you will have to use terminal to
519 accomplish those tasks. Just `cd' into the build directory which is
520 associated with your active configuration and perform any necessary
521 `make' commands. Be careful not to issue commands from the terminal
522 simultaneously with Xcode tasks as that will confuse both Xcode and
523 make and likely corrupt your build directory.
525 When you click clean in Xcode it will not perform an external build
526 clean. Basically HandBrakeCLI and HandBrake.app are the only products
527 which have full Xcode iterative development flexibility.
529 Each configuration uses a different `build' directory. This makes it
530 possible to build each configuration and switch between them without
531 losing their respective build state. The description of each
532 configuration and the name convention for build directories are as
536 This configuration will build host native architecture. Build
537 directory is `build.standard' . The standard variant produces
538 optimized code without debug information.
541 This configuration will build i386 architecture. Build directory
542 is `build.standard.i386' .
545 This configuration will build x86_64 architecture. Build directory
546 is `build.standard.x86_64' .
549 This configuration will build ppc architecture. Build directory is
550 `build.standard.ppc' .
553 This configuration will build ppc64 architecture. Build directory
554 is `build.standard.ppc64' .
557 This configuration will build host native architecture. Build
558 directory is `build.debug' . The debug variant produces
559 unoptimized code with debug information.
562 This configuration will build i386 architecture. Build directory
563 is `build.debug.i386' . The debug variant produces unoptimized
564 code with debug information.
567 This configuration will build x86_64 architecture. Build directory
568 is `build.debug.x86_64' . The debug variant produces unoptimized
569 code with debug information.
572 This configuration will build ppc architecture. Build directory is
573 `build.debug.ppc' . The debug variant produces unoptimized code
574 with debug information.
577 This configuration will build ppc64 architecture. Build directory
578 is `build.debug.ppc64' . The debug variant produces unoptimized
579 code with debug information.
584 The following external targets appear in the Xcode project and perform
585 build and clean actions.
588 Target maps to `make build' and `make clean' for everything Xcode
589 products depend upon from the external build system.
592 Target maps to `make libhb.build' and `make libhb.clean'.
595 Target maps to `make contrib.build' and `make contrib.xclean'.
598 6.4 User-Defined Settings
599 =========================
601 The following user defined settings are used in Xcode project for the
602 external build system:
605 Specifies the build (scratch) directory for each configuration.
608 Specifies the concurrency factor for the external build system
609 when builds are launched from within Xcode. Modify for faster
610 external builds if your system has the horsepower and resources.
611 Specifying a value greater than the number of CPU cores (or
612 virtual cores) in your system is unlikely to produce gains and
613 will needlessly consume extra resources.
616 Do not modify; Used for internal/external build coordination and
617 must always be `xcode'.
620 Specifies the top-level source directory for HandBrake.
623 Appendix A Project Repository Details
624 *************************************
626 url: svn://svn.handbrake.fr/HandBrake/trunk
627 root: svn://svn.handbrake.fr/HandBrake
629 uuid: b64f7644-9d1e-0410-96f1-a4d463321fa5
631 date: 2009-04-13 13:28:21 -0400