+# Copyright © 2020 Nick Bowler
+# License GPLv3+: GNU General Public License version 3 or any later version.
+# This is free software: you are free to change and redistribute it.
+# There is NO WARRANTY, to the extent permitted by law.
+
+EAPI=7
+
+inherit toolchain-funcs desktop xdg
+
+DESCRIPTION="LCD monitor test pattern generator"
+HOMEPAGE="http://www.brouhaha.com/~eric/software/lcdtest/"
+SRC_URI="$HOMEPAGE/download/$P.tar.gz"
+
+LICENSE="GPL-3"
+KEYWORDS="~amd64 ~x86"
+SLOT="0"
+
+DEPEND="media-libs/libsdl[video]
+ media-libs/sdl-ttf"
+RDEPEND="$DEPEND
+ media-fonts/liberation-fonts"
+
+PATCHES=(
+ "$FILESDIR/$P-no-sdl-image.patch"
+ "$FILESDIR/$P-fix-prints.patch"
+ "$FILESDIR/$P-font-path.patch"
+ )
+
+src_compile () {
+ local font="/usr/share/fonts/liberation-fonts/LiberationMono-Regular.ttf"
+ local mycc=$(tc-getCC)
+ local compile="$mycc $CPPFLAGS $CFLAGS -c" link="$mycc $CFLAGS $LDFLAGS"
+
+ (cd src || exit; set -x
+ $compile lcdtest.c -DFONT_PATH=\""${EPREFIX%/}$font"\" -DRELEASE=$PV &&
+ $link -o lcdtest lcdtest.o -lSDL_ttf -lSDL) || die
+}
+
+src_install () {
+ dobin src/lcdtest
+ doman man/lcdtest.1
+ doicon -s scalable desktop/lcdtest.svg
+ domenu desktop/lcdtest.desktop
+
+ default
+}