summaryrefslogtreecommitdiff
blob: afd77e083bee78ce147390c07c3dc001c0010e9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# @ECLASS: font-ebdftopcf.eclass
# @MAINTAINER:
# fonts@gentoo.org
# @AUTHOR:
# Robin H. Johnson <robbat2@gentoo.org>
# @SUPPORTED_EAPIS: 7
# @BLURB: Eclass to make PCF font generator from BDF uniform and optimal
# @DESCRIPTION:
# The manpage for this eclass is in media-gfx/ebdftopcf.
# Inherit this eclass after font.eclass

case ${EAPI} in
	7) ;;
	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac

if [[ -z ${_FONT_EBDFTOPCF_ECLASS} ]]; then
_FONT_EBDFTOPCF_ECLASS=1

# Make dependence on Xorg optional
IUSE="X"

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() {
	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"
}

# @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() {
	debug-print-function ${FUNCNAME} "$@"

	FONT_SUFFIX=$(usex X "pcf.gz" "bdf")
	if use X; then
		[[ -z ${BDFFILES} ]] && local BDFFILES="$(find . -name '*.bdf')"
		ebdftopcf ${BDFFILES}
	fi
}

fi

EXPORT_FUNCTIONS src_compile