GUILE-SINGLE.ECLASS

Section: eclass-manpages (5)
Updated: Nov 2024
Index Return to Main Contents

NAME

guile-single.eclass - Utilities for packages that build against a single Guile.

DESCRIPTION

This eclass facilitates packages building against a single slot of Guile, which is normally something that uses Guile for extending, like GNU Make, or for programs built in Guile, like Haunt.

Inspired by prior work in the Gentoo Python ecosystem.

These packages should use guile_gen_cond_dep to generate a dependency string for their Guile package dependencies (i.e. other Guile single- and multi-implementation packages). They should also utilize GUILE_DEPS and GUILE_REQUIRED_USE to specify a dependency on their Guile versions.

They should also bump sources via guile_bump_sources during src_prepare, and unstrip ccache via guile_unstrip_ccache during src_install.

If the user of the eclass needs some USE flag on Guile itself, they should provide it via GUILE_REQ_USE.

This eclass provides a guile-single_pkg_setup that sets up environment variables needed for Guile and build systems using it. See the documentation for that function for more details.

SUPPORTED EAPIS

8

TRANSITIVELY PROVIDED ECLASSES

guile-utils

EXAMPLE

A Guile program:

# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

GUILE_COMPAT=( 2-2 3-0 )
inherit guile-single

DESCRIPTION="Haunt is a simple, functional, hackable static site generator"
HOMEPAGE="https://dthompson.us/projects/haunt.html"
SRC_URI="https://files.dthompson.us/releases/${PN}/${P}.tar.gz"

LICENSE="GPL-3+"
SLOT="0"
KEYWORDS="~amd64"
REQUIRED_USE="${GUILE_REQUIRED_USE}"

RDEPEND="
        ${GUILE_DEPS}
        $(guile_gen_cond_dep '
                dev-scheme/guile-reader[${GUILE_MULTI_USEDEP}]
                dev-scheme/guile-commonmark[${GUILE_MULTI_USEDEP}]
        ')
"
DEPEND="${RDEPEND}"

A program utilizing Guile for extension (GNU make, irrelevant pieces elided):

GUILE_COMPAT=( 1-8 2-0 2-2 3-0 )
inherit flag-o-matic unpacker verify-sig guile-single
# ...
REQUIRED_USE="guile? ( ${GUILE_REQUIRED_USE} )"
DEPEND="
        guile? ( ${GUILE_DEPS} )
"

src_prepare() {
        # ...
        if use guile; then
                guile-single_src_prepare
        fi
}

pkg_setup() {
        if use guile; then
                guile-single_pkg_setup
        fi
}

src_configure() {
        # ...
        local myeconfargs=(
                $(use_with guile)
        )
        econf "${myeconfargs[@]}"
}

src_install() {
        # ...
        if use guile; then
                guile_unstrip_ccache
        fi
}

FUNCTIONS

guile_gen_cond_dep <dependency> [<pattern>...]
Takes a string that uses (quoted) ${GUILE_SINGLE_USEDEP} and ${GUILE_MULTI_USEDEP} markers as placeholders for the correct USE dependency strings for each compatible slot.

If the pattern is provided, it is taken to be list of slots to generate the dependency string for, otherwise, ${GUILE_COMPAT[@]} is taken.

guile-single_pkg_setup
Sets up the PKG_CONFIG_PATH with the appropriate GUILE_SINGLE_TARGET, as well as setting up a guile-config and the GUILE, GUILD and GUILESNARF environment variables. Also sets GUILE_EFFECTIVE_VERSION to the same value as GUILE_SELECTED_TARGET, as build systems sometimes check that variable.

For details on the latter three, see guile_export.

guile-single_src_prepare
Runs the default prepare stage, and then bumps Guile sources via guile_bump_sources.
guile-single_src_install
Runs the default install stage, and then marks ccache files not to be stripped using guile_unstrip_ccache.

ECLASS VARIABLES

GUILE_COMPAT (REQUIRED) (SET BEFORE INHERIT)
List of acceptable versions of Guile. For instance, setting this variable like below will allow the package to be built against either Guile 2.2 or 3.0:

GUILE_COMPAT=( 2-2 3-0 )

Please keep in ascending order.

AUTHORS

Author: Arsen Arsenović <[email protected]>

MAINTAINERS

Gentoo Scheme project <[email protected]>

REPORTING BUGS

Please report bugs via https://bugs.gentoo.org/

FILES

guile-single.eclass

SEE ALSO

ebuild(5)
https://gitweb.gentoo.org/repo/gentoo.git/log/eclass/guile-single.eclass


Index

NAME
DESCRIPTION
SUPPORTED EAPIS
TRANSITIVELY PROVIDED ECLASSES
EXAMPLE
FUNCTIONS
ECLASS VARIABLES
AUTHORS
MAINTAINERS
REPORTING BUGS
FILES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 03:27:01 GMT, November 25, 2024