media-gfx/dcraw: Fix compat with newer gimp

Thanks-to: Helmut Jarausch
Closes: https://bugs.gentoo.org/655390
Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Pacho Ramos <pacho@gentoo.org>
This commit is contained in:
Pacho Ramos
2019-04-10 22:10:40 +02:00
parent b4efe64b25
commit dc4414d63d
2 changed files with 142 additions and 0 deletions
+115
View File
@@ -0,0 +1,115 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit readme.gentoo-r1 toolchain-funcs
DESCRIPTION="Command-line decoder for raw digital photos"
HOMEPAGE="https://www.cybercom.net/~dcoffin/dcraw/"
SRC_URI="https://www.cybercom.net/~dcoffin/dcraw/archive/${P}.tar.gz
mirror://gentoo/parse-1.73.tar.bz2
gimp? ( mirror://gentoo/rawphoto-1.32.tar.bz2 )"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~x86-solaris"
LANGS=" ca cs de da eo es fr hu it nl pl pt ru sv zh_CN zh_TW"
IUSE="nls gimp jpeg jpeg2k lcms"
COMMON_DEPEND="
jpeg? ( virtual/jpeg:0 )
lcms? ( media-libs/lcms:2 )
jpeg2k? ( media-libs/jasper:= )
gimp? ( media-gfx/gimp )
"
DEPEND="${COMMON_DEPEND}
nls? ( sys-devel/gettext )
gimp? ( virtual/pkgconfig )
"
RDEPEND="${COMMON_DEPEND}
media-libs/netpbm
"
S="${WORKDIR}/dcraw"
DOC_CONTENTS="
See conversion-examples.txt.gz on how to convert
the PPM files produced by dcraw to other image formats.\n
\nThe functionality of the external program 'fujiturn' was
incorporated into dcraw and is automatically used now.\n
\nThere's an example wrapper script included called 'dcwrap'.
This package also includes 'dcparse', which extracts
thumbnail images (preferably JPEGs) from any raw digital
camera formats that have them, and shows table contents.
"
PATCHES=(
# Support gimp-2.10, bug #655390
"${FILESDIR}"/${PN}-9.28.0-gimp-2.10.patch
)
run_build() {
einfo "${@}"
${@} || die
}
src_prepare() {
default
rename dcraw_ dcraw. dcraw_*.1 || die "Failed to rename"
}
src_compile() {
local ECFLAGS="-O2" # Without optimisation build fails
local ELIBS="-lm"
use lcms && ELIBS="-llcms2 ${ELIBS}" || ECFLAGS+=" -DNO_LCMS=yes"
use jpeg && ELIBS="-ljpeg ${ELIBS}" || ECFLAGS+=" -DNO_JPEG=yes"
use jpeg2k && ELIBS="-ljasper ${ELIBS}" || ECFLAGS+=" -DNO_JASPER=yes"
use nls && ECFLAGS+=" -DLOCALEDIR=\"/usr/share/locale/\""
run_build $(tc-getCC) ${ECFLAGS} ${CFLAGS} ${LDFLAGS} -o dcraw dcraw.c ${ELIBS}
run_build $(tc-getCC) -O2 ${CFLAGS} ${LDFLAGS} -o dcparse parse.c
# rawphoto gimp plugin
if use gimp; then
run_build $(tc-getCC) ${CFLAGS} ${LDFLAGS} \
$(pkg-config --cflags gimpui-2.0) rawphoto.c -o rawphoto \
$(pkg-config --libs gimpui-2.0)
fi
if use nls; then
for lang in ${LANGS}; do
has ${lang} ${LINGUAS-${lang}} \
&& run_build msgfmt -c -o dcraw_${lang}.mo dcraw_${lang}.po
done
fi
}
src_install() {
dobin dcraw dcparse
dodoc "${FILESDIR}"/{conversion-examples.txt,dcwrap}
# rawphoto gimp plugin
if use gimp; then
insinto "$(pkg-config --variable=gimplibdir gimp-2.0)/plug-ins"
insopts -m0755
doins rawphoto
fi
doman dcraw.1
if use nls; then
for lang in ${LANGS}; do
if has ${lang} ${LINGUAS-${lang}}; then
[[ -f dcraw.${lang}.1 ]] && doman dcraw.${lang}.1
insinto /usr/share/locale/${lang}/LC_MESSAGES
newins dcraw_${lang}.mo dcraw.mo || die "failed to install dcraw_${lang}.mo"
fi
done
fi
readme.gentoo_create_doc
}
@@ -0,0 +1,27 @@
--- a/rawphoto.c.ORIG 2018-05-10 14:06:37.553419235 +0200
+++ b/rawphoto.c 2018-05-10 14:06:37.553419235 +0200
@@ -105,8 +105,15 @@
load_args,
load_return_vals);
+#if HAVE_GIMP_2_9
+ gimp_register_magic_load_handler ("file_rawphoto_load",
+ "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",
+ "","0,string,II*\\0,0,string,MM\\0*,0,string,<?xml");
+ gimp_register_file_handler_raw ("file_rawphoto_load");
+#else
gimp_register_load_handler ("file_rawphoto_load",
"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", "");
+#endif
}
static void run (RAWPHOTO_CONST gchar *name,
@@ -225,7 +232,7 @@
layer = gimp_layer_new (image, "Background", width, height,
depth == 3 ? GIMP_RGB_IMAGE : GIMP_GRAY_IMAGE,
100, GIMP_NORMAL_MODE);
- gimp_image_add_layer (image, layer, 0);
+ gimp_image_insert_layer(image, layer, 0, 0);
/* Get the drawable and set the pixel region for our load... */
drawable = gimp_drawable_get (layer);