app-arch/dpkg: Fix building against >=media-gfx/imagemagick-7 (bug #619456).

Package-Manager: Portage-2.3.6, Repoman-2.3.2
This commit is contained in:
Jeroen Roovers
2017-05-25 15:31:32 +02:00
parent de9efb7171
commit e7f3bbcdda
2 changed files with 307 additions and 0 deletions

View File

@@ -0,0 +1,178 @@
--- a/configure.in
+++ b/configure.in
@@ -38,6 +38,8 @@
AC_PROG_LIBTOOL
AC_PROG_LN_S
+PKG_PROG_PKG_CONFIG
+
# Checks for libraries.
AC_CHECK_LIB([m], [pow],,AC_MSG_ERROR(-lm was not found but required.))
@@ -81,7 +83,15 @@
AC_CHECK_FUNCS(random_r nrand48)
# Check for ImageMagick.
-PKG_CHECK_MODULES(Wand, Wand >= 6.4)
+PKG_CHECK_MODULES(Wand, [Wand >= 6.4],,
+ [PKG_CHECK_MODULES(Wand, MagickWand >= 6.4)]
+)
+
+old_CPPFLAGS="$CPPFLAGS"; CPPFLAGS="$Wand_CFLAGS"
+AC_CHECK_HEADERS([magick/api.h] [wand/magick-wand.h],,
+ AC_CHECK_HEADERS([MagickCore/MagickCore.h] [MagickWand/MagickWand.h])
+)
+CPPFLAGS="$old_CPPFLAGS"
if test -d src/skyrocket_sounds ; then
AC_ARG_ENABLE(sound, [ --disable-sound Don't compile with sound.])
--- a/src/TexMgr.cpp
+++ b/src/TexMgr.cpp
@@ -25,8 +25,19 @@
#endif
#include <cstdlib>
+#ifdef HAVE_MAGICK_API_H
+#ifdef HAVE_WAND_MAGICK_WAND_H
#include <magick/api.h>
#include <wand/magick-wand.h>
+#endif /* HAVE_WAND_MAGICK_WAND_H */
+#endif /* HAVE_MAGICK_API_H */
+#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
+#ifdef HAVE_MAGICKWAND_MAGICKWAND_H
+#include <MagickCore/MagickCore.h>
+#include <MagickWand/MagickWand.h>
+#endif /* HAVE_MAGICKWAND_MAGICKWAND_H */
+#endif /* HAVE_MAGICKCORE_MAGICKCORE_H */
+
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -255,10 +266,18 @@
// Directory scanning + image loading code in a separate function callable either from loadNextImage or another thread if pthreads is available.
void TexMgr::loadNextImageFromDisk() {
MagickWand *magick_wand = NewMagickWand();
+#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
+ ExceptionInfo *exception;
+#else
ExceptionInfo exception;
+#endif
int dirLoop = 0;
+#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
+ exception = AcquireExceptionInfo ();
+#else
GetExceptionInfo (&exception);
+#endif
int imageLoaded = 0;
do {
@@ -317,7 +336,11 @@
nextH = ohh;
}
+#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
+ ExportImagePixels (GetImageFromMagickWand(magick_wand), 0, 0, oww, ohh, "RGBA", CharPixel, nextTex, exception);
+#else
ExportImagePixels (GetImageFromMagickWand(magick_wand), 0, 0, oww, ohh, "RGBA", CharPixel, nextTex, &exception);
+#endif
magick_wand = DestroyMagickWand (magick_wand);
--- a/src/matrixview.c
+++ b/src/matrixview.c
@@ -84,8 +84,19 @@
float *texcoords;
unsigned char *colors;
+#ifdef HAVE_MAGICK_API_H
+#ifdef HAVE_WAND_MAGICK_WAND_H
#include <magick/api.h>
#include <wand/magick-wand.h>
+#endif /* HAVE_WAND_MAGICK_WAND_H */
+#endif /* HAVE_MAGICK_API_H */
+#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
+#ifdef HAVE_MAGICKWAND_MAGICKWAND_H
+#include <MagickCore/MagickCore.h>
+#include <MagickWand/MagickWand.h>
+#endif /* HAVE_MAGICKWAND_MAGICKWAND_H */
+#endif /* HAVE_MAGICKCORE_MAGICKCORE_H */
+
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -99,10 +110,18 @@
// Directory scanning + image loading code in a separate function callable either from loadNextImage or another thread if pthreads is available.
void loadNextImageFromDisk() {
MagickWand *magick_wand = NewMagickWand();
+#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
+ ExceptionInfo *exception;
+#else
ExceptionInfo exception;
+#endif
int dirLoop = 0;
+#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
+ exception = AcquireExceptionInfo ();
+#else
GetExceptionInfo (&exception);
+#endif
int imageLoaded = 0;
do {
@@ -159,7 +178,11 @@
if (!next_pic)
next_pic = (unsigned char *)malloc (text_x * text_y);
+#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
+ ExportImagePixels (GetImageFromMagickWand(magick_wand), 0, 0, text_x, text_y, "I", CharPixel, next_pic, exception);
+#else
ExportImagePixels (GetImageFromMagickWand(magick_wand), 0, 0, text_x, text_y, "I", CharPixel, next_pic, &exception);
+#endif
magick_wand = DestroyMagickWand (magick_wand);
}
@@ -211,11 +234,19 @@
pthread_cond_signal(next_pic_cond);
}
} else {
+#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
+ ExceptionInfo *exception;
+#else
ExceptionInfo exception;
+#endif
Image *image = NULL, *scaled_image;
ImageInfo *image_info;
+#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
+ exception = AcquireExceptionInfo ();
+#else
GetExceptionInfo (&exception);
+#endif
if (!pics)
LOAD_TEXTURE (pics, cpics, cpics_compressedsize, cpics_size)
@@ -227,6 +258,15 @@
image_info = CloneImageInfo ((ImageInfo *) NULL);
image_info->size = AcquireMagickMemory(sizeof("90x70"));
strcpy(image_info->size, "90x70");
+#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
+ image = AcquireImage(image_info, exception);
+
+ ImportImagePixels(image, 0, 0, 90, 70, "I", CharPixel, (unsigned char *)(pics + ((random () & 15) * (90 * 70))), exception);
+
+ scaled_image = ScaleImage (image, text_x, text_y, exception);
+
+ ExportImagePixels (scaled_image, 0, 0, text_x, text_y, "I", CharPixel, pic, exception);
+#else
image = AcquireImage(image_info);
ImportImagePixels(image, 0, 0, 90, 70, "I", CharPixel, (unsigned char *)(pics + ((random () & 15) * (90 * 70))));
@@ -234,6 +274,7 @@
scaled_image = ScaleImage (image, text_x, text_y, &exception);
ExportImagePixels (scaled_image, 0, 0, text_x, text_y, "I", CharPixel, pic, &exception);
+#endif
DestroyImage (image);
DestroyImage (scaled_image);

View File

@@ -0,0 +1,129 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit autotools eutils multilib
MY_P=${PN}_${PV}
DESCRIPTION="Really Slick OpenGL Screensavers for XScreenSaver"
HOMEPAGE="http://rss-glx.sourceforge.net"
SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.bz2"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~sparc ~x86"
IUSE="+bzip2 openal quesoglc"
RDEPEND="
x11-libs/libX11
x11-libs/libXext
>=media-libs/glew-1.5.1:=
media-libs/mesa
>=media-gfx/imagemagick-6.4:=
>=x11-misc/xscreensaver-5.08-r2
bzip2? ( app-arch/bzip2 )
openal? ( >=media-libs/freealut-1.1.0-r1 )
quesoglc? ( media-libs/quesoglc )
"
DEPEND="
${RDEPEND}
x11-proto/xextproto
virtual/pkgconfig
sys-apps/sed
"
DOCS="ChangeLog README*"
S=${WORKDIR}/${MY_P}
PATCHES=(
"${FILESDIR}"/${P}-quesoglc.patch
"${FILESDIR}"/${P}-asneeded.patch
"${FILESDIR}"/${P}-imagemagick-7.patch
)
src_prepare() {
default
sed -i \
-e '/CFLAGS=/s:-O2:${CFLAGS}:' \
-e '/CXXFLAGS=/s:-O2:${CXXFLAGS}:' \
-e 's|AM_CONFIG_HEADER|AC_CONFIG_HEADERS|g' \
configure.in || die
eautoreconf
}
src_configure() {
econf \
$(use_enable bzip2) \
$(use_enable openal sound) \
$(use_with quesoglc) \
--bindir=/usr/$(get_libdir)/misc/xscreensaver \
--disable-dependency-tracking \
--enable-shared \
--with-configdir=/usr/share/xscreensaver/config
}
pkg_postinst() {
local xssconf="${ROOT}usr/share/X11/app-defaults/XScreenSaver"
if [ -f ${xssconf} ]; then
sed -e '/*programs:/a\
GL: \"Cyclone\" cyclone --root \\n\\\
GL: \"Euphoria\" euphoria --root \\n\\\
GL: \"Fieldlines\" fieldlines --root \\n\\\
GL: \"Flocks\" flocks --root \\n\\\
GL: \"Flux\" flux --root \\n\\\
GL: \"Helios\" helios --root \\n\\\
GL: \"Hyperspace\" hyperspace --root \\n\\\
GL: \"Lattice\" lattice --root \\n\\\
GL: \"Plasma\" plasma --root \\n\\\
GL: \"Pixelcity\" pixelcity --root \\n\\\
GL: \"Skyrocket\" skyrocket --root \\n\\\
GL: \"Solarwinds\" solarwinds --root \\n\\\
GL: \"Colorfire\" colorfire --root \\n\\\
GL: \"Hufos Smoke\" hufo_smoke --root \\n\\\
GL: \"Hufos Tunnel\" hufo_tunnel --root \\n\\\
GL: \"Sundancer2\" sundancer2 --root \\n\\\
GL: \"BioF\" biof --root \\n\\\
GL: \"BusySpheres\" busyspheres --root \\n\\\
GL: \"SpirographX\" spirographx --root \\n\\\
GL: \"MatrixView\" matrixview --root \\n\\\
GL: \"Lorenz\" lorenz --root \\n\\\
GL: \"Drempels\" drempels --root \\n\\\
GL: \"Feedback\" feedback --root \\n\\' \
-i ${xssconf} || die
fi
}
pkg_postrm() {
local xssconf="${ROOT}usr/share/X11/app-defaults/XScreenSaver"
if [ -f ${xssconf} ]; then
sed \
-e '/\"Cyclone\" cyclone/d' \
-e '/\"Euphoria\" euphoria/d' \
-e '/\"Fieldlines\" fieldlines/d' \
-e '/\"Flocks\" flocks/d' \
-e '/\"Flux\" flux/d' \
-e '/\"Helios\" helios/d' \
-e '/\"Hyperspace\" hyperspace/d' \
-e '/\"Lattice\" lattice/d' \
-e '/\"Plasma\" plasma/d' \
-e '/\"Pixelcity\" pixelcity/d' \
-e '/\"Skyrocket\" skyrocket/d' \
-e '/\"Solarwinds\" solarwinds/d' \
-e '/\"Colorfire\" colorfire/d' \
-e '/\"Hufos Smoke\" hufo_smoke/d' \
-e '/\"Hufos Tunnel\" hufo_tunnel/d' \
-e '/\"Sundancer2\" sundancer2/d' \
-e '/\"BioF\" biof/d' \
-e '/\"BusySpheres\" busyspheres/d' \
-e '/\"SpirographX\" spirographx/d' \
-e '/\"MatrixView\" matrixview/d' \
-e '/\"Lorenz\" lorenz/d' \
-e '/\"Drempels\" drempels/d' \
-e '/\"Feedback\" feedback/d' \
-i ${xssconf} || die
fi
}