Gentoo Archives: gentoo-commits

From: Pacho Ramos <pacho@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-gfx/dcraw/, media-gfx/dcraw/files/
Date: Wed, 10 Apr 2019 20:11:01
Message-Id: 1554927040.dc4414d63dc4427f8d3a87a0fccb93ce72d5bcba.pacho@gentoo
1 commit: dc4414d63dc4427f8d3a87a0fccb93ce72d5bcba
2 Author: Pacho Ramos <pacho <AT> gentoo <DOT> org>
3 AuthorDate: Wed Apr 10 20:10:40 2019 +0000
4 Commit: Pacho Ramos <pacho <AT> gentoo <DOT> org>
5 CommitDate: Wed Apr 10 20:10:40 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dc4414d6
7
8 media-gfx/dcraw: Fix compat with newer gimp
9
10 Thanks-to: Helmut Jarausch
11 Closes: https://bugs.gentoo.org/655390
12 Package-Manager: Portage-2.3.62, Repoman-2.3.12
13 Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org>
14
15 media-gfx/dcraw/dcraw-9.28.0-r1.ebuild | 115 +++++++++++++++++++++
16 media-gfx/dcraw/files/dcraw-9.28.0-gimp-2.10.patch | 27 +++++
17 2 files changed, 142 insertions(+)
18
19 diff --git a/media-gfx/dcraw/dcraw-9.28.0-r1.ebuild b/media-gfx/dcraw/dcraw-9.28.0-r1.ebuild
20 new file mode 100644
21 index 00000000000..dbd2794f170
22 --- /dev/null
23 +++ b/media-gfx/dcraw/dcraw-9.28.0-r1.ebuild
24 @@ -0,0 +1,115 @@
25 +# Copyright 1999-2019 Gentoo Authors
26 +# Distributed under the terms of the GNU General Public License v2
27 +
28 +EAPI=7
29 +inherit readme.gentoo-r1 toolchain-funcs
30 +
31 +DESCRIPTION="Command-line decoder for raw digital photos"
32 +HOMEPAGE="https://www.cybercom.net/~dcoffin/dcraw/"
33 +SRC_URI="https://www.cybercom.net/~dcoffin/dcraw/archive/${P}.tar.gz
34 + mirror://gentoo/parse-1.73.tar.bz2
35 + gimp? ( mirror://gentoo/rawphoto-1.32.tar.bz2 )"
36 +
37 +LICENSE="GPL-2"
38 +SLOT="0"
39 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~x86-solaris"
40 +LANGS=" ca cs de da eo es fr hu it nl pl pt ru sv zh_CN zh_TW"
41 +IUSE="nls gimp jpeg jpeg2k lcms"
42 +
43 +COMMON_DEPEND="
44 + jpeg? ( virtual/jpeg:0 )
45 + lcms? ( media-libs/lcms:2 )
46 + jpeg2k? ( media-libs/jasper:= )
47 + gimp? ( media-gfx/gimp )
48 +"
49 +DEPEND="${COMMON_DEPEND}
50 + nls? ( sys-devel/gettext )
51 + gimp? ( virtual/pkgconfig )
52 +"
53 +RDEPEND="${COMMON_DEPEND}
54 + media-libs/netpbm
55 +"
56 +
57 +S="${WORKDIR}/dcraw"
58 +
59 +DOC_CONTENTS="
60 + See conversion-examples.txt.gz on how to convert
61 + the PPM files produced by dcraw to other image formats.\n
62 +
63 + \nThe functionality of the external program 'fujiturn' was
64 + incorporated into dcraw and is automatically used now.\n
65 +
66 + \nThere's an example wrapper script included called 'dcwrap'.
67 + This package also includes 'dcparse', which extracts
68 + thumbnail images (preferably JPEGs) from any raw digital
69 + camera formats that have them, and shows table contents.
70 +"
71 +
72 +PATCHES=(
73 + # Support gimp-2.10, bug #655390
74 + "${FILESDIR}"/${PN}-9.28.0-gimp-2.10.patch
75 +)
76 +
77 +run_build() {
78 + einfo "${@}"
79 + ${@} || die
80 +}
81 +
82 +src_prepare() {
83 + default
84 + rename dcraw_ dcraw. dcraw_*.1 || die "Failed to rename"
85 +}
86 +
87 +src_compile() {
88 + local ECFLAGS="-O2" # Without optimisation build fails
89 + local ELIBS="-lm"
90 +
91 + use lcms && ELIBS="-llcms2 ${ELIBS}" || ECFLAGS+=" -DNO_LCMS=yes"
92 + use jpeg && ELIBS="-ljpeg ${ELIBS}" || ECFLAGS+=" -DNO_JPEG=yes"
93 + use jpeg2k && ELIBS="-ljasper ${ELIBS}" || ECFLAGS+=" -DNO_JASPER=yes"
94 + use nls && ECFLAGS+=" -DLOCALEDIR=\"/usr/share/locale/\""
95 +
96 + run_build $(tc-getCC) ${ECFLAGS} ${CFLAGS} ${LDFLAGS} -o dcraw dcraw.c ${ELIBS}
97 +
98 + run_build $(tc-getCC) -O2 ${CFLAGS} ${LDFLAGS} -o dcparse parse.c
99 +
100 + # rawphoto gimp plugin
101 + if use gimp; then
102 + run_build $(tc-getCC) ${CFLAGS} ${LDFLAGS} \
103 + $(pkg-config --cflags gimpui-2.0) rawphoto.c -o rawphoto \
104 + $(pkg-config --libs gimpui-2.0)
105 + fi
106 +
107 + if use nls; then
108 + for lang in ${LANGS}; do
109 + has ${lang} ${LINGUAS-${lang}} \
110 + && run_build msgfmt -c -o dcraw_${lang}.mo dcraw_${lang}.po
111 + done
112 + fi
113 +}
114 +
115 +src_install() {
116 + dobin dcraw dcparse
117 + dodoc "${FILESDIR}"/{conversion-examples.txt,dcwrap}
118 +
119 + # rawphoto gimp plugin
120 + if use gimp; then
121 + insinto "$(pkg-config --variable=gimplibdir gimp-2.0)/plug-ins"
122 + insopts -m0755
123 + doins rawphoto
124 + fi
125 +
126 + doman dcraw.1
127 +
128 + if use nls; then
129 + for lang in ${LANGS}; do
130 + if has ${lang} ${LINGUAS-${lang}}; then
131 + [[ -f dcraw.${lang}.1 ]] && doman dcraw.${lang}.1
132 + insinto /usr/share/locale/${lang}/LC_MESSAGES
133 + newins dcraw_${lang}.mo dcraw.mo || die "failed to install dcraw_${lang}.mo"
134 + fi
135 + done
136 + fi
137 +
138 + readme.gentoo_create_doc
139 +}
140
141 diff --git a/media-gfx/dcraw/files/dcraw-9.28.0-gimp-2.10.patch b/media-gfx/dcraw/files/dcraw-9.28.0-gimp-2.10.patch
142 new file mode 100644
143 index 00000000000..f590243a986
144 --- /dev/null
145 +++ b/media-gfx/dcraw/files/dcraw-9.28.0-gimp-2.10.patch
146 @@ -0,0 +1,27 @@
147 +--- a/rawphoto.c.ORIG 2018-05-10 14:06:37.553419235 +0200
148 ++++ b/rawphoto.c 2018-05-10 14:06:37.553419235 +0200
149 +@@ -105,8 +105,15 @@
150 + load_args,
151 + load_return_vals);
152 +
153 ++#if HAVE_GIMP_2_9
154 ++ gimp_register_magic_load_handler ("file_rawphoto_load",
155 ++ "3fr,arw,bay,bmq,cine,cr2,crw,cs1,dc2,dcr,dng,erf,fff,hdr,ia,jpg,k25,kc2,kdc,mdc,mef,mos,mrw,nef,nrw,orf,pef,pxn,qtk,raf,raw,rdc,rw2,sr2,srf,sti,tif,x3f",
156 ++ "","0,string,II*\\0,0,string,MM\\0*,0,string,<?xml");
157 ++ gimp_register_file_handler_raw ("file_rawphoto_load");
158 ++#else
159 + gimp_register_load_handler ("file_rawphoto_load",
160 + "3fr,arw,bay,bmq,cine,cr2,crw,cs1,dc2,dcr,dng,erf,fff,hdr,ia,jpg,k25,kc2,kdc,mdc,mef,mos,mrw,nef,nrw,orf,pef,pxn,qtk,raf,raw,rdc,rw2,sr2,srf,sti,tif,x3f", "");
161 ++#endif
162 + }
163 +
164 + static void run (RAWPHOTO_CONST gchar *name,
165 +@@ -225,7 +232,7 @@
166 + layer = gimp_layer_new (image, "Background", width, height,
167 + depth == 3 ? GIMP_RGB_IMAGE : GIMP_GRAY_IMAGE,
168 + 100, GIMP_NORMAL_MODE);
169 +- gimp_image_add_layer (image, layer, 0);
170 ++ gimp_image_insert_layer(image, layer, 0, 0);
171 +
172 + /* Get the drawable and set the pixel region for our load... */
173 + drawable = gimp_drawable_get (layer);