Search code examples
linuxubuntuinstallationdependency-managementbuild-system

What tools do distro maintainers (i.e. Ubuntu, Fedora) use for build/dependency management?



Background

I'd like to, strictly for the sake of research and proof-of-concept, fork an existing Linux distro such as Ubuntu (or possibly Fedora). I have a small cluster of vagrant virtual machines, and I'd like to experiment with this to get a feel for how large (open source) projects handle builds and dependency management.


Details

While it's straightforward to pull their respective source trees, patches, etc.; one thing that eludes me is "how do they build each and every package"? In order to do something like a "nightly build", it's to my understanding the distro maintainer needs to:

  • Setup a build environment with the toolchains/compilers for all the supported platforms (i.e. x86, x86_64, arm, armhf, aarch64, mips, etc.).
  • Pull the source tarballs/repos for each package.
  • Deploy the headers for all "library" packages.
  • Build and deploy the libraries (i.e. .a and .so files) for all "library" packages.
  • Build and deploy the apps/binaries that (possibly) depend on the previously-built libraries.
  • Package each library/app as it's own deb/rpm/tarball.
  • Create an overall installer that encompasses all the packages.

Question

How do distro maintainers set this all up? Is there a common/standard framework used by distro maintainers, or do they all "wrap their own solution" in-house?


Solution

  • Many of these steps you can learn in the Linux From Scratch book. Although this book is focused on the x86_64 platform, the things you learn there can be ported to the others. When later you build for ARM for example, you can follow tutorials like this for the kernel, and for specific packages/libs, their corresponding commands for cross-compiling, it will vary depending on the program. After following this book you'll be able to at least understand the first five itens in your post details.

    As for packaging the .deb, .rpm packages this will be specific for the distro you forked, you'll have to read some docs on this. If you plan to release your fork you'll also need an online provider for the packages (examples, sourceforge, github, gitlab). So you'll have to setup the repos for the sources and binaries in order to your package manager point to (in the case of apt, it would be those pointed by /etc/apt/sources.list.)

    Finally, you'll want to pack all of this in an .iso file to install. After having your LFS up and running in your computer, you can just generate an image from it, assuming it is one-partition in /dev/sda1:

    dd if=/dev/sda1 of=my-distro-iso.iso
    

    And later burn it and boot into it. With this would be enough to other people to install your distro. If you want to do more and make a installer, maybe you can use Distribution builders like Ubiquity or Anaconda. It won't be trivial and you'll have to read on how to use them, but for someone who just passed the LFS test that will be easy ;)

    You can also count on the Advanced Linux Programming book when developing the applications for your distro.