SUMMARY="Convert, edit, or compose bitmap images"
DESCRIPTION="ImageMagick® is a software suite to create, edit, compose, or \
convert bitmap images. It can read and write images in a variety of formats \
(over 100) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PNG, Postscript, \
SVG, and TIFF. Use ImageMagick to resize, flip, mirror, rotate, distort, shear \
and transform images, adjust image colors, apply various special effects, or \
draw text, lines, polygons, ellipses and Bézier curves."
HOMEPAGE="http://www.imagemagick.org"
ARCHITECTURES="x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
LICENSE="IMAGEMAGICK"
COPYRIGHT="1999-2014 ImageMagick Studio LLC"
REVISION="1"

SOURCE_URI="http://www.imagemagick.org/download/releases/ImageMagick-6.8.9-8.tar.gz"
CHECKSUM_SHA256="31e14dc50c65947c3eb75fd540d94b8bbecba9e5f9a0b11a917bb01290491a5f"
SOURCE_DIR="ImageMagick-6.8.9-8"
PATCHES="imagemagick-6.8.9_8.patchset"

PROVIDES="
	imagemagick$secondaryArchSuffix = $portVersion
	cmd:Magick++_config
	cmd:Magick_config
	cmd:MagickCore_config
	cmd:MagickWand_config
	cmd:Wand_config
	cmd:animate
	cmd:compare
	cmd:composite
	cmd:conjure
	cmd:convert
	cmd:display
	cmd:identify
	cmd:import
	cmd:mogrify
	cmd:montage
	cmd:stream
	lib:libMagick++_6.Q16 = 5.0.0 compat >= 5
	lib:libMagickCore_6.Q16 = 2.0.0 compat >= 2
	lib:libMagickWand_6.Q16 = 2.0.0 compat >= 2
"

REQUIRES="
	haiku
	lib:libbz2
	lib:libfreetype
	lib:libjpeg
	lib:libltdl
	lib:libpng15
	lib:libtiff
	lib:libwebp
	lib:libz
"

BUILD_REQUIRES="
	devel:libbz2$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libltdl$secondaryArchSuffix
	devel:libpng$secondaryArchSuffix
	devel:libtiff$secondaryArchSuffix
	devel:libwebp$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
"
#	devel:libopenexr
#	devel:libcms

BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize
	cmd:make
	cmd:perl
	cmd:pkg_config$secondaryArchSuffix
	cmd:sed
	cmd:svnversion
"

GLOBAL_WRITABLE_FILES="
	settings/ImageMagick-6/coder.xml keep-old
	settings/ImageMagick-6/colors.xml keep-old
	settings/ImageMagick-6/delegates.xml keep-old
	settings/ImageMagick-6/log.xml keep-old
	settings/ImageMagick-6/magic.xml keep-old
	settings/ImageMagick-6/mime.xml keep-old
	settings/ImageMagick-6/policy.xml keep-old
	settings/ImageMagick-6/quantization-table.xml keep-old
	settings/ImageMagick-6/thresholds.xml keep-old
	settings/ImageMagick-6/type-dejavu.xml keep-old
	settings/ImageMagick-6/type-ghostscript.xml keep-old
	settings/ImageMagick-6/type-windows.xml keep-old
	settings/ImageMagick-6/type.xml keep-old
"

BUILD()
{
	export LDFLAGS="-lnetwork"
	autoconf
	automake
	runConfigure ./configure --enable-shared --without-modules
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLibs libMagick++-6.Q16 libMagickCore-6.Q16 \
		libMagickWand-6.Q16

	packageEntries devel $developDir
}

PROVIDES_devel="
	imagemagick${secondaryArchSuffix}_devel = $portVersion
	devel:libMagick++_6.Q16 = 5.0.0 compat >= 5
	devel:libMagickCore_6.Q16 = 2.0.0 compat >= 2
	devel:libMagickWand_6.Q16 = 2.0.0 compat >= 2
"

REQUIRES_devel="
	imagemagick${secondaryArchSuffix} == $portVersion base
"
