An ebuild is a specialized bash script which automates compilation and installation procedures for software packages. The format was created by the Gentoo Linux project for use in its Portage software management system.
Each version of an application or package in the Portage repository has a specific ebuild script written for it. The script is used by the emerge tool, also created by the Gentoo Linux project, to calculate any dependencies of the desired software installation, download the required files (and patch them, if necessary), configure the package (based on "USE flag" settings), compile, and perform a sandboxed installation (in /var/tmp/portage/[ebuild name]/image/ by default). Upon successful completion of these steps, the installed files are merged into the live system, outside the sandbox.
Although most ebuilds found in the Gentoo Portage repository are used to compile programs from source code, there are also ebuilds to install binary packages, ebuilds that install only documentation or data such as fonts, and basic ebuilds called "metabuilds" whose sole purpose is to trigger the installation of other ebuilds (such as the GNOME or KDE metabuilds).