# Description: Image manipulation wizard
# URL: http://www.imagemagick.org/
# Maintainer: Juergen Daubert, jue at crux dot nu
# Depends on: bzip2 chrpath libtool xz zlib
# Optional: fontconfig lcms2 libpng libtiff libxml2 openjpeg2 pango xorg-libxt

name=imagemagick
version=7.1.1-30
release=1
source=(https://imagemagick.org/archive/releases/ImageMagick-$version.tar.xz)

build () {
	cd ImageMagick-$version

	sed '/INSTALL_BASE/d' -i PerlMagick/Makefile.PL.in

	./configure \
		--prefix=/usr \
		--enable-shared \
		--with-modules \
		--with-perl=yes \
		--with-perl-options=''

	make
	make DESTDIR=$PKG install

	# remove bogus workdir rpath from perl modules
	find $PKG/usr/lib/perl5 -name '*.so' -exec chrpath -d {} +

	# cleanup
	rm -r $PKG/usr/share/doc
	find $PKG -regex '.*\(ChangeLog\|LICENSE\|NEWS\.txt\)$' -delete
	find $PKG -regex '.*\(\.packlist\|perllocal.pod\|\.bs\)$' -delete
	find $PKG -type d -empty -delete
}
