summaryrefslogtreecommitdiff
blob: b8c1c1261ae92e2a6711b4323bb782b75c7f903d (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Copyright 2020-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{10..12} )
inherit meson python-any-r1

DESCRIPTION="Simple library for font loading and glyph rasterization"
HOMEPAGE="https://codeberg.org/dnkl/fcft"
SRC_URI="https://codeberg.org/dnkl/fcft/archive/${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${PN}"

# MIT for fcft
# ZLIB for nanosvg
LICENSE="MIT ZLIB"
SLOT="0"
KEYWORDS="amd64 arm64 ppc64 ~riscv"
IUSE="examples +harfbuzz +libutf8proc test"
REQUIRED_USE="
	libutf8proc? ( harfbuzz )
	examples? ( libutf8proc )
"
RESTRICT="!test? ( test )"

RDEPEND="
	media-libs/fontconfig
	media-libs/freetype
	x11-libs/pixman
	examples? (
		dev-libs/libutf8proc:=
		dev-libs/wayland
	)
	harfbuzz? (
		media-libs/harfbuzz:=[truetype]
	)
	libutf8proc? (
		dev-libs/libutf8proc:=
	)
"
DEPEND="
	${RDEPEND}
	app-i18n/unicode-data
	dev-libs/tllist
	examples? (
		dev-libs/wayland-protocols
	)
	test? (
		dev-libs/check
		harfbuzz? ( media-fonts/noto-emoji )
	)
"
BDEPEND="
	${PYTHON_DEPS}
	app-text/scdoc
	virtual/pkgconfig
	examples? (
		dev-util/wayland-scanner
	)
"

src_prepare() {
	default

	rm -r unicode || die "Failed removing vendored unicode-data"

	sed -i "s;unicode/UnicodeData.txt;${EPREFIX}/usr/share/unicode-data/UnicodeData.txt;" \
		meson.build || die "Failed changing UnicodeData.txt to system's copy"
	sed -i "s;unicode/emoji-data.txt;${EPREFIX}/usr/share/unicode-data/emoji/emoji-data.txt;" \
		meson.build || die "Failed changing emoji-data.txt to system's copy"
}

src_configure() {
	local emesonargs=(
		$(meson_feature harfbuzz grapheme-shaping)
		$(meson_feature libutf8proc run-shaping)
		$(meson_use examples)
		$(use test && meson_use harfbuzz test-text-shaping)
		# bundled, tiny, I believe this means we should always include it
		-Dsvg-backend=nanosvg
		-Ddocs=enabled
	)

	meson_src_configure
}

src_install() {
	local DOCS=( CHANGELOG.md README.md )
	meson_src_install

	rm -r "${ED}"/usr/share/doc/${PN} || die

	use examples && newbin "${BUILD_DIR}/example/example" fcft-example
}