2015-06-19 21:17:14 +02:00
|
|
|
Building Haiku
|
|
|
|
==========================
|
|
|
|
This is a overview into the process of building HAIKU from source.
|
2017-12-05 22:58:11 +01:00
|
|
|
An online version is available at <https://www.haiku-os.org/guides/building/>.
|
2015-06-19 21:17:14 +02:00
|
|
|
|
2017-12-05 22:58:11 +01:00
|
|
|
Official releases of Haiku are at <https://www.haiku-os.org/get-haiku>.
|
2015-06-19 21:17:14 +02:00
|
|
|
The (unstable) nightly builds are available at <https://download.haiku-os.org/>.
|
|
|
|
|
|
|
|
We currently support the following platforms:
|
|
|
|
* Haiku
|
|
|
|
* Linux
|
|
|
|
* FreeBSD
|
2017-12-05 22:58:11 +01:00
|
|
|
* macOS
|
2015-06-19 21:17:14 +02:00
|
|
|
|
|
|
|
Required Software
|
|
|
|
----------------------------
|
|
|
|
Tools provided within Haiku's repositories:
|
|
|
|
* `jam` (Jam 2.5-haiku-20111222)
|
2019-01-09 01:32:34 +01:00
|
|
|
* Haiku's cross-compiler
|
2015-06-19 21:17:14 +02:00
|
|
|
|
|
|
|
The tools to compile Haiku will vary, depending on the platform that you are
|
|
|
|
using to build Haiku. When building from Haiku, all of the necessary
|
2019-01-09 01:32:34 +01:00
|
|
|
development tools are included in official releases (e.g. R1/beta1) and in the
|
2015-06-19 21:17:14 +02:00
|
|
|
nightly builds.
|
|
|
|
|
|
|
|
* `git`
|
|
|
|
* `gcc`/`g++` and binutils (`as`, `ld`, etc., required by GCC)
|
|
|
|
* (GNU) `make`
|
2015-06-22 16:51:09 +02:00
|
|
|
* `bison` (2.4 or better)
|
2015-06-19 21:17:14 +02:00
|
|
|
* `flex` and `lex` (usually a mini shell script invoking `flex`)
|
|
|
|
* `makeinfo` (part of `texinfo`, only needed for building GCC 4)
|
|
|
|
* `autoheader` (part of `autoconf`, needed for building GCC)
|
2017-12-05 22:58:11 +01:00
|
|
|
* `automake` (needed for building GCC)
|
2021-04-17 21:41:55 +02:00
|
|
|
* `awk` (GNU awk is most tested, but other implementations should work)
|
2015-06-19 21:17:14 +02:00
|
|
|
* `nasm`
|
|
|
|
* `wget`
|
|
|
|
* `[un]zip`
|
2019-01-09 01:32:34 +01:00
|
|
|
* `xorriso`
|
|
|
|
* `mtools` (<https://gnu.org/software/mtools/intro.html>)
|
2023-11-18 14:58:01 +01:00
|
|
|
* `python3`
|
2015-06-19 21:17:14 +02:00
|
|
|
* case-sensitive file system
|
|
|
|
|
|
|
|
Whether they are installed can be tested by running them in a shell with
|
|
|
|
the `--version` parameter.
|
|
|
|
|
|
|
|
The following libraries (and their respective headers) are required:
|
|
|
|
* `zlib`
|
2023-11-18 14:58:01 +01:00
|
|
|
* `zstd`
|
2015-06-19 21:17:14 +02:00
|
|
|
|
|
|
|
### Haiku for ARM
|
|
|
|
If you want to compile Haiku for ARM, you will also need:
|
|
|
|
|
|
|
|
* `mkimage` (<http://www.denx.de/wiki/U-Boot/WebHome>)
|
|
|
|
|
2017-12-05 22:58:11 +01:00
|
|
|
### On macOS
|
2015-06-19 21:17:14 +02:00
|
|
|
|
|
|
|
Disk Utility can create a case-sensitive disk image of at least 3 GiB in size.
|
|
|
|
The following ports need to be installed:
|
|
|
|
* `expat`
|
|
|
|
* `gawk`
|
|
|
|
* `gettext`
|
|
|
|
* `libiconv`
|
|
|
|
* `gsed`
|
|
|
|
* `cdrtools`
|
|
|
|
* `nasm`
|
|
|
|
* `wget`
|
|
|
|
* `less`
|
|
|
|
* `mpfr`
|
|
|
|
* `gmp`
|
|
|
|
* `libmpc`
|
2015-12-22 17:46:39 +01:00
|
|
|
* `bison` (updated to the latest version)
|
2015-06-19 21:17:14 +02:00
|
|
|
|
|
|
|
More information about individual distributions of Linux and BSD can be found
|
|
|
|
at <https://haiku-os.org/guides/building/pre-reqs>.
|
|
|
|
|
|
|
|
Downloading Haiku's sources
|
|
|
|
--------------------------------------------------
|
|
|
|
There are two parts to Haiku's sources — the code for Haiku itself and a set
|
|
|
|
of build tools for compiling Haiku on an operating system other than Haiku.
|
|
|
|
The buildtools are needed only for non-Haiku platforms.
|
|
|
|
|
|
|
|
Anonymous checkout:
|
|
|
|
```
|
2019-01-09 01:32:34 +01:00
|
|
|
git clone https://review.haiku-os.org/haiku.git
|
|
|
|
git clone https://review.haiku-os.org/buildtools.git
|
2015-06-19 21:17:14 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
If you have commit access:
|
|
|
|
```
|
|
|
|
git clone ssh://git.haiku-os.org/haiku
|
|
|
|
git clone ssh://git.haiku-os.org/buildtools
|
|
|
|
```
|
|
|
|
|
|
|
|
Building Jam
|
|
|
|
-------------------------------------------
|
2020-02-03 13:37:34 +01:00
|
|
|
(*This step applies only to non-Haiku platforms. Haiku already ships with the correct version of Jam*)
|
2015-06-19 21:17:14 +02:00
|
|
|
|
|
|
|
Change to the `buildtools` folder and run the following commands to
|
|
|
|
generate and install `jam`:
|
|
|
|
```
|
|
|
|
cd buildtools/jam
|
|
|
|
make
|
|
|
|
sudo ./jam0 install
|
|
|
|
```
|
|
|
|
Or, if you don't want to install `jam` systemwide:
|
|
|
|
```
|
|
|
|
./jam0 -sBINDIR=$HOME/bin install
|
|
|
|
```
|
|
|
|
|
|
|
|
Configuring the build
|
|
|
|
-------------------------------------
|
|
|
|
The `configure` script generates a file named `BuildConfig` in the
|
|
|
|
`generated/build` directory. As long as `configure` is not modified (!) and the
|
|
|
|
cross-compilation tools have not been updated, there is no need to call it again.
|
|
|
|
For rebuilding, you only need to invoke `jam` (see below). If you don't
|
|
|
|
update the source tree very frequently, you may want to execute `configure`
|
|
|
|
after each update just to be on the safe side.
|
|
|
|
|
|
|
|
Depending on your goal, there are several different ways to configure Haiku.
|
2017-12-05 22:58:11 +01:00
|
|
|
The first way is to call configure from within your Haiku checkout's root. That
|
|
|
|
will prepare a folder named 'generated', which will contain the compiled objects.
|
2015-06-19 21:17:14 +02:00
|
|
|
Another option is to manually created one or more `generated.*` folders and run
|
|
|
|
configure from within them. For example, imagine the following directory setup:
|
|
|
|
```
|
2017-12-05 22:58:11 +01:00
|
|
|
buildtools/
|
|
|
|
haiku/
|
|
|
|
haiku/generated.x86gcc2
|
2015-06-19 21:17:14 +02:00
|
|
|
```
|
|
|
|
|
2020-02-03 13:37:34 +01:00
|
|
|
### Configure an x86_64 (GCC 8) build
|
|
|
|
```bash
|
|
|
|
cd haiku/generated.x86_64
|
2020-12-10 20:39:05 +01:00
|
|
|
../configure --cross-tools-source ../../buildtools --build-cross-tools x86_64
|
2020-02-03 13:37:34 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
### Configure a 32-bit GCC 2.95/GCC 8 Hybrid, from a non-Haiku platform
|
2015-06-19 21:17:14 +02:00
|
|
|
```bash
|
2017-12-05 22:58:11 +01:00
|
|
|
cd haiku/generated.x86gcc2
|
|
|
|
../configure \
|
2020-12-10 20:39:05 +01:00
|
|
|
--cross-tools-source ../../buildtools/ \
|
2021-11-29 07:39:04 +01:00
|
|
|
--build-cross-tools x86_gcc2 \
|
2015-06-19 21:17:14 +02:00
|
|
|
--build-cross-tools x86
|
|
|
|
```
|
|
|
|
|
2020-02-03 13:37:34 +01:00
|
|
|
### Configure a 32-bit GCC 2.95/GCC 8 Hybrid, from Haiku
|
|
|
|
```bash
|
2017-12-05 22:58:11 +01:00
|
|
|
cd haiku/generated.x86gcc2
|
2015-06-19 21:17:14 +02:00
|
|
|
../configure --target-arch x86_gcc2 --target-arch x86
|
|
|
|
```
|
|
|
|
|
|
|
|
Additional information about GCC Hybrids can be found on the website,
|
2017-12-05 22:58:11 +01:00
|
|
|
<https://www.haiku-os.org/guides/building/gcc-hybrid>.
|
2015-06-19 21:17:14 +02:00
|
|
|
|
|
|
|
### Configure options
|
|
|
|
The various runtime options for configure are documented in its onscreen help
|
|
|
|
```bash
|
|
|
|
./configure --help
|
|
|
|
```
|
|
|
|
|
|
|
|
Building via Jam
|
|
|
|
----------------------------
|
|
|
|
|
|
|
|
Haiku can be built in either of two ways, as disk image file (e.g. for use
|
|
|
|
with emulators, to be written directly to a usb stick, burned as a compact
|
|
|
|
disc) or as installation in a directory.
|
|
|
|
|
|
|
|
### Running Jam
|
|
|
|
|
|
|
|
There are various ways in which you can run `jam`:
|
|
|
|
|
|
|
|
* If you have a single generated folder, you can run 'jam' from the top level of Haiku's trunk.
|
|
|
|
* If you have one or more generated folders, (e.g. generated.x86gcc2),
|
|
|
|
you can `cd` into that directory and run `jam`.
|
|
|
|
* In either case, you can `cd` into a certain folder in the source tree (e.g.
|
|
|
|
src/apps/debugger) and run jam -sHAIKU_OUTPUT_DIR=<path to generated folder>
|
|
|
|
|
|
|
|
Be sure to read `build/jam/UserBuildConfig.ReadMe` and `UserBuildConfig.sample`,
|
|
|
|
as they contain information on customizing your build of Haiku.
|
|
|
|
|
2023-01-15 12:17:05 +01:00
|
|
|
### Building a Haiku anyboot image (Nightly)
|
2015-06-19 21:17:14 +02:00
|
|
|
```
|
2023-01-15 12:17:05 +01:00
|
|
|
jam -q @nightly-anyboot
|
2015-06-19 21:17:14 +02:00
|
|
|
```
|
|
|
|
|
2023-01-15 12:17:05 +01:00
|
|
|
This generates an image file named `haiku-nightly-anyboot.iso` in your output
|
2015-06-19 21:17:14 +02:00
|
|
|
directory under `generated/`.
|
|
|
|
|
2023-01-15 12:17:05 +01:00
|
|
|
### Building a Haiku raw image (Nightly)
|
|
|
|
```
|
|
|
|
jam -q @nightly-raw
|
|
|
|
```
|
|
|
|
|
|
|
|
This generates an image file named `haiku.image` in your output directory under
|
|
|
|
`generated/`.
|
|
|
|
|
2015-06-19 21:17:14 +02:00
|
|
|
### Building a VMware image file
|
|
|
|
```
|
2023-01-15 12:17:05 +01:00
|
|
|
jam -q @nightly-vmware
|
2015-06-19 21:17:14 +02:00
|
|
|
```
|
2023-01-15 12:17:05 +01:00
|
|
|
|
2015-06-19 21:17:14 +02:00
|
|
|
This generates an image file named `haiku.vmdk` in your output
|
|
|
|
directory under `generated/`.
|
|
|
|
|
|
|
|
### Directory Installation
|
|
|
|
```
|
|
|
|
HAIKU_INSTALL_DIR=/Haiku jam -q @install
|
|
|
|
```
|
|
|
|
|
|
|
|
Installs all Haiku components into the volume mounted at "/Haiku" and
|
|
|
|
automatically marks it as bootable. To create a partition in the first place
|
|
|
|
use DriveSetup and initialize it to BFS.
|
|
|
|
|
|
|
|
Note that installing Haiku in a directory only works as expected under Haiku,
|
|
|
|
but it is not yet supported under Linux and other non-Haiku platforms.
|
|
|
|
|
|
|
|
### Building individual components
|
|
|
|
If you don't want to build the complete Haiku, but only a certain
|
|
|
|
app/driver/etc. you can specify it as argument to jam, e.g.:
|
|
|
|
```
|
|
|
|
jam -q Debugger
|
|
|
|
```
|
|
|
|
Alternatively, you can `cd` to the directory of the component you want to
|
|
|
|
build and run `jam` from there. **NOTE:** if your generated directory is named
|
|
|
|
something other than `generated/`, you will need to tell `jam` where it is:
|
|
|
|
```
|
|
|
|
jam -q -sHAIKU_OUTPUT_DIR=<path to generated folder>
|
|
|
|
```
|
|
|
|
You can also force the rebuild of a component by using the `-a` parameter:
|
|
|
|
```
|
|
|
|
jam -qa Debugger
|
|
|
|
```
|
|
|
|
|
2018-03-01 04:47:34 +01:00
|
|
|
Bootstrap Build
|
|
|
|
----------------
|
|
|
|
New architectures (and occasionally existing ones) will require a bootstrap
|
|
|
|
build to compile *build packages*. (Catch-22 software packages which are needed
|
|
|
|
to compile Haiku, but need to be initially compiled under Haiku)
|
|
|
|
|
|
|
|
### Pre-requirements
|
|
|
|
* All of the standard tools in the Required Software section above.
|
|
|
|
* The following repositories on disk in the same general location
|
|
|
|
* haiku (https://git.haiku-os.org/haiku)
|
|
|
|
* buildtools (https://git.haiku-os.org/buildtools)
|
|
|
|
* haikuporter (https://github.com/haikuports/haikuporter.git)
|
|
|
|
* haikuports.cross (https://github.com/haikuports/haikuports.cross.git)
|
|
|
|
* haikuports (https://github.com/haikuports/haikuports.git)
|
|
|
|
|
|
|
|
### Setting Up a Bootstrap build
|
|
|
|
Create a clean build directory under the haiku repo.
|
|
|
|
```
|
|
|
|
mkdir generated.myarch && cd generated.myarch
|
|
|
|
```
|
|
|
|
|
|
|
|
Configure Haiku's build system for a bootstrap build specifying the location
|
|
|
|
of all of the repositories above.
|
|
|
|
```
|
|
|
|
../configure -j4 \
|
2021-11-29 07:39:04 +01:00
|
|
|
--build-cross-tools myarch --cross-tools-source ../../buildtools \
|
2018-03-01 04:47:34 +01:00
|
|
|
--bootstrap ../../haikuporter/haikuporter ../../haikuports.cross ../../haikuports
|
|
|
|
```
|
|
|
|
|
|
|
|
Once the build system is configured for bootstrap, we now can begin building
|
|
|
|
the bootstrap image.
|
|
|
|
|
|
|
|
```
|
|
|
|
jam -q @bootstrap-raw
|
|
|
|
```
|
|
|
|
|
|
|
|
If you are bootstrapping for an architecture Haiku already boots on, the generated
|
|
|
|
disk image can be used to compile *build packages* needed for the standard
|
|
|
|
Haiku build.
|
|
|
|
|
|
|
|
If you are bootstrapping for a new architecture which doesn't build yet, you will
|
|
|
|
need to leverage the ```unbootstrap.sh``` script to hack the generated bootstrap
|
|
|
|
packages into non-bootstrap packages which can be temporarily used as
|
|
|
|
*build packages*.
|
|
|
|
|
2015-06-19 21:17:14 +02:00
|
|
|
Running
|
|
|
|
----------------
|
|
|
|
Generally there are two ways of running Haiku: on real hardware using a
|
|
|
|
partition, and on emulated hardware using an emulator (like VirtualBox, or QEMU).
|
|
|
|
|
|
|
|
### On Real Hardware
|
|
|
|
If you have installed Haiku to its own partition you can include this
|
|
|
|
partition in your bootmanager and try to boot Haiku like any other OS you
|
|
|
|
have installed. To include a new partition in the Haiku bootmanager, start
|
|
|
|
the BootManager configurator by running:
|
|
|
|
```
|
|
|
|
BootManager
|
|
|
|
```
|
|
|
|
|
|
|
|
### On Emulated Hardware
|
2017-12-05 22:58:11 +01:00
|
|
|
For emulated hardware you should build a disk image (see above). How to set up
|
2015-06-19 21:17:14 +02:00
|
|
|
this image depends on your emulator. If you use QEMU, you can usually just
|
|
|
|
provide the path to the image as command line argument to the `qemu`
|
|
|
|
executable.
|