summaryrefslogtreecommitdiff
path: root/media-gfx/xsane
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /media-gfx/xsane
reinit the tree, so we can have metadata
Diffstat (limited to 'media-gfx/xsane')
-rw-r--r--media-gfx/xsane/Manifest8
-rw-r--r--media-gfx/xsane/files/xsane-0.999-lcms2.patch372
-rw-r--r--media-gfx/xsane/metadata.xml15
-rw-r--r--media-gfx/xsane/xsane-0.999-r2.ebuild91
4 files changed, 486 insertions, 0 deletions
diff --git a/media-gfx/xsane/Manifest b/media-gfx/xsane/Manifest
new file mode 100644
index 000000000000..adce4264bc71
--- /dev/null
+++ b/media-gfx/xsane/Manifest
@@ -0,0 +1,8 @@
+AUX xsane-0.999-lcms2.patch 11790 SHA256 edfc133483fc3975d9409314a2834403865e891f7744e59c4431a0f0050ebd04 SHA512 4734fd4599e2fed7b86a94836a40725fafb70e9252885faf092495fabfbaa02a7c245b3cacea19e5e1c455a3a74b475ad8cb215fbba3fa64bc066068abddbb29 WHIRLPOOL babe07abbc784f2d35309ca9d805a5bfab0c9037ea9159c3f0051b466b9b40aa53a561a864b26b6c68e1d3821e0719b2156fdf144ad1169963879002d07a727c
+DIST xsane-0.998-patches-2.tar.xz 54804 SHA256 84af533cba6309cf44892da8952b6203daa4dcfaf64e2efd1dddc5144e4cab4c SHA512 973ccac2fe3b6089049c1c5ba3e4cb0db29fdc79de372f8a7b461ee108e5bfc3f4a84997552fc3d3b651bbe9f98d247a5974d90e8949089b2ea52118eab6ad1f WHIRLPOOL 2294601aa696c442e8d2b5173b8ee04d158439e0ae02dd22c7d5c8f9fce98c8238a42e0867a5e511d206dd4030f7a15df2a98676471abe1e91870883662add56
+DIST xsane-0.999.tar.gz 2950621 SHA256 5782d23e67dc961c81eef13a87b17eb0144cae3d1ffc5cf7e0322da751482b4b SHA512 73ec961fce1a86b5d6f5bac0995d222785eb4b077dc8e72492b092d2bf4500455426e80e4d27233721cd38ec84f77fb9f92190a6afe45bdaf7ffd1ee50b431ed WHIRLPOOL 7d50f6ecd8ad671d36a6b92eb365a6361da8d90bfea3136cf7add0890313294903f8cbc75684cbc24e42a028f83922a0308783fb20d89b0d6b14b1f949283ad5
+DIST xsane-256x256.png 18478 SHA256 cb3f91fda48033734f1ac233fd788313e19522446680113dbc6dc5f5d33e4b16 SHA512 7bd63a701a4776b395689799ad98b7619917a9b40367c980bebaa116e6c5c2bfeffb8b996a8295b07f3483aa689c9040d8a68bb21376af65b1c0e8f69294f2e5 WHIRLPOOL 138c3b657d0527241237540cbe23dc541dff31f691c5971984c5e710cfb658cab301fc9ea6be0dcc609382104dab67dbd4c1bd65d9f8aabf1d04d6974922cf39
+EBUILD xsane-0.999-r2.ebuild 2269 SHA256 9c92e64bc9804c33e95dd81e1e480dd8ce063e7f43b12aa03015fd800241d1d7 SHA512 b814129dc647509ab35c300d9794aec66589c6b9f986319d3fbc16812b70368f722b10a97f85b795db30eb41d4530ec847856936b88895ce906053d244500ad1 WHIRLPOOL a0e6414a3451595b5accd2f5dfb826be8f37d2e22926496ff10907833d3eb177c9ef14743b0ba2c6a646b65c736897b8ec74cdca02803c285f0857bf8f23f7bb
+MISC ChangeLog 3011 SHA256 058457e1fb8574c2ae25b791daa5d888c1a767f01f51b7282dbddf5d63babd17 SHA512 1c8750d03df074e6f61d0e5455bdba8a4c9fae04b3d4fb044272b473f83b67da8da1383923c0b84fa9566c42a21ff78c8a902ba7d49c2e9246763451b80a5931 WHIRLPOOL 5f46d9cc63f17f11a066d81daa05a018fcc1739810483bb06a7911651881fc616273fb67becc4e02d65577152ed4e2bb066783b06fdfe822317301e88c5659e2
+MISC ChangeLog-2015 15156 SHA256 5f2e2d2f1d1dda461f4b12d8cfa1920f15797a416efdddb0b222aabfe3ffda39 SHA512 4e313513cddd220829c8e8673931c92cb4c8e41c8b4808ce0327f377d736c3fa3ab70297329efe00f00c1470538ac32370ec1a65ea52182b9d48ca20a5621634 WHIRLPOOL 07c5ccf84add54bc2f80dcb019653624cb612cdc8c826a42353775fceb110699d8d9d72f7e2fb39ec1023b2164e954fd6ba701445bc904e3f0a802f620bc2775
+MISC metadata.xml 500 SHA256 2c4b5322388d0950b94c4380103811b3a934c0e00fbbe6d885606c26c916658e SHA512 1f304a2fd92fe512a70e104c02fb72c9518e4f9e6eed795aa6462eb06a26f314673b9964b8c576a07f11e64eea0031ad607070bc1c167d5058d5ef34f867e383 WHIRLPOOL 560a2908e017ffcadc476c1f1a237edc9363a0ce24b2a15a9afea460320561bf957889fe7388918c2c44a1552ef40a9470be73f316d90dc6589a5d69c6ec637a
diff --git a/media-gfx/xsane/files/xsane-0.999-lcms2.patch b/media-gfx/xsane/files/xsane-0.999-lcms2.patch
new file mode 100644
index 000000000000..c3d696c28ecf
--- /dev/null
+++ b/media-gfx/xsane/files/xsane-0.999-lcms2.patch
@@ -0,0 +1,372 @@
+From 30af0e2edbf061b71bed9536d826894449f0390d Mon Sep 17 00:00:00 2001
+From: Nils Philippsen <nils@redhat.com>
+Date: Mon, 23 Sep 2013 16:11:31 +0200
+Subject: [PATCH] patch: lcms2
+
+Squashed commit of the following:
+
+commit f975accf7e1a08438b63580ea848457d373200f5
+Author: Nils Philippsen <nils@redhat.com>
+Date: Mon Sep 23 14:53:45 2013 +0200
+
+ Add support for lcms 2.x.
+---
+ configure.in | 22 ++++++++++++++----
+ include/config.h.in | 8 ++++++-
+ src/xsane-preview.c | 6 +++--
+ src/xsane-save.c | 38 ++++++++++++++++++++++++++-----
+ src/xsane-viewer.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++---
+ src/xsane.h | 8 ++++++-
+ 6 files changed, 130 insertions(+), 17 deletions(-)
+
+diff --git a/configure.in b/configure.in
+index df7b114..3659c97 100644
+--- a/configure.in
++++ b/configure.in
+@@ -130,7 +130,17 @@ if test "${USE_TIFF}" = "yes"; then
+ fi
+
+ if test "${USE_LCMS}" = "yes"; then
+- AC_CHECK_LIB(lcms, cmsOpenProfileFromFile)
++ AC_SEARCH_LIBS(cmsOpenProfileFromFile, [lcms2 lcms])
++ if test "${ac_cv_search_cmsOpenProfileFromFile}" != "no"; then
++ AC_DEFINE(HAVE_LIBLCMS, 1, [Define if LCMS is to be used.])
++ fi
++ if test "${ac_cv_search_cmsOpenProfileFromFile}" == "-llcms2"; then
++ AC_DEFINE(HAVE_LIBLCMS2, 1, [Define if you have liblcms2.])
++ else
++ if test "${ac_cv_search_cmsOpenProfileFromFile}" == "-llcms"; then
++ AC_DEFINE(HAVE_LIBLCMS1, 1, [Define if you have liblcms.])
++ fi
++ fi
+ fi
+
+ dnl Checks for library functions.
+@@ -294,10 +304,14 @@ else
+ echo "* - PNG support deactivated *"
+ fi
+
+-if test "${ac_cv_lib_lcms_cmsOpenProfileFromFile}" = "yes"; then
+- echo "* - LCMS (color management) support activated *"
++if test "${ac_cv_search_cmsOpenProfileFromFile}" = "-llcms2"; then
++ echo "* - LCMS (color management) support activated (lcms2) *"
+ else
+- echo "* - LCMS (color management) support deactivated *"
++ if test "${ac_cv_search_cmsOpenProfileFromFile}" = "-llcms"; then
++ echo "* - LCMS (color management) support activated (lcms) *"
++ else
++ echo "* - LCMS (color management) support deactivated *"
++ fi
+ fi
+
+ echo "* *"
+diff --git a/include/config.h.in b/include/config.h.in
+index ecc9637..f9a3e40 100755
+--- a/include/config.h.in
++++ b/include/config.h.in
+@@ -290,9 +290,15 @@
+ /* Define if you have libtiff. */
+ #undef HAVE_LIBTIFF
+
+-/* Define if you have liblcms. */
++/* Define if LCMS is to be used. */
+ #undef HAVE_LIBLCMS
+
++/* Define if you have liblcms. */
++#undef HAVE_LIBLCMS1
++
++/* Define if you have liblcms2. */
++#undef HAVE_LIBLCMS2
++
+ #ifndef HAVE_STRNCASECMP
+ /* OS/2 needs this */
+ # define strncasecmp(a, b, c) strnicmp(a, b, c)
+diff --git a/src/xsane-preview.c b/src/xsane-preview.c
+index 6327ca7..6eaf687 100644
+--- a/src/xsane-preview.c
++++ b/src/xsane-preview.c
+@@ -6346,8 +6346,8 @@ int preview_do_color_correction(Preview *p)
+ cmsHPROFILE hOutProfile = NULL;
+ cmsHPROFILE hProofProfile = NULL;
+ cmsHTRANSFORM hTransform = NULL;
+- DWORD input_format, output_format;
+- DWORD cms_flags = 0;
++ cmsUInt32Number input_format, output_format;
++ cmsUInt32Number cms_flags = 0;
+ int proof = 0;
+ char *cms_proof_icm_profile = NULL;
+ int linesize = 0;
+@@ -6355,7 +6355,9 @@ int preview_do_color_correction(Preview *p)
+
+ DBG(DBG_proc, "preview_do_color_correction\n");
+
++#ifdef HAVE_LIBLCMS1
+ cmsErrorAction(LCMS_ERROR_SHOW);
++#endif
+
+ if (preferences.cms_bpc)
+ {
+diff --git a/src/xsane-save.c b/src/xsane-save.c
+index 75e0a63..2d0e44b 100644
+--- a/src/xsane-save.c
++++ b/src/xsane-save.c
+@@ -832,9 +832,9 @@ cmsHTRANSFORM xsane_create_cms_transform(Image_info *image_info, int cms_functio
+ cmsHPROFILE hInProfile = NULL;
+ cmsHPROFILE hOutProfile = NULL;
+ cmsHTRANSFORM hTransform = NULL;
+- DWORD cms_input_format;
+- DWORD cms_output_format;
+- DWORD cms_flags = 0;
++ cmsUInt32Number cms_input_format;
++ cmsUInt32Number cms_output_format;
++ cmsUInt32Number cms_flags = 0;
+
+ if (cms_function == XSANE_CMS_FUNCTION_EMBED_SCANNER_ICM_PROFILE)
+ {
+@@ -843,7 +843,9 @@ cmsHTRANSFORM xsane_create_cms_transform(Image_info *image_info, int cms_functio
+
+ DBG(DBG_info, "Prepare CMS transform\n");
+
++#ifdef HAVE_LIBLCMS1
+ cmsErrorAction(LCMS_ERROR_SHOW);
++#endif
+
+ if (cms_bpc)
+ {
+@@ -890,10 +892,18 @@ cmsHTRANSFORM xsane_create_cms_transform(Image_info *image_info, int cms_functio
+ if (image_info->channels == 1) /* == 1 (grayscale) */
+ {
+ #if 1 /* xxx oli */
++# ifdef HAVE_LIBLCMS2
++ cmsToneCurve *Gamma = cmsBuildGamma(NULL, 2.2);
++# else
+ LPGAMMATABLE Gamma = cmsBuildGamma(256, 2.2);
++# endif
+
+ hOutProfile = cmsCreateGrayProfile(cmsD50_xyY(), Gamma);
++# ifdef HAVE_LIBLCMS2
++ cmsFreeToneCurve(Gamma);
++# else
+ cmsFreeGamma(Gamma);
++# endif
+ #endif
+ }
+ else
+@@ -2896,7 +2906,11 @@ static int xsane_write_CSA(FILE *outfile, char *input_profile, int intent)
+ return -1;
+ }
+
++#ifdef HAVE_LIBLCMS2
++ n = cmsGetPostScriptCSA(NULL, hProfile, intent, 0, NULL, 0);
++#else
+ n = cmsGetPostScriptCSA(hProfile, intent, NULL, 0);
++#endif
+ if (n == 0)
+ {
+ return -2;
+@@ -2908,7 +2922,11 @@ static int xsane_write_CSA(FILE *outfile, char *input_profile, int intent)
+ return -3;
+ }
+
++#ifdef HAVE_LIBLCMS2
++ cmsGetPostScriptCSA(NULL, hProfile, intent, 0, buffer, n);
++#else
+ cmsGetPostScriptCSA(hProfile, intent, buffer, n);
++#endif
+ buffer[n] = 0;
+
+ fprintf(outfile, "%s", buffer);
+@@ -2927,7 +2945,7 @@ static int xsane_write_CRD(FILE *outfile, char *output_profile, int intent, int
+ cmsHPROFILE hProfile;
+ size_t n;
+ char* buffer;
+- DWORD flags = cmsFLAGS_NODEFAULTRESOURCEDEF;
++ cmsUInt32Number flags = cmsFLAGS_NODEFAULTRESOURCEDEF;
+
+ hProfile = cmsOpenProfileFromFile(output_profile, "r");
+ if (!hProfile)
+@@ -2940,7 +2958,11 @@ static int xsane_write_CRD(FILE *outfile, char *output_profile, int intent, int
+ flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
+ }
+
++#ifdef HAVE_LIBLCMS2
++ n = cmsGetPostScriptCRD(NULL, hProfile, intent, flags, NULL, 0);
++#else
+ n = cmsGetPostScriptCRDEx(hProfile, intent, flags, NULL, 0);
++#endif
+ if (n == 0)
+ {
+ return -2;
+@@ -2952,7 +2974,11 @@ static int xsane_write_CRD(FILE *outfile, char *output_profile, int intent, int
+ return -3;
+ }
+
++#ifdef HAVE_LIBLCMS2
++ cmsGetPostScriptCRD(NULL, hProfile, intent, flags, buffer, n);
++#else
+ cmsGetPostScriptCRDEx(hProfile, intent, flags, buffer, n);
++#endif
+ buffer[n] = 0;
+
+ fprintf(outfile, "%s", buffer);
+@@ -4349,7 +4375,7 @@ static void xsane_jpeg_embed_scanner_icm_profile(j_compress_ptr cinfo_ptr, const
+ {
+ FILE *icm_profile;
+ size_t size, embed_len;
+- LPBYTE embed_buffer;
++ cmsUInt8Number *embed_buffer;
+
+ DBG(DBG_proc, "xsane_jpeg_embed_scanner_icm_profile(%s)\n", icm_filename);
+
+@@ -4363,7 +4389,7 @@ static void xsane_jpeg_embed_scanner_icm_profile(j_compress_ptr cinfo_ptr, const
+ size = ftell(icm_profile);
+ fseek(icm_profile, 0, SEEK_SET);
+
+- embed_buffer = (LPBYTE) malloc(size + 1);
++ embed_buffer = (cmsUInt8Number *) malloc(size + 1);
+ if (embed_buffer)
+ {
+ embed_len = fread(embed_buffer, 1, size, icm_profile);
+diff --git a/src/xsane-viewer.c b/src/xsane-viewer.c
+index 69a444d..844c077 100644
+--- a/src/xsane-viewer.c
++++ b/src/xsane-viewer.c
+@@ -1795,6 +1795,9 @@ static void xsane_viewer_set_cms_gamut_alarm_color_callback(GtkWidget *widget, g
+ {
+ Viewer *v = (Viewer *) data;
+ int val;
++#ifdef HAVE_LIBLCMS2
++ cmsUInt16Number alarm_codes[cmsMAXCHANNELS];
++#endif
+
+ g_signal_handlers_block_by_func(GTK_OBJECT(v->cms_gamut_alarm_color_widget[0]), (GtkSignalFunc) xsane_viewer_set_cms_gamut_alarm_color_callback, v);
+ g_signal_handlers_block_by_func(GTK_OBJECT(v->cms_gamut_alarm_color_widget[1]), (GtkSignalFunc) xsane_viewer_set_cms_gamut_alarm_color_callback, v);
+@@ -1811,6 +1814,49 @@ static void xsane_viewer_set_cms_gamut_alarm_color_callback(GtkWidget *widget, g
+ v->cms_gamut_alarm_color = val;
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(v->cms_gamut_alarm_color_widget[v->cms_gamut_alarm_color]), TRUE);
+
++#ifdef HAVE_LIBLCMS2
++ switch(v->cms_gamut_alarm_color)
++ {
++ default:
++ case 0: /* black */
++ alarm_codes[0] = (cmsUInt16Number) 0;
++ alarm_codes[1] = (cmsUInt16Number) 0;
++ alarm_codes[2] = (cmsUInt16Number) 0;
++ break;
++
++ case 1: /* gray */
++ alarm_codes[0] = (cmsUInt16Number) 128;
++ alarm_codes[1] = (cmsUInt16Number) 128;
++ alarm_codes[2] = (cmsUInt16Number) 128;
++ break;
++
++ case 2: /* white */
++ alarm_codes[0] = (cmsUInt16Number) 255;
++ alarm_codes[1] = (cmsUInt16Number) 255;
++ alarm_codes[2] = (cmsUInt16Number) 255;
++ break;
++
++ case 3: /* red */
++ alarm_codes[0] = (cmsUInt16Number) 255;
++ alarm_codes[1] = (cmsUInt16Number) 0;
++ alarm_codes[2] = (cmsUInt16Number) 0;
++ break;
++
++ case 4: /* green */
++ alarm_codes[0] = (cmsUInt16Number) 0;
++ alarm_codes[1] = (cmsUInt16Number) 255;
++ alarm_codes[2] = (cmsUInt16Number) 0;
++ break;
++
++ case 5: /* blue */
++ alarm_codes[0] = (cmsUInt16Number) 0;
++ alarm_codes[1] = (cmsUInt16Number) 0;
++ alarm_codes[2] = (cmsUInt16Number) 255;
++ break;
++ }
++
++ cmsSetAlarmCodes(alarm_codes);
++#else
+ switch(v->cms_gamut_alarm_color)
+ {
+ default:
+@@ -1838,6 +1884,7 @@ static void xsane_viewer_set_cms_gamut_alarm_color_callback(GtkWidget *widget, g
+ cmsSetAlarmCodes(0, 0, 255);
+ break;
+ }
++#endif
+
+ g_signal_handlers_unblock_by_func(GTK_OBJECT(v->cms_gamut_alarm_color_widget[0]), (GtkSignalFunc) xsane_viewer_set_cms_gamut_alarm_color_callback, v);
+ g_signal_handlers_unblock_by_func(GTK_OBJECT(v->cms_gamut_alarm_color_widget[1]), (GtkSignalFunc) xsane_viewer_set_cms_gamut_alarm_color_callback, v);
+@@ -2172,9 +2219,9 @@ static int xsane_viewer_read_image(Viewer *v)
+ cmsHTRANSFORM hTransform = NULL;
+ int proof = 0;
+ char *cms_proof_icm_profile = NULL;
+- DWORD cms_input_format;
+- DWORD cms_output_format;
+- DWORD cms_flags = 0;
++ cmsUInt32Number cms_input_format;
++ cmsUInt32Number cms_output_format;
++ cmsUInt32Number cms_flags = 0;
+ #endif
+
+ /* open imagefile */
+@@ -2203,7 +2250,9 @@ static int xsane_viewer_read_image(Viewer *v)
+
+ if ((v->enable_color_management) && (v->cms_enable))
+ {
++#ifdef HAVE_LIBLCMS1
+ cmsErrorAction(LCMS_ERROR_SHOW);
++#endif
+
+ if (v->cms_bpc)
+ {
+@@ -2801,6 +2850,9 @@ Viewer *xsane_viewer_new(char *filename, char *selection_filetype, int allow_red
+ GtkWidget *scrolled_window;
+ GtkWidget *zoom_option_menu, *zoom_menu, *zoom_menu_item;
+ int i, selection;
++#ifdef HAVE_LIBLCMS2
++ cmsUInt16Number alarm_codes[cmsMAXCHANNELS];
++#endif
+
+ DBG(DBG_proc, "viewer_new(%s)\n", filename);
+
+@@ -2830,8 +2882,15 @@ Viewer *xsane_viewer_new(char *filename, char *selection_filetype, int allow_red
+ v->cms_proofing_intent = INTENT_ABSOLUTE_COLORIMETRIC;
+ v->cms_gamut_check = 0;
+ v->cms_gamut_alarm_color = 3; /* red */
++#ifdef HAVE_LIBLCMS2
++ alarm_codes[0] = (cmsUInt16Number) 255;
++ alarm_codes[1] = (cmsUInt16Number) 0;
++ alarm_codes[2] = (cmsUInt16Number) 0;
++ cmsSetAlarmCodes(alarm_codes);
++#else
+ cmsSetAlarmCodes(255, 0, 0);
+ #endif
++#endif
+ if (selection_filetype)
+ {
+ v->selection_filetype = strdup(selection_filetype);
+diff --git a/src/xsane.h b/src/xsane.h
+index 4067d61..adcc0ed 100644
+--- a/src/xsane.h
++++ b/src/xsane.h
+@@ -70,7 +70,13 @@
+ #include <gtk/gtk.h>
+
+ #ifdef HAVE_LIBLCMS
+-# include "lcms.h"
++# ifdef HAVE_LIBLCMS2
++# include "lcms2.h"
++# else
++# include "lcms.h"
++typedef BYTE cmsUInt8Number;
++typedef DWORD cmsUInt32Number;
++# endif
+ #else
+ # define cmsHTRANSFORM void *
+ #endif
+--
+1.8.3.1
+
diff --git a/media-gfx/xsane/metadata.xml b/media-gfx/xsane/metadata.xml
new file mode 100644
index 000000000000..83d97d0e07f2
--- /dev/null
+++ b/media-gfx/xsane/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+ <email>printing@gentoo.org</email>
+ <name>Gentoo Printing Project</name>
+</maintainer>
+<maintainer type="project">
+ <email>graphics@gentoo.org</email>
+ <name>Gentoo Graphics Project</name>
+</maintainer>
+<use>
+ <flag name="ocr">Enable support for Optical Character Recognition reader</flag>
+</use>
+</pkgmetadata>
diff --git a/media-gfx/xsane/xsane-0.999-r2.ebuild b/media-gfx/xsane/xsane-0.999-r2.ebuild
new file mode 100644
index 000000000000..65a365cff251
--- /dev/null
+++ b/media-gfx/xsane/xsane-0.999-r2.ebuild
@@ -0,0 +1,91 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit autotools eutils toolchain-funcs
+
+DESCRIPTION="graphical scanning frontend"
+HOMEPAGE="http://www.xsane.org/"
+SRC_URI="
+ http://www.xsane.org/download/${P}.tar.gz
+ https://dev.gentoo.org/~dilfridge/distfiles/${PN}-0.998-patches-2.tar.xz
+ https://dev.gentoo.org/~pacho/${PN}/${PN}-256x256.png
+"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ppc ppc64 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos"
+IUSE="nls jpeg png tiff gimp lcms ocr"
+
+RDEPEND="
+ media-gfx/sane-backends
+ x11-libs/gtk+:2
+ x11-misc/xdg-utils
+ jpeg? ( virtual/jpeg:0 )
+ png? ( media-libs/libpng:0= )
+ tiff? ( media-libs/tiff:0 )
+ gimp? ( media-gfx/gimp )
+ lcms? ( media-libs/lcms:2 )
+"
+PDEPEND="ocr? ( app-text/gocr )"
+
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+"
+
+src_prepare() {
+ default
+
+ strip-linguas -i po/ #609672
+
+ # Apply multiple fixes from different distributions
+ # Drop included patch and reuse patchset from prior version
+ rm "${WORKDIR}/${PN}-0.998-patches-2"/005-update-param-crash.patch || die
+ epatch "${WORKDIR}/${PN}-0.998-patches-2"/*.patch
+
+ # Fix compability with libpng15 wrt #377363
+ sed -i -e 's:png_ptr->jmpbuf:png_jmpbuf(png_ptr):' src/xsane-save.c || die
+
+ # Fix AR calling directly (bug #442606)
+ sed -i -e 's:ar r:$(AR) r:' lib/Makefile.in || die
+ tc-export AR
+
+ # Add support for lcms-2 (from Fedora)
+ eapply "${FILESDIR}/${PN}-0.999-lcms2.patch"
+
+ mv configure.in configure.ac || die
+ AT_M4DIR="m4" eautoreconf
+}
+
+src_configure() {
+ econf \
+ --enable-gtk2 \
+ $(use_enable nls) \
+ $(use_enable jpeg) \
+ $(use_enable png) \
+ $(use_enable tiff) \
+ $(use_enable gimp) \
+ $(use_enable lcms)
+}
+
+src_install() {
+ default
+
+ dodoc xsane.*
+
+ # link xsane so it is seen as a plugin in gimp
+ if use gimp; then
+ local plugindir
+ if [ -x "${EPREFIX}"/usr/bin/gimptool ]; then
+ plugindir="$(gimptool --gimpplugindir)/plug-ins"
+ elif [ -x "${EPREFIX}"/usr/bin/gimptool-2.0 ]; then
+ plugindir="$(gimptool-2.0 --gimpplugindir)/plug-ins"
+ else
+ die "Can't find GIMP plugin directory."
+ fi
+ dodir "${plugindir#${EPREFIX}}"
+ dosym /usr/bin/xsane "${plugindir#${EPREFIX}}"/xsane
+ fi
+
+ newicon "${DISTDIR}/${PN}-256x256.png" "${PN}".png
+}