On this page:
5.1 Rust’s Cargo
ebuild-cargo-mixin
ebuild-cargo%
new
5.2 Emacs Lisp libraries
ebuild-elisp-mixin
ebuild-elisp%
new
package-elisp-mixin
package-elisp%
new
5.3 Git Hosting snapshots
ebuild-gh-mixin
ebuild-gh%
new
5.4 Git repositories
ebuild-git-mixin
ebuild-git%
new
8.5

5 Ebuild Templates

5.1 Rust’s Cargo

 (require ebuild/templates/cargo)
  package: ebuild-templates

mixin

ebuild-cargo-mixin : (class? . -> . class?)

  argument extends/implements: ebuild%

class

ebuild-cargo% : class?

  superclass: ebuild%

Pre-made class extending ebuild% for writing ebuilds using the cargo.eclass.

When creating a ebuild-cargo% object following values are automatically added to fields:
  • "cargo" to "inherit"ed eclasses

  • "$(cargo_crate_uris ${CRATES})" to SRC_URI

  • CRATES to a CRATES variable

constructor

(new ebuild-cargo% [[CRATES CRATES]])  (is-a?/c ebuild-cargo%)

  CRATES : (listof string?) = '()

Examples:
> (define my-ebuild
    (new ebuild-cargo% [CRATES '("crate1" "crate2" "crate3")]))
> (display my-ebuild)

# Copyright 1999-2022 Gentoo Authors

# Distributed under the terms of the GNU General Public License v2

EAPI=8

CRATES="

crate1

crate2

crate3"

inherit cargo

DESCRIPTION="A package description"

HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"

SRC_URI="$(cargo_crate_uris ${CRATES})"

LICENSE="all-rights-reserved"

SLOT="0"

KEYWORDS="~amd64"

RESTRICT="mirror"

5.2 Emacs Lisp libraries

 (require ebuild/templates/elisp)
  package: ebuild-templates

mixin

ebuild-elisp-mixin : (class? . -> . class?)

  argument extends/implements: ebuild%

class

ebuild-elisp% : class?

  superclass: ebuild%

Pre-made class extending ebuild% for writing ebuilds using the elisp.eclass.

constructor

(new ebuild-elisp% 
    [[BYTECOMPFLAGS BYTECOMPFLAGS] 
    [ELISP_REMOVE ELISP_REMOVE] 
    [ELISP_TEXINFO ELISP_TEXINFO] 
    [EMACSFLAGS EMACSFLAGS] 
    [EMACSMODULES EMACSMODULES] 
    [NEED_EMACS NEED_EMACS] 
    [SITEETC SITEETC] 
    [SITEFILE SITEFILE] 
    [SITELISP SITELISP]]) 
  (is-a?/c ebuild-elisp%)
  BYTECOMPFLAGS : (or/c #f string?) = #f
  ELISP_REMOVE : (or/c #f string?) = #f
  ELISP_TEXINFO : (or/c #f string?) = #f
  EMACSFLAGS : (or/c #f string?) = #f
  EMACSMODULES : (or/c #f string?) = #f
  NEED_EMACS : (or/c #f number?) = #f
  SITEETC : (or/c #f string?) = #f
  SITEFILE : (or/c #f string?) = "50${PN}-gentoo.el"
  SITELISP : (or/c #f string?) = #f

Examples:
> (define my-ebuild
    (new ebuild-elisp%
         [NEED_EMACS 25.1]
         [ELISP_REMOVE "${PN}-autoloads.el"]
         [ELISP_TEXINFO "${PN}.texi"]))
> (display my-ebuild)

# Copyright 1999-2022 Gentoo Authors

# Distributed under the terms of the GNU General Public License v2

EAPI=8

NEED_EMACS=25.1

inherit elisp

DESCRIPTION="A package description"

HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"

LICENSE="all-rights-reserved"

SLOT="0"

KEYWORDS="~amd64"

RESTRICT="mirror"

ELISP_REMOVE="${PN}-autoloads.el"

ELISP_TEXINFO="${PN}.texi"

SITEFILE="50${PN}-gentoo.el"

mixin

package-elisp-mixin : (class? . -> . class?)

  argument extends/implements: package%

class

package-elisp% : class?

  superclass: ebuild%

Pre-made class extending package% for writing ebuilds using the elisp.eclass.

constructor

(new package-elisp% 
    [[sitefile-name sitefile-name] 
    [sitefile-lisp sitefile-lisp]]) 
  (is-a?/c package-elisp%)
  sitefile-name : string? = (format "50~a-gentoo.el" PN)
  sitefile-lisp : (listof string?)
   = '("(add-to-list 'load-path \"@SITELISP@\")")

Examples:
> (define my-package
    (new package-elisp%
         [CATEGORY "app-emacs"]
         [PN "my-lib"]
         [ebuilds (hash (live-version) (new ebuild-elisp% [NEED_EMACS 25.1]))]))
> (send my-package show)

CATEGORY/PN: app-emacs/my-lib

PV: 9999

# Copyright 1999-2022 Gentoo Authors

# Distributed under the terms of the GNU General Public License v2

EAPI=8

NEED_EMACS=25.1

inherit elisp

DESCRIPTION="A package description"

HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"

LICENSE="all-rights-reserved"

SLOT="0"

KEYWORDS="~amd64"

RESTRICT="mirror"

SITEFILE="50${PN}-gentoo.el"

METADATA:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">

<pkgmetadata>

</pkgmetadata>

SITEFILE: 50my-lib-gentoo.el

(add-to-list 'load-path "@SITELISP@")

5.3 Git Hosting snapshots

 (require ebuild/templates/gh) package: ebuild-templates

mixin

ebuild-gh-mixin : (class? . -> . class?)

  argument extends/implements: ebuild%

class

ebuild-gh% : class?

  superclass: ebuild%

Pre-made class extending ebuild% for writing ebuilds using the gh.eclass.

constructor

(new ebuild-gh%    
    [GH_REPO GH_REPO]    
    [[GH_DOM GH_DOM]    
    [GH_COMMIT GH_COMMIT]])  (is-a?/c ebuild-gh%)
  GH_REPO : string?
  GH_DOM : string? = "gitlab.com"
  GH_COMMIT : (or/c #f string?) = #f

Examples:
> (define my-ebuild
    (new ebuild-gh%
         [GH_DOM "gitlab.com"]
         [GH_REPO "asd/asd"]
         [GH_COMMIT "b46c957f0ad7490bc7b0f01da0e80380f34cac2d"]))
> (display my-ebuild)

# Copyright 1999-2022 Gentoo Authors

# Distributed under the terms of the GNU General Public License v2

EAPI=8

GH_DOM="gitlab.com"

GH_REPO="asd/asd"

GH_COMMIT="b46c957f0ad7490bc7b0f01da0e80380f34cac2d"

inherit gh

DESCRIPTION="A package description"

HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"

LICENSE="all-rights-reserved"

SLOT="0"

KEYWORDS="~amd64"

RESTRICT="mirror"

5.4 Git repositories

 (require ebuild/templates/git)
  package: ebuild-templates

mixin

ebuild-git-mixin : (class? . -> . class?)

  argument extends/implements: ebuild%

class

ebuild-git% : class?

  superclass: ebuild%

Pre-made class extending ebuild% for writing ebuilds using the git-r3.eclass.

constructor

(new ebuild-git% 
    [EGIT_REPO_URI EGIT_REPO_URI] 
    [[EGIT_BRANCH EGIT_BRANCH] 
    [EGIT_CHECKOUT_DIR EGIT_CHECKOUT_DIR] 
    [EGIT_COMMIT EGIT_COMMIT] 
    [EGIT_COMMIT_DATE EGIT_COMMIT_DATE] 
    [EGIT_MIN_CLONE_TYPE EGIT_MIN_CLONE_TYPE] 
    [EGIT_MIRROR_URI EGIT_MIRROR_URI] 
    [EGIT_SUBMODULES EGIT_SUBMODULES] 
    [EVCS_OFFLINE EVCS_OFFLINE]]) 
  (is-a?/c ebuild-git%)
  EGIT_REPO_URI : string?
  EGIT_BRANCH : (or/c #f string?) = #f
  EGIT_CHECKOUT_DIR : (or/c #f string?) = #f
  EGIT_COMMIT : (or/c #f string?) = #f
  EGIT_COMMIT_DATE : (or/c #f string?) = #f
  EGIT_MIN_CLONE_TYPE : (or/c #f string?) = #f
  EGIT_MIRROR_URI : (or/c #f string?) = #f
  EGIT_SUBMODULES : (or/c #f (listof string?)) = #f
  EVCS_OFFLINE : (or/c #f string?) = #f

Examples:
> (define my-ebuild
    (new ebuild-git%
         [EGIT_REPO_URI "https://gitlab.com/asd/asd.git"]
         [EGIT_BRANCH "trunk"]
         [EGIT_SUBMODULES '()]
         [KEYWORDS '()]))
> (display my-ebuild)

# Copyright 1999-2022 Gentoo Authors

# Distributed under the terms of the GNU General Public License v2

EAPI=8

EGIT_REPO_URI="https://gitlab.com/asd/asd.git"

EGIT_BRANCH="trunk"

EGIT_SUBMODULES=()

inherit git-r3

DESCRIPTION="A package description"

HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"

LICENSE="all-rights-reserved"

SLOT="0"

RESTRICT="mirror"