#!/usr/bin/env modbuild

case ${OS} in
Darwin )
	configure_args='--with-ns --with-jpeg=no'
	CC=''
	CXX=''
	COMPILER=''
	COMPILER_VERSION=''
	;;
Linux )
	# with 24.5 configure complains about missing libjpeg even it
	# is installed!
	configure_args='--with-jpeg=no'
	;;
*)
	;;
esac

pbuild::configure() {
	"${MODULE_SRCDIR}"/configure \
		--prefix="${PREFIX}" \
		${configure_args} \
		|| exit 1
	install -m 0755 -d "${PREFIX}"
}

pbuild::post_install() {
	mkdir -p "${PREFIX}/bin"
	install -m 0755 "${BUILD_BLOCK_DIR}/Emacs" "${PREFIX}/bin"
	install -m 0755 "${BUILD_BLOCK_DIR}/Emacsclient" "${PREFIX}/bin"
}

pbuild::post_install_Darwin() {
	cp -a "${MODULE_BUILDDIR}/nextstep/Emacs.app" "${PREFIX}"
}

pbuild::add_to_group 'Tools'
pbuild::make_all

