The source tree is organized so you can easily find what you look for. If you're already familiar
with Haiku, you will notice that the source directory generally mirrors the way the filesystem in
Haiku is organized.
At the top level, things that need to be "built" in some way are put in the ``src`` directory.
For example, the "data" folder at the root contains files that are used as-is in the disk image,
while "src/data" contain files that need to be compild or converted to different formats, such as
the MIME database.
* src - All files that have to be built
* add-ons - Everything that will be installed to /boot/system/add-ons: kernel drivers, media codecs, translators, …
* apps - GUI applications that are not preferences
* bin - Command-line applications
* build - Files to allow using the Haiku buildtools on non-Haiku platforms
* data - Data files of any type: icons, MIME database, …
* kits - The public C++ API of Haiku: libbe, libmedia, libgame, …
* libs - Static and shared libraries used by Haiku applications
* preferences - The preference applications
* servers - The system servers: app_server, input_server, net_server, …
* system - The low-level system that makes Haiku tick
* boot - The bootloaders for all supported platforms
* glue - The "glue code" that makes shared libraries execute their constructors and destructors, and programs start their execution at ``main()``
* kernel - The kernel and all of its core services
* ldscripts - Linker scripts for building various parts of Haiku
* libnetwork - Files for building libnetwork.so, including the POSIX/BSD socket implementation and some extensions to it, as well as the DNS resolver
* libroot - Files for building libroot.so, including the standard C and POSIX library implementation
* runtime_loader: The special application that knows how to load and run other applications from ELF executable files
* tests - This more or less mirrors the main source tree layout, and contains tests and debugging tools for each component. Some of the tests are run using cppunit, other can be run manually.
* tools - Tools that can be built on non-Haiku platforms. Either needed for compiling Haiku itself, or otherwise useful outside of Haiku
* headers - All shared, private and public headers
* build - Compatibility headers for building Haiku code on non-Haiku systems
* compatibility - Compatbility layers allowing to build BSD and GNU code to run on Haiku
* config - Platform-specific configuration, definition of standard types that can be used in other places
* cpp - The C++ standard library headers (only for gcc2, for later gcc versions this is provided by the gcc package)
* glibc - Headers from glibc, for configuration and definition of some glibc specific functions
* libs - Headers for the libraries found in src/libs
* os - The public headers that define the Haiku API
* posix - The POSIX APIs supported by Haiku
* private - Private headers that are shared between haiku components, including work-in-progress APIs that may become public in the future
* tools - Headers for various tools and utilities
* docs - Documentation
* develop - Internal documentation for developers working on Haiku itself (this is what you are reading now)
* user - `API reference <https://api.haiku-os.org>`
* Some other miscellaneous documentation
* build - Build files
* jam - Jam rules used by the Haiku build, defining how to build an application, a library, a disk image, …
* config_headers - Configurable headers for enabling various debug features
* scripts - Various scripts used by the Haiku build process
* 3rd_party - Developers custom files. Used for various side projects from Haiku developers, useful personal scripts, and integration with other tools and projects such as virtualization software
The buidtools repository uses vendor branches. This concept originates from `the SVN Book <https://svnbook.red-bean.com/en/1.8/svn.advanced.vendorbr.html>`_
but applies just as well to Git. This organization allows to clearly separate the imported code
from upstream, and the changes we have made to it.
The idea is to import all upstream changes in a dedicated branch (there are currently two, called
vendor-gcc and vendor-binutils). These branches contains the sources of gcc and binutils as
distributed by the GNU project, without any Haiku changes.
The master branch can then merge new versions from the vendor branches. This allows to use Git
conflict resolution to make sure our patches are correctly ported from one version to the next.
It also makes it easy to compare the current state of our sourcecode with the upstream code, for
example to extract patches that could be upstreamed.