Created HowToBuildFPR (markdown)

Cameron Kaiser 2017-05-30 21:18:23 -07:00
parent 85c8f2126d
commit c103292530

68
HowToBuildFPR.md Normal file

@ -0,0 +1,68 @@
This document covers how to build TenFourFox from [the TenFourFox Github repository](https://github.com/classilla/tenfourfox). It does not cover any other version.
## Warning
These build instructions are always subject to change. You should be familiar with [how Mozilla offers its source code and how to build Mozilla applications](https://developer.mozilla.org/en/Developer_Guide) before you attempt these steps.
## Prerequisites
* At minimum you will need a G4 or G5 (G5 recommended), 10.4.11, Xcode 2.5, 1.5GB of RAM and 10GB disk space. The build should work on a G3, but has not been tested on it. Just for your interest, TenFourFox is built on a quad G5 with 16GB of RAM, because compilers like RAM. In this configuration, with Energy Saver set to Highest Performance, it takes approximately three hours to kick out a single architecture build, and about a half hour longer for a debugging build. Plan accordingly.
* The currently supported compiler is `gcc` 4.8.x (4.8.2 or higher), from MacPorts (see below); building with 4.6 as used in TenFourFox 38 is no longer possible. However, although Apple `gcc` 4.0.1 and `gcc` 4.2 are no longer supported, you must still install Xcode for certain other prerequisites.
* Later versions of `gcc` have been used in limited situations, and may work, but are not yet supported.
* Building on 10.5.8 and/or with Xcode 3 should work, but linking against the 10.5 SDK is not supported. Note that the browser can still be _built_ on 10.5.8, and will still _run_ on 10.5.8, but the only allowed target will be a _10.4_-compatible browser.
* If your compiler is compiled for 10.5, the browser will use the 10.4 SDK, but wind up linked against your 10.5-only `libgcc`, `libatomic` and `libstdc++`. If you intend to use your build on a 10.4 system, you will need to replace them with 10.4-compatible libraries. The easiest source is a TenFourFox binary package; see below (under Distributing the executable). If this is not acceptable, it is also possible, though involved, to make a cross-building `gcc`; see [issue 52](/classilla/tenfourfox/issues/52).
* `clang` is not supported. However, it may be possible to do a cross-build on 10.6.8 using a cross-compiling version of `gcc`. Good luck, let us know if it works. We are not aware of any presently working way to get later versions of OS X to build TenFourFox, but [this script may help](https://github.com/devernay/xcodelegacy). If you get any of this working, post an issue with how you did it!
* Install MacPorts, using the Tiger `dmg` for 10.4 or the Leopard `dmg` for 10.5. Note that MacPorts does not always have the most current release up to date for 10.4 or 10.5, but you can still get whatever the most recently updated historical version was from [the MacPorts download repository](https://distfiles.macports.org/MacPorts/) -- you need only grab the most recent 10.4 or 10.5 version available, because we will immediately force it to self-update in the next step (read on).
* We need to install not only Git, a new Python and a new `gcc`, but we'll also need Mozilla's preferred `autoconf` and a newer GNU `make` to get around various bugs in Tiger's included version. Get a cup of coffee, because MacPorts likes to install everything else as a prereq for everything else.
sudo port -v selfupdate
sudo port install git libidl autoconf213 gmake python27 gcc48 freetype
* MacPorts' `gcc48` package also includes updated bintools, including its own copy of the Xcode 3 linker with a bug fix to enable TenFourFox's XUL to link correctly. The old ported Xcode 3 `ld` used to build TenFourFox 17 and earlier is no longer needed.
* Stripped builds require special handling due to an apparent compiler bug, using a modified `strip` binary (renamed `strip7` so it does not conflict with the regular `strip`) that ignores the variant `N_SECT`s this compiler can generate. You should not use this strip tool for other purposes, as it is intentionally loose with the specification, and you do not need to install it if you are only building a debug or non-stripped build for your own use. Decompress the binary and put it in `/opt/local/bin/strip7` (the configure script is hardcoded to this location). You can get it from [SourceForge](https://sourceforge.net/projects/tenfourfox/files/tools/).
* Finally, you must install the TenFourFox debugger, because the `gdb` available with any PowerPC Xcode does not properly grok debugging symbols generated by later `gcc` versions. At least patchlevel 2 is required for the current version of 10.4Fx. Decompress and copy the binary to `/usr/local/bin/gdb7` or wherever it is convenient. Although you can use it to replace your current `gdb`, it's probably safer that you do not. You can also get it from [SourceForge](https://sourceforge.net/projects/tenfourfox/files/tools/).
## Building the browser
1. In your nice fat source drive, `git clone https://github.com/classilla/tenfourfox` (or [the desired release](https://github.com/classilla/tenfourfox/releases) or revision).
1. Select your desired configuration (any of the `*.mozcfg` files) and copy it to `.mozconfig` in the root of the repo. These configurations should be self-explanatory. For the gory details, see [Configuring Build Options](https://developer.mozilla.org/en/configuring_build_options) at MDN, but in general, you should avoid changing the standard build configurations unless you know exactly what you are doing. Use the `mozconfig`s that came with this most current revision if at all possible, because the options are periodically upgraded and changed as the build system gets modified, and old configurations may fail inexplicably.
* **G4 and G5 owners:** if you want to test the AltiVec (VMX) code paths apart from the standard `mozcfg` files, you should include `--enable-tenfourfox-vmx` in your custom `.mozconfig` or it will be compiled without AltiVec/VMX acceleration.
* **G5 owners _ONLY_:** if you want to test the G5-specific code paths apart from the standard `G5.mozcfg`, you should include `--enable-tenfourfox-g5` in your custom `.mozconfig` or the regular code paths will be used instead of the G5-specific ones. This does not enable VMX; if you want that, specify it too. You may also need to add `-D_PPC970_` to your compiler strings so that non-Mozilla libraries and JavaScript properly select the correct architecture optimizations. Although you don't need this, the browser will run substantially more poorly if you don't.
* **Intel owners _ONLY_: Intel builds for TenFourFox 45 do not work.** You can fix this! Good luck; submit patches if you get it operational.
1. (Optional but recommended) Edit `netwerk/protocols/http/OptimizedFor.h` and set the string to something human-readable about the configuration you're building for. This string should be relatively short, and will appear after the `TenFourFox/` in the user agent string.
* **Warning:** if you don't do something like `git update-index --skip-worktree netwerk/protocols/http/OptimizedFor.h`, this change will end up in any pull requests you issue and _we won't accept them_!
1. (Optional) If you want to change the reported version numbers, alter `browser/config/version.txt` for the reported browser version, `browser/config/version_display.txt` for the _displayed_ browser version (this is where we usually put the long FPR string), and `config/milestone.txt` for the reported Gecko version.
* We don't allow these changes in pull requests either! Consider setting `skip-worktree` on these files also if you change them!
1. Once you're ready, if you are cleaning out an old build, be sure to `rm -rf configure obj-ff-dbg/` first. Then,
autoconf213
gmake -f client.mk build
## Known build issues
* Until [issue 202](/classilla/tenfourfox/issues/202) is fixed, you will get spurious errors setting up the Python environment. You can ignore these for now.
* You will receive warnings about `N_SECT` while linking XUL. These are harmless. If you actually get an error and it doesn't build, then somehow you are using the original `strip`. Check your binaries carefully.
## Running and debugging
If the build worked, try out your binary in the TenFourFox debugger. We will assume you installed it to `/usr/local/bin/gdb7` or somewhere else otherwise suitable in your path:
`cd obj-ff-dbg/dist/TenFourFox.app/Contents/MacOS` (or, if in Debug mode, `TenFourFoxDebug.app`)
`gdb7 firefox`
At the `(gdb)` prompt, `run`
If the build appeared to work, but the browser crashes in an unusual `objc` symbol when you try to run it or quit, you may have encountered [issue 169](/classilla/tenfourfox/issues/169) which is due to incorrect linker code generation. Make sure you are using the correct `ld` (see the prerequisites section).
If you receive strange `Die` errors in the debugger and backtraces don't work properly, you need to upgrade your debugger (or you're using the one that Apple provided, which won't work anymore).
## Distributing the executable
Because the new compiler links against its own `libgcc`, `libatomic` and `libstdc++`, if you intend to make a build to generally distribute or use on another computer, you will need to include these libraries and update the linkage to point to the included copies. The tool `104fx_copy.sh` (in the root) will help you with this. Make it executable with `chmod +x` if necessary, then simply type `./104fx_copy.sh [destination name.app]` and the built binary will be copied to the destination name (which should be the new app bundle filename) and its linkages updated to be internal. *This should be the last step you do before release since the binary it generates is completely standalone and disconnected from the build system.*
If you built on 10.5 with a compiler that was also built on 10.5, your built browser will only work on 10.5 (despite using the 10.4 SDK) because the `gcc` 4.8 `libgcc`, `libatomic` and `libstdc++` are linked against the 10.5 SDK, not 10.4. The easiest way to solve this problem is to replace `libgcc_s.1.dylib`, `libatomic.1.dylib` and `libstdc++.6.dylib` in your browser package with the ones from a "real" TenFourFox application package and then your build will "just work" on both operating systems. If this is not acceptable, it is possible, though involved, to build a cross-compiling 10.5 `gcc` that will create 10.4-compatible binaries; see [issue 52](/classilla/tenfourfox/issues/52).
## Keeping up
Your repo is now a fully functional clone of the TenFourFox source repository, and you can simply `git pull` to get new changes (merging them with your local changes as appropriate).