1abc159e3SPulkoMandyHaiku Git Repositories 2abc159e3SPulkoMandy====================== 3abc159e3SPulkoMandy 4abc159e3SPulkoMandyHaiku uses Git for source control, combined with Gerrit for review of code changes. 5abc159e3SPulkoMandy 69d51367fSAdrien DestuguesMost of the operating system sources are stored in a single repository at http://cgit.haiku-os.org/haiku . 7abc159e3SPulkoMandy 89d51367fSAdrien DestuguesAnother repository at http://cgit.haiku-os.org/buildtools contains the build tools, that is, gcc, 99d51367fSAdrien Destuguesbinutils, and Jam, which are maintained by Haiku developers. 109d51367fSAdrien Destugues 119d51367fSAdrien Destugues`Additional repositories <https://github.com/orgs/haiku/repositories>`_ are hosed on GitHub. 129d51367fSAdrien Destugues 139d51367fSAdrien DestuguesFinally, some pre-compiled packages are downloaded during the build, these are built using 149d51367fSAdrien DestuguesHaikuporter from `recipes available here <https://github.com/orgs/haikuports/repositories>`_. 159d51367fSAdrien Destugues 169d51367fSAdrien DestuguesGetting the sourcecode 179d51367fSAdrien Destugues---------------------- 189d51367fSAdrien Destugues 199d51367fSAdrien Destugues * https://www.haiku-os.org/guides/building/get-source-git 209d51367fSAdrien Destugues 219d51367fSAdrien DestuguesSending change reviews 229d51367fSAdrien Destugues---------------------- 239d51367fSAdrien Destugues 249d51367fSAdrien Destugues * https://dev.haiku-os.org/wiki/CodingGuidelines/SubmittingPatches 259d51367fSAdrien Destugues * https://review.haiku-os.org/Documentation/user-upload.html 26abc159e3SPulkoMandy 27*e92b4d3aSPulkoMandySource tree organization 28*e92b4d3aSPulkoMandy------------------------ 29*e92b4d3aSPulkoMandy 30*e92b4d3aSPulkoMandyThe source tree is organized so you can easily find what you look for. If you're already familiar 31*e92b4d3aSPulkoMandywith Haiku, you will notice that the source directory generally mirrors the way the filesystem in 32*e92b4d3aSPulkoMandyHaiku is organized. 33*e92b4d3aSPulkoMandy 34*e92b4d3aSPulkoMandyAt the top level, things that need to be "built" in some way are put in the ``src`` directory. 35*e92b4d3aSPulkoMandyFor example, the "data" folder at the root contains files that are used as-is in the disk image, 36*e92b4d3aSPulkoMandywhile "src/data" contain files that need to be compild or converted to different formats, such as 37*e92b4d3aSPulkoMandythe MIME database. 38*e92b4d3aSPulkoMandy 39*e92b4d3aSPulkoMandy* src - All files that have to be built 40*e92b4d3aSPulkoMandy 41*e92b4d3aSPulkoMandy * add-ons - Everything that will be installed to /boot/system/add-ons: kernel drivers, media codecs, translators, … 42*e92b4d3aSPulkoMandy * apps - GUI applications that are not preferences 43*e92b4d3aSPulkoMandy * bin - Command-line applications 44*e92b4d3aSPulkoMandy * build - Files to allow using the Haiku buildtools on non-Haiku platforms 45*e92b4d3aSPulkoMandy * data - Data files of any type: icons, MIME database, … 46*e92b4d3aSPulkoMandy * kits - The public C++ API of Haiku: libbe, libmedia, libgame, … 47*e92b4d3aSPulkoMandy * libs - Static and shared libraries used by Haiku applications 48*e92b4d3aSPulkoMandy * preferences - The preference applications 49*e92b4d3aSPulkoMandy * servers - The system servers: app_server, input_server, net_server, … 50*e92b4d3aSPulkoMandy * system - The low-level system that makes Haiku tick 51*e92b4d3aSPulkoMandy 52*e92b4d3aSPulkoMandy * boot - The bootloaders for all supported platforms 53*e92b4d3aSPulkoMandy * glue - The "glue code" that makes shared libraries execute their constructors and destructors, and programs start their execution at ``main()`` 54*e92b4d3aSPulkoMandy * kernel - The kernel and all of its core services 55*e92b4d3aSPulkoMandy * ldscripts - Linker scripts for building various parts of Haiku 56*e92b4d3aSPulkoMandy * libnetwork - Files for building libnetwork.so, including the POSIX/BSD socket implementation and some extensions to it, as well as the DNS resolver 57*e92b4d3aSPulkoMandy * libroot - Files for building libroot.so, including the standard C and POSIX library implementation 58*e92b4d3aSPulkoMandy * runtime_loader: The special application that knows how to load and run other applications from ELF executable files 59*e92b4d3aSPulkoMandy 60*e92b4d3aSPulkoMandy * 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. 61*e92b4d3aSPulkoMandy * tools - Tools that can be built on non-Haiku platforms. Either needed for compiling Haiku itself, or otherwise useful outside of Haiku 62*e92b4d3aSPulkoMandy 63*e92b4d3aSPulkoMandy* headers - All shared, private and public headers 64*e92b4d3aSPulkoMandy 65*e92b4d3aSPulkoMandy * build - Compatibility headers for building Haiku code on non-Haiku systems 66*e92b4d3aSPulkoMandy * compatibility - Compatbility layers allowing to build BSD and GNU code to run on Haiku 67*e92b4d3aSPulkoMandy * config - Platform-specific configuration, definition of standard types that can be used in other places 68*e92b4d3aSPulkoMandy * cpp - The C++ standard library headers (only for gcc2, for later gcc versions this is provided by the gcc package) 69*e92b4d3aSPulkoMandy * glibc - Headers from glibc, for configuration and definition of some glibc specific functions 70*e92b4d3aSPulkoMandy * libs - Headers for the libraries found in src/libs 71*e92b4d3aSPulkoMandy * os - The public headers that define the Haiku API 72*e92b4d3aSPulkoMandy * posix - The POSIX APIs supported by Haiku 73*e92b4d3aSPulkoMandy * private - Private headers that are shared between haiku components, including work-in-progress APIs that may become public in the future 74*e92b4d3aSPulkoMandy * tools - Headers for various tools and utilities 75*e92b4d3aSPulkoMandy 76*e92b4d3aSPulkoMandy* docs - Documentation 77*e92b4d3aSPulkoMandy 78*e92b4d3aSPulkoMandy * develop - Internal documentation for developers working on Haiku itself (this is what you are reading now) 79*e92b4d3aSPulkoMandy * user - `API reference <https://api.haiku-os.org>` 80*e92b4d3aSPulkoMandy * Some other miscellaneous documentation 81*e92b4d3aSPulkoMandy 82*e92b4d3aSPulkoMandy* build - Build files 83*e92b4d3aSPulkoMandy 84*e92b4d3aSPulkoMandy * jam - Jam rules used by the Haiku build, defining how to build an application, a library, a disk image, … 85*e92b4d3aSPulkoMandy * config_headers - Configurable headers for enabling various debug features 86*e92b4d3aSPulkoMandy * scripts - Various scripts used by the Haiku build process 87*e92b4d3aSPulkoMandy 88*e92b4d3aSPulkoMandy* 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 89*e92b4d3aSPulkoMandy 90abc159e3SPulkoMandyManaging GCC and binutils updates using vendor branches 91abc159e3SPulkoMandy------------------------------------------------------- 92abc159e3SPulkoMandy 93abc159e3SPulkoMandyThe buidtools repository uses vendor branches. This concept originates from `the SVN Book <https://svnbook.red-bean.com/en/1.8/svn.advanced.vendorbr.html>`_ 94abc159e3SPulkoMandybut applies just as well to Git. This organization allows to clearly separate the imported code 95abc159e3SPulkoMandyfrom upstream, and the changes we have made to it. 96abc159e3SPulkoMandy 97abc159e3SPulkoMandyThe idea is to import all upstream changes in a dedicated branch (there are currently two, called 98abc159e3SPulkoMandyvendor-gcc and vendor-binutils). These branches contains the sources of gcc and binutils as 99abc159e3SPulkoMandydistributed by the GNU project, without any Haiku changes. 100abc159e3SPulkoMandy 101abc159e3SPulkoMandyThe master branch can then merge new versions from the vendor branches. This allows to use Git 102abc159e3SPulkoMandyconflict resolution to make sure our patches are correctly ported from one version to the next. 103abc159e3SPulkoMandy 104abc159e3SPulkoMandyIt also makes it easy to compare the current state of our sourcecode with the upstream code, for 105abc159e3SPulkoMandyexample to extract patches that could be upstreamed. 106abc159e3SPulkoMandy 107d2edfdd1SNiels Sascha ReedijkHow to import upstream binutils changes 108d2edfdd1SNiels Sascha Reedijk....................................... 109abc159e3SPulkoMandy 110abc159e3SPulkoMandyHere is an example of the process used to update to a new version of binutils: 111abc159e3SPulkoMandy 112abc159e3SPulkoMandy.. code-block:: bash 113abc159e3SPulkoMandy 114abc159e3SPulkoMandy git checkout vendor-binutils # Move to the branch containing binutils 115abc159e3SPulkoMandy git rm -rf binutils ; rm -rf binutils # Delete the existing version of binutils 116abc159e3SPulkoMandy wget http://.../binutils-2.36.tar.xz # Download the latest version 117abc159e3SPulkoMandy tar xf binutils-2.36.tar.xz # Extract the new binutils version 118abc159e3SPulkoMandy mv binutils-2.36 binutils # Move the extracted files to the right place 119abc159e3SPulkoMandy git add -f binutils # Add the new files to git 120abc159e3SPulkoMandy git commit -m "import binutils 2.36" # Commit the files in the vendor branch 121abc159e3SPulkoMandy git push origin vendor-binutils # You can push this directly to the branch 122abc159e3SPulkoMandy 123abc159e3SPulkoMandyNow this can easily be merged into the master branch: 124abc159e3SPulkoMandy 125abc159e3SPulkoMandy.. code-block:: bash 126abc159e3SPulkoMandy 127abc159e3SPulkoMandy git checkout master 128abc159e3SPulkoMandy git merge vendor-binutils 129abc159e3SPulkoMandy 130abc159e3SPulkoMandyReview and fix the conflicts, if any, then push the changes for review on Gerrit. 131abc159e3SPulkoMandy 132d2edfdd1SNiels Sascha ReedijkHow to import upstream gcc changes 133d2edfdd1SNiels Sascha Reedijk.................................. 134d2edfdd1SNiels Sascha Reedijk 135d2edfdd1SNiels Sascha ReedijkHere is an example of the process used to update to a new version of binutils: 136d2edfdd1SNiels Sascha Reedijk 137d2edfdd1SNiels Sascha Reedijk.. code-block:: bash 138d2edfdd1SNiels Sascha Reedijk 139d2edfdd1SNiels Sascha Reedijk git checkout vendor-gcc # Move to the branch containing binutils 140d2edfdd1SNiels Sascha Reedijk git rm -rf gcc ; rm -rf gcc # Delete the existing version of binutils 141d2edfdd1SNiels Sascha Reedijk wget http://.../gcc-13.2.0.tar.xz # Download the latest version 142d2edfdd1SNiels Sascha Reedijk tar xf gcc-13.2.0.tar.xz # Extract the new binutils version 143d2edfdd1SNiels Sascha Reedijk mv gcc-13.2.0 gcc # Move the extracted files to the right place 144d2edfdd1SNiels Sascha Reedijk pushd gcc 145d2edfdd1SNiels Sascha Reedijk ./contrib/download_prerequisites # Download the required gmp, isl, mpfr and mpc dependencies 146d2edfdd1SNiels Sascha Reedijk rm gmp gmp-6.2.1.tar.bz2 # Remove gmp download and symbolic link 147d2edfdd1SNiels Sascha Reedijk mv gmp-6.2.1 gmp # Move the downloaded gmp dependency in place 148d2edfdd1SNiels Sascha Reedijk rm isl isl-0.24.tar.bz2 149d2edfdd1SNiels Sascha Reedijk mv isl-0.24 isl 150d2edfdd1SNiels Sascha Reedijk rm mpc mpc-1.2.1.tar.gz 151d2edfdd1SNiels Sascha Reedijk mv mpc-1.2.1 mpc 152d2edfdd1SNiels Sascha Reedijk rm mpfr mpfr-4.1.0.tar.bz2 153d2edfdd1SNiels Sascha Reedijk mv mpfr-4.1.0 mpfr 154d2edfdd1SNiels Sascha Reedijk popd 155d2edfdd1SNiels Sascha Reedijk git add -f gcc # Add the new files to git 156d2edfdd1SNiels Sascha Reedijk git commit -m "import gcc 13.2.0" # Commit the files in the vendor branch 157d2edfdd1SNiels Sascha Reedijk git push origin vendor-binutils # You can push this directly to the branch 158d2edfdd1SNiels Sascha Reedijk 159d2edfdd1SNiels Sascha ReedijkNow this can easily be merged into the master branch: 160d2edfdd1SNiels Sascha Reedijk 161d2edfdd1SNiels Sascha Reedijk.. code-block:: bash 162d2edfdd1SNiels Sascha Reedijk 163d2edfdd1SNiels Sascha Reedijk git checkout master 164d2edfdd1SNiels Sascha Reedijk git merge vendor-binutils 165d2edfdd1SNiels Sascha Reedijk 166d2edfdd1SNiels Sascha ReedijkReview and fix the conflicts, if any, then push the changes for review on Gerrit. 167d2edfdd1SNiels Sascha Reedijk 168abc159e3SPulkoMandyComparing our code with upstream 169abc159e3SPulkoMandy................................ 170abc159e3SPulkoMandy 171abc159e3SPulkoMandyComparing the two versions is easy because you can refer to them by branch names: 172abc159e3SPulkoMandy 173abc159e3SPulkoMandy.. code-block:: bash 174abc159e3SPulkoMandy 175abc159e3SPulkoMandy git diff vendor-binutils master -- binutils 176