Gentoo Vs FreeBSD – Tools, Optimization & Customization
Both Gentoo and FreeBSD are source based distributions (although binary packages are also available to various extents – more on that later) which means that when you install a package – you also need to compile it first.
When you compile a package, you’re also given the opportunity to choose what options (use-flags / configuration) will it have and what not, e.g. when installing Libreoffice, for instance, you can opt for compiling it with GNOME DE support or without it – it’s up to you.
This results in a better optimized system which leads to better performance overall.
One of the most prominent “parts” which makes Gentoo for what it is, is the init system it uses at its base.
Although others are available too, Gentoo devs are developing their own customized init system called OpenRC – which has its own set of unique features, inspired by BSD init style.
When installing a package on Gentoo, you’ll most probably be compiling it from source using Gentoo’s PM (Package Manager) called Portage.
Portage allows you to set different use flags for compiling packages either globally or specifically for individual packages, it also allows you to mix packages from different branches, i.e. stable, unstable, experimental, etc…
Furthermore, Gentoo encourages you to customize the compiler itself – the software used to compile packages – by setting CFLAGS and MAKEOPTS variables, hence resulting in highly optimized system, tailored for its owners needs and hardware capabilities.
The great deal of customization that is enabled by Portage however, is NOT always directly supported by upstream package developers and can rarely lead to unexpected behavior or need for somewhat expert user intervention.
For example, compiling VLC without Qt use-flag will result in a successful software compilation, however, the user will be left with a command line software only, since the GUI (Graphical User Interface) necessitates Qt in order to build – this can be quite confusing for the inexperienced.
In some cases, usually when the package is very big to compile, Gentoo also offers binary packages as well, which are already compiled and can simply be installed just like most other distributions install packages.
Of course, each method has its pros and cons, whereas compiling takes longer time it also grants much flexibility and empowers the user whilst installing without compiling is faster, but takes away the power from the user and leave it in the hands of the distributer.
Other noteworthy use-flags which can be set and respected by Portage also includes: LINGUAS (now called L10N) – tells Portage what language packages to support, VIDEO_CARDS – what video cards to support, e.g. Nvidia, Radeon, etc… , INPUT_DEVICES – what input devices should Xorg support, and so on and so forth.
In addition to all that, Gentoo also has maintenance tools in abundance, tools such as: equery, eselect and euse allows the user to query packages (sizes or dependencies for instance), select which version / package to use, or set and unset use flags at various places, respectively.
- Advantages: Highly flexible, user empowering, enables fine grained control over the system
- Disadvantages: Takes time to master and to set-up initially
- Optimization Level: Very high
One of FreeBSD most notable hallmarks is its BSD style init system, simply referred to as RC or rc.conf, it is simple by design, meant to be human readable and simple to maintain as well.
Although FreeBSD is largely considered a source based distribution*, it has since long time supported the installation of binary packages as well.
To install binary packages, in past versions of FreeBSD, the main tool used was the now defunct pkg_add, which recently (past couple of years) has evolved into pkg / pkgng – a next generation package manager, mostly similar in its features to Debian’s apt-get or Fedora’s yum / dnf.
However, as of current, it still seems that the most functional and reliable method of installing packages on FreeBSD is by using its ports system. (from which BTW, Gentoo’s portage was inspired)
In order to find a package you wish to install from source on FreeBSD, you are basically facing two different options by default: either search for it on FreshPorts website or use whereis command to search on the local synchronized database.
Once you find a package you wish to install, it’s better that you’ll be aware of the fact you’re probably going to be prompted during the installation (perhaps even several times) to select what configuration options you’d like to compile with.
Once you’ve set the configurations options, you won’t get prompted for the same options in the future (unless you’ll choose too).
If you wish to avoid being prompted about configuration options time and time again during package installation, you may issue the command make config-recursive which will let you configure the package prior to installing it.
The drawbacks of this method are: it’s not always 100% working, that is, even though you’ve used “make config-recursive”, prompts may still pop-up occasionally.
Another drawback is that it still necessitates you to go through all the configuration options prompts which may take a while, especially when it comes to large, meta, packages such as GNOME or KDE.
FreeBSD ports system respects CFLAGS, however MAKE_JOBS_NUMBER (MAKEOPTS equivalent) option seems to be no longer available to set in global make.conf (at least according to official documentation).
Installing packages from different branches is generally not supported by FreeBSD.
- Advantages: Flexible, user empowering, has an interactive way of configuring packages
- Disadvantages: Takes time to master, configuration is done per package which may take more time
- Optimization Level: High
* Note that BSDs aren’t considering themselves as distributions, in contrary to the way Linux OSs does, that’s because each BSD OS has its own kernel and base system which is unique to itself. The use of distributions in the context that appears in the article is merely used for convenience sake.