Ebuild

This is a wiki page. Be bold and improve it!

If you have any questions about the content on this page, don't hesitate to open a new ticket and we'll do our best to assist you.

http://linux.overshoot.tv/wiki/gentoo_ebuilds

The .ebuild files

https://wiki.gentoo.org/wiki/Ebuild

https://wiki.gentoo.org/wiki/Basic_guide_to_write_Gentoo_Ebuilds
https://devmanual.gentoo.org/
https://devmanual.gentoo.org/quickstart/
https://devmanual.gentoo.org/ebuild-writing/

new ebuild:

vim foo-0.1.ebuild

If the .ebuild file does not exist, vim will start with a new template ebuild.

For new ebuilds, see also:

/usr/portage/skel.ebuild
/usr/portage/skel.metadata.xml

Old ebuilds

The official Gentoo tree is a VCS repository. You can browse the history of the tree and find some ebuilds for packages that were removed from the tree, as well as ebuilds for older versions:
https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/?hideattic=0
http://anoncvs.gentoo.org/

Set your local overlay (See http://linux.overshoot.tv/wiki/portage_maintenance ), add the wanted ebuilds to it. fetch the distfiles, if the ebuilds can't and make the manifests to match. The difficulty may be finding all the files old ebuilds need.

ebuild  /usr/local/portage/dev-foo/bar/bar-1.2.ebuild manifest

When the source code is no longer available online, but you do have a copy locally, you can make the ebuild fetch restricted:

https://devmanual.gentoo.org/ebuild-writing/functions/pkg_nofetch/index....
https://devmanual.gentoo.org/general-concepts/mirrors/index.html#restric...
In the .ebuild file, add the line:

   RESTRICT="fetch"

Remove the http:// address from the SRC_URI so that only the file name remains: SRC_URI="filename.tar.xz". The file must manually be placed in /usr/portage/distfiles/

The command ebuild

See man ebuild.

The command ebuild is used as a low level interface for Portage and for the emerge command.

Developers can use ebuild command to fine-tune the emerging process, when they are hacking the software they want to emerge.
See:
http://linux.overshoot.tv/wiki/emerge_custom_builds