commit: dd33b3da11edd5bcaa3fd7eb55ad650e2f38ac59 Author: David Seifert <soap <AT> gentoo <DOT> org> AuthorDate: Mon Apr 5 18:16:07 2021 +0000 Commit: David Seifert <soap <AT> gentoo <DOT> org> CommitDate: Mon Apr 5 18:16:07 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dd33b3da
font-ebdftopcf.eclass: Modernise Closes: https://github.com/gentoo/gentoo/pull/20261 Signed-off-by: David Seifert <soap <AT> gentoo.org> eclass/font-ebdftopcf.eclass | 52 ++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/eclass/font-ebdftopcf.eclass b/eclass/font-ebdftopcf.eclass index 889f821c257..9b453852544 100644 --- a/eclass/font-ebdftopcf.eclass +++ b/eclass/font-ebdftopcf.eclass @@ -3,7 +3,8 @@ # @ECLASS: font-ebdftopcf.eclass # @MAINTAINER: -# [email protected] +# [email protected] +# @SUPPORTED_EAPIS: 7 # @AUTHOR: # Robin H. Johnson <[email protected]> # @BLURB: Eclass to make PCF font generator from BDF uniform and optimal @@ -11,39 +12,48 @@ # The manpage for this eclass is in media-gfx/ebdftopcf. # Inherit this eclass after font.eclass -# if USE="-X", this eclass is basically a no-op, since bdftopcf requires Xorg. -IUSE="X" +case ${EAPI} in + 7) ;; + *) die "EAPI=${EAPI:-0} is not supported" ;; +esac + +EXPORT_FUNCTIONS src_compile -# Variable declarations -DEPEND="X? ( media-gfx/ebdftopcf )" -RDEPEND="" +if [[ -z ${_FONT_EBDFTOPCF_ECLASS} ]]; then +_FONT_EBDFTOPCF_ECLASS=1 + +# Make dependence on Xorg optional +IUSE="X" -# -# Public functions -# +BDEPEND="X? ( media-gfx/ebdftopcf )" +# @FUNCTION: ebdftopcf +# @USAGE: <list of BDF files to convert> +# @DESCRIPTION: +# Convert BDF to PCF. This implicitly requires USE="X" to be enabled. ebdftopcf() { - local bdffiles - bdffiles="$@" - [ -z "$bdffiles" ] && die "No BDF files specified." - emake -f "${EPREFIX}"/usr/share/ebdftopcf/Makefile.ebdftopcf \ + debug-print-function ${FUNCNAME} "$@" + + local bdffiles="$@" + [[ -z ${bdffiles} ]] && die "No BDF files specified" + emake -f "${BROOT}"/usr/share/ebdftopcf/Makefile.ebdftopcf \ BDFFILES="${bdffiles}" \ BDFTOPCF_PARAMS="${BDFTOPCF_PARAMS}" \ || die "Failed to build PCF files" } -# -# Public inheritable functions -# - +# @FUNCTION: font-ebdftopcf_src_compile +# @DESCRIPTION: +# Default phase function to convert BDF to PCF. If USE="-X", this amounts to +# a no-op, since bdftopcf requires Xorg. font-ebdftopcf_src_compile() { - use X && FONT_SUFFIX="pcf.gz" - use X || FONT_SUFFIX="bdf" + debug-print-function ${FUNCNAME} "$@" + FONT_SUFFIX=$(usex X "pcf.gz" "bdf") if use X; then - [ -z "${BDFFILES}" ] && BDFFILES="$(find . -name '*.bdf')" + [[ -z ${BDFFILES} ]] && local BDFFILES="$(find . -name '*.bdf')" ebdftopcf ${BDFFILES} fi } -EXPORT_FUNCTIONS src_compile +fi
