Gentoo is a source-based Linux distro and each time we want to install a package in fact we compile it with the system program emerge. In most cases, we have USE flags for everything we need about a package, but we can further pass custom options directly to the configure script of the package through the emerge program. Using this method we can tune more subtle the configuration stage of a package and still using the package manager of the system, which is always the preferred way!
For example, we can install manually additional libraries in /usr/local/ or any other directory and we can use them passing the needed configuration to the configure script of the package. Let’s say we want to use a new feature of the latest OpenSSL library, but we do not want to install it globally and re-emerge everything linked to it, so we build it manually in a directory like /usr/local/openssl-1.1.1/ and we want to link our PHP against it, but the PHP is better to be installed by the emerge (the package manager) because it has many features like init script, the global default path to configurations and so on. So we can execute the following command:
EXTRA_ECONF="--with-openssl-dir=/usr/local/openssl-1.1.1/" emerge -avt php
you can use EXTRA_ECONF=”
It is good practice to make persistent this configuration over builds, so we can use
/etc/portage/package.env
to save the configuration for future building of the package:
echo "EXTRA_ECONF=\"--with-openssl-dir=/usr/local/openssl-1.1.1/\"" > /etc/portage/env/php.conf echo "dev-lang/php php.conf" > /etc/portage/package.env