--- /dev/null
+From eab13986198098688fdeb60c3c87f77df32eace8 Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <chewi@aura-online.co.uk>
+Date: Sat, 15 Jul 2017 12:06:32 +0100
+Subject: [PATCH] Add baseline_reg to gnuplot-dependent test list
+
+---
+ prog/reg_wrapper.sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/prog/reg_wrapper.sh b/prog/reg_wrapper.sh
+index 0947990..2845077 100755
+--- a/prog/reg_wrapper.sh
++++ b/prog/reg_wrapper.sh
+@@ -31,7 +31,7 @@ TEST_NAME="${TEST##*/}"
+ TEST_NAME="${TEST_NAME%_reg*}"
+
+ case "${TEST_NAME}" in
+- colormask|colorspace|dna|enhance|fpix1|kernel|nearline|projection|rankbin|rankhisto)
++ baseline|colormask|colorspace|dna|enhance|fpix1|kernel|nearline|projection|rankbin|rankhisto)
+ which gnuplot > /dev/null || which wgnuplot > /dev/null || exec ${@%${TEST}} /bin/sh -c "exit 77" ;;
+ esac
+
--- /dev/null
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit eutils multilib-minimal
+
+DESCRIPTION="C library for image processing and analysis"
+HOMEPAGE="http://www.leptonica.org/"
+SRC_URI="https://github.com/DanBloomberg/${PN}/releases/download/${PV}/${P}.tar.gz"
+LICENSE="Apache-2.0"
+SLOT="0/5"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~ppc-macos"
+IUSE="gif jpeg jpeg2k png static-libs test tiff utils webp zlib"
+
+# N.B. Tests need some features enabled:
+REQUIRED_USE="test? ( jpeg png tiff zlib )"
+
+DEPEND="gif? ( media-libs/giflib:=[${MULTILIB_USEDEP}] )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ jpeg2k? ( media-libs/openjpeg:2=[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}]
+ sys-libs/zlib:=[${MULTILIB_USEDEP}] )
+ tiff? ( media-libs/tiff:0=[${MULTILIB_USEDEP}] )
+ webp? ( media-libs/libwebp:=[${MULTILIB_USEDEP}] )
+ zlib? ( sys-libs/zlib:=[${MULTILIB_USEDEP}] )"
+RDEPEND="${DEPEND}"
+
+PATCHES=( "${FILESDIR}"/baseline_reg.patch )
+ECONF_SOURCE="${S}"
+DOCS=( README version-notes )
+
+src_prepare() {
+ default
+
+ # unhtmlize docs
+ local X
+ for X in ${DOCS[@]}; do
+ awk '/<\/pre>/{s--} {if (s) print $0} /<pre>/{s++}' \
+ "${X}.html" > "${X}" || die 'awk failed'
+ rm -f -- "${X}.html"
+ done
+}
+
+multilib_src_configure() {
+ econf \
+ --enable-shared \
+ $(use_with gif giflib) \
+ $(use_with jpeg) \
+ $(use_with jpeg2k libopenjpeg) \
+ $(use_with png libpng) \
+ $(use_with tiff libtiff) \
+ $(use_with webp libwebp) \
+ $(use_with zlib) \
+ $(use_enable static-libs static) \
+ $(multilib_native_use_enable utils programs)
+}
+
+src_install() {
+ multilib-minimal_src_install
+ prune_libtool_files
+}