# Template file for 'enblend-enfuse'
pkgname=enblend-enfuse
version=4.2
revision=1
build_style="gnu-configure"
configure_args="--enable-openmp --with-tcmalloc"
hostmakedepends="pkg-config perl automake"
makedepends="libjpeg-turbo-devel libpng-devel tiff-devel gperftools-devel
 gsl-devel lcms2-devel libopenexr-devel vigra-devel libgomp-devel"
short_desc="Tools for for combining multiple images"
maintainer="lemmi <lemmi@nerd2nerd.org>"
license="GPL-2"
homepage="http://enblend.sourceforge.net/"
distfiles="${SOURCEFORGE_SITE}/enblend/${pkgname}/${pkgname}-${version}/${pkgname}-${version}.tar.gz"
checksum=8703e324939ebd70d76afd350e56800f5ea2c053a040a5f5218b2a1a4300bd48

case "$XBPS_TARGET_MACHINE" in
	*-musl) makedepends+=" libglob-devel";;
esac

pre_configure() {
	# can not build documentataion for the lack of latex packages
	sed -i -e '/latex/d' aclocal.m4
	sed -i -e '/Documentation/,+46d' configure.ac
	autoreconf -fi
}

pre_build() {
	case "$XBPS_TARGET_MACHINE" in
	*-musl)
		sed -i '/LIBS =/s/$/ -lglob/' Makefile src/Makefile
		sed -i '/#include <glob.h>/c \
\#include <libglob/glob.h>\
\#define glob g_glob\
\#define globfree g_globfree' src/filespec.cc
		;;
	esac
}
