#!/usr/bin/make -f

DEB_ENABLE_TESTS = yes

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/hlibrary.mk

DEB_GHC_EXTRA_PACKAGES := libghc-pandoc-citeproc-data (>= $(CABAL_VERSION))

DEB_SETUP_GHC_CONFIGURE_ARGS = -fbibutils -funicode_collation

# LANG needs to be en_SOMETHING to make sure that Text.CSL.Input.Bibtex
# works as the test suite expects.
check-ghc-stamp: export LANG := en_US.UTF-8
check-ghc-stamp: export LC_ALL := C.UTF-8

install/libghc-pandoc-citeproc-data:: debian/tmp-inst-ghc
	cp -a debian/tmp-inst-ghc/usr/share/pandoc-citeproc/chicago-author-date.csl \
		debian/tmp-inst-ghc/usr/share/pandoc-citeproc/locales \
		debian/libghc-pandoc-citeproc-data/usr/share/pandoc-citeproc/

install/pandoc-citeproc:: debian/tmp-inst-ghc
	cp debian/tmp-inst-ghc/usr/bin/* debian/pandoc-citeproc/usr/bin
	cp -a debian/tmp-inst-ghc/usr/share/pandoc-citeproc/man debian/pandoc-citeproc/usr/share
