1# A docker image suitable for cross-compiling Haiku applications 2 3This docker image provides an environment suitable to build Haiku applications 4inside a Linux compiler. It can be used by projects willing to integrate an 5Haiku build inside their CI system, for example. 6 7The docker build of this image prepares the environment by: 8- Building our toolchain 9- Building the haiku hpkg files and downloading dependencies 10- Extracting headers and libraries from the hpkg files to generate a sysroot 11 directory 12- Setting up environment variables for the toolchain to be usable 13 14You can then use the $ARCH-unknown-haiku compiler (for example 15arm-unknown-haiku-gcc) to build your application. All the required files are 16installed in /tools/cross-tools-$ARCH. 17 18## Building the image 19 20The Dockerfile accepts four arguments when building the image: 21 22* `BUILDTOOLS_REV` is the branch/tag of buildtools that should be built. It defaults to `master`. 23* `HAIKU_REV` is the branch/tag of the haiku repository that should be built. It defaults to `master`. 24* `ARCHITECTURE` is the primary architecture to build the tools and library for. It defaults to `x86_64` 25* `SECONDARY_ARCHITECTURE` is the secondary architecture. Leave it empty in case it is not necessary. 26 27For example, the r1beta4 images are build with the following commands: 28 29```bash 30# r1beta4 on x86 hybrid, with gcc2 as the primary architecture, and modern gcc as the secondary 31podman build --build-arg BUILDTOOLS_REV=r1beta4 --build-arg HAIKU_REV=r1beta4 --build-arg ARCHITECTURE=x86_gcc2 --build-arg SECONDARY_ARCHITECTURE=x86 --tag docker.io/haiku/cross-compiler:x86_gcc2h-r1beta4 . 32 33# r1beta4 on x86_64 34podman build --build-arg BUILDTOOLS_REV=r1beta4 --build-arg HAIKU_REV=r1beta4 --build-arg ARCHITECTURE=x86_64 --tag docker.io/haiku/cross-compiler:x86_64-r1beta4 . 35``` 36