ebuild
Build and install software packages
TLDR
Create or update the package manifest
Clean the temporary build directories for the build file
Fetch sources if they do not exist
Extract the sources to a temporary build directory
Compile the extracted sources
Install the package to a temporary install directory
Install the temporary files to the live filesystem
Fetch, unpack, compile, install and qmerge the specified ebuild file
SYNOPSIS
ebuild
ebuild
PARAMETERS
--force
Force a specific action, overriding safety checks that might otherwise prevent it.
--keep-going
Continue building even if an error occurs in an earlier phase, for troubleshooting.
--skip-phase
Skip a named phase during the build process, useful for debugging or specific scenarios.
--read-only-root
Disallow modifications to the root filesystem during the build process, enhancing safety.
fetch
Download all required source files for the package to the designated source directory.
unpack
Decompress and extract source archives into a temporary build directory.
prepare
Apply patches and perform initial setup operations before the main compilation begins.
compile
Compile the source code into executable binaries and libraries.
test
Run any available unit or integration tests defined for the package.
install
Install compiled files into a temporary, isolated installation directory, typically in PKGDIR.
qmerge
Merge the contents of the temporary installation directory into the live root filesystem.
clean
Remove temporary build directories and files after a successful build or installation, or to clear previous attempts.
DESCRIPTION
ebuild is a fundamental command in the Gentoo Linux distribution, acting as the low-level interface to the Portage package management system. An ebuild itself is a shell script that describes how to fetch, unpack, patch, compile, test, and install a specific software package. It encapsulates all the necessary instructions and metadata for building a package from source code, including its dependencies, configuration options, and installation paths. While users typically interact with emerge to manage packages, ebuild is the underlying tool that emerge calls to perform the actual build operations for individual packages. It provides fine-grained control over the package build process, allowing developers and advanced users to troubleshoot, customize, or create new package definitions.
CAVEATS
ebuild is specific to the Gentoo Linux distribution and its Portage package manager; it is not available on other Linux distributions.
Direct invocation of ebuild is generally discouraged for regular package management; emerge is the preferred user-facing command that orchestrates ebuild calls.
Writing or modifying ebuilds requires a solid understanding of shell scripting, various build systems (e.g., autotools, cmake), and adherence to the Portage development guidelines.
EBUILD PHASES EXPLAINED
Each command-line argument after the ebuild path typically corresponds to a specific "phase" in the package build lifecycle. These phases are executed sequentially if multiple are provided on the command line. If no phase is specified, ebuild will execute a default sequence, usually culminating in the install and qmerge phases. The standard order of execution for a full build is fetch > unpack > prepare > configure > compile > test > install > qmerge. Developers can override or customize the behavior of each phase within the ebuild script itself to accommodate specific package requirements.
HISTORY
The ebuild command emerged as a core component of Gentoo Linux's unique source-based package management philosophy. Conceived by Daniel Robbins, Gentoo's founder, in the early 2000s, it provided a flexible and powerful way to build software directly from source code, enabling system optimization and customization. Unlike binary package managers, ebuild scripts define the entire build process, offering unparalleled control and transparency, which became a hallmark of the Gentoo experience. Its development has been intertwined with the evolution of the Portage system, continually adapting to new software build practices and compiler optimizations while maintaining its foundational role.
SEE ALSO
emerge(1), portage(5), mk.conf(5)