1# HaikuPorter
2
3The HaikuPorter tool is provided to ease the fetching, patching and building of source code. It can be compared to a slim version of [Gentoo Portage](https://www.gentoo.org/main/en/about.xml). Each port contains the [Haiku](http://haiku-os.org) specific patches to the original source code. It fetches the original source code, applies the Haiku-specific patches, builds the software, and packages it.
4
5Detailed information available on the [wiki](https://github.com/haikuports/haikuports/wiki/).
6
7## Quick start
8
9### Single Machine (Haiku)
10
11A single machine installation is for building individual packages.
12
13## Installation (Haiku)
14
15HaikuPorts installation can be done via the following command sequence:
16
17```shell
18 $ git clone https://github.com/haikuports/haikuporter.git
19 $ git clone https://github.com/haikuports/haikuports.git --depth=10
20 $ cd haikuporter
21 $ cp haikuports-sample.conf /boot/home/config/settings/haikuports.conf # Copy the config file
22 $ lpe ~/config/settings/haikuports.conf # and edit it
23```
24
25### Build port
26 - `./haikuporter mesa -j4`
27
28### Build port and all outdated dependency ports
29 - `./haikuporter mesa --all-dependencies -j4`
30
31## Multi-node cluster (Linux + Haiku)
32
33A multi-node cluster is for mass building large numbers of packages.
34
35### Running buildmaster in a container with docker
36
37 - `docker pull ghcr.io/haikuports/haikuporter/buildmaster`
38 - `mkdir ~/buildmaster.x86`
39 - `docker run -v ~/buildmaster.x86:/data -it -e ARCH=x86 ghcr.io/haikuports/haikuporter/buildmaster`
40 - Provision builders
41   - `createbuilder -n test01 -H 127.0.0.1`
42   - copy generated public key to builder
43   - `builderctl health`
44 - exit
45 - Copy the packages from a nightly to ports/packages on the buildmaster
46 - `docker run -v ~/buildmaster.x86:/data -it -e ARCH=x86 ghcr.io/haikuports/haikuporter/buildmaster`
47 - buildmaster everything
48
49buildmaster.x86 will persist between build runs. Feel free to exit, update, or
50erase the container without losing your work.
51
52### Manually Deploy buildmaster (Linux)
53
54 - Install requirements
55   - `pip install paramiko` or `dnf install python-paramiko`
56   - buildtools dependencies: autoconf, flex, bison, texinfo, zlib-devel
57   - Haiku host tools dependencies: libstdc++-static, libcurl-devel
58 - Bootstrap the buildmaster instance
59   - `git clone https://github.com/haikuports/haikuporter.git`
60   - `./haikuporter/buildmaster/bin/bootstrap_buildmaster.sh ...`
61 - Configure your builders within instance ports tree with createbuilder
62   - `cd buildmaster_<arch>/haikuports`
63   - example: `../haikuporter/buildmaster/bin/createbuilder -n mybuilder01 -H 127.0.0.1`
64 - Validate and provision your builders
65   - `../haikuporter/buildmaster/bin/builderctl health`
66   - `../haikuporter/buildmaster/bin/builderctl provision`
67 - `../haikuporter/buildmaster/bin/buildmaster everything`
68
69### Deploy buildslave (Haiku)
70
71 - Checkout Haikuporter and Haikuports, matching the paths specified in createbuilder on buildmaster side
72 - Add the public key from the buildmaster to authorized\_keys
73 - useradd sshd ; ssh-keygen -A
74 - Enable PermitRootLogin in /system/settings/ssh/sshd\_config and make sure the path to the sftp server is correct
75 - install xz\_utils\_x86, lzip\_x86 (required for extracting packages), patch, dos2unix (required for PATCH() function in some packages)
76