media-libs/leptonica: Patch to avoid gnuplot dependency
authorJames Le Cuirot <chewi@gentoo.org>
Tue, 13 Feb 2018 14:51:26 +0000 (14:51 +0000)
committerJames Le Cuirot <chewi@gentoo.org>
Tue, 13 Feb 2018 14:51:26 +0000 (14:51 +0000)
The test suite already checked whether gnuplot is present but it
didn't check whether PNG support is enabled.

Bug: https://github.com/DanBloomberg/leptonica/pull/308
Package-Manager: Portage-2.3.24, Repoman-2.3.6

media-libs/leptonica/files/gnuplot-png.patch [new file with mode: 0644]
media-libs/leptonica/leptonica-1.75.2.ebuild

diff --git a/media-libs/leptonica/files/gnuplot-png.patch b/media-libs/leptonica/files/gnuplot-png.patch
new file mode 100644 (file)
index 0000000..4e87fca
--- /dev/null
@@ -0,0 +1,29 @@
+From 1b3c9b64ee204b3f9371cea624c959b3177c9c1d Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <chewi@aura-online.co.uk>
+Date: Tue, 13 Feb 2018 14:37:32 +0000
+Subject: [PATCH] Skip gnuplot tests if it is missing PNG support
+
+---
+ prog/reg_wrapper.sh | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/prog/reg_wrapper.sh b/prog/reg_wrapper.sh
+index bc60c82..4afdc08 100755
+--- a/prog/reg_wrapper.sh
++++ b/prog/reg_wrapper.sh
+@@ -32,7 +32,11 @@ TEST_NAME="${TEST_NAME%_reg*}"
+ 
+ case "${TEST_NAME}" in
+     baseline|boxa1|colormask|colorspace|dna|enhance|extrema|fpix1|italic|kernel|nearline|projection|rankbin|rankhisto|wordboxes)
+-        which gnuplot > /dev/null || which wgnuplot > /dev/null || exec ${@%${TEST}} /bin/sh -c "exit 77" ;;
++        GNUPLOT=$(type -P gnuplot wgnuplot)
++
++        if [ -z "${GNUPLOT}" ] || ! "${GNUPLOT}" -e "set terminal png" 2>/dev/null ; then
++            exec ${@%${TEST}} /bin/sh -c "exit 77"
++        fi
+ esac
+ 
+ exec ${@%${TEST}} /bin/sh -c "cd \"${srcdir}\" && \"${PWD}/\"${TEST} generate && \"${PWD}/\"${TEST} compare"
+-- 
+2.16.1
+
index 38ffafa4bedf6f2266f0029880548a609dd32147..d72072546d558cea820a12a42f42afe506fe7df1 100644 (file)
@@ -26,11 +26,9 @@ RDEPEND="gif? ( >=media-libs/giflib-5.1.3:=[${MULTILIB_USEDEP}] )
        zlib? ( sys-libs/zlib:=[${MULTILIB_USEDEP}] )"
 
 DEPEND="${RDEPEND}
-       test? (
-               media-libs/tiff:0[zlib]
-               sci-visualization/gnuplot[cairo]
-       )"
+       test? ( media-libs/tiff:0[zlib] )"
 
+PATCHES=( "${FILESDIR}"/gnuplot-png.patch )
 ECONF_SOURCE="${S}"
 DOCS=( README version-notes )