#!/usr/bin/make -f

# Enable LFS, build system doesn't respect CPPFLAGS.
export DEB_CFLAGS_MAINT_APPEND = -D_LARGEFILE_SUPPORT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 $(shell dpkg-buildflags --get CPPFLAGS)

%:
	dh $@ --with apache2 --sourcedirectory=native

override_dh_auto_configure:
	dh_auto_configure -- --with-apxs=/usr/bin/apxs2

override_dh_auto_install:
ifneq (,$(filter libapache-mod-jk-doc, $(shell dh_listpackages)))
	cd xdocs && install -d ../build/docs/ && cp -R * ../build/docs/
	cd build/docs && for i in `find . -name '*.xml'`; do xsltproc style.xsl $$i > `dirname $$i`/`basename $$i .xml`.html; done
	cd build/docs && find . -name '*.xml' -exec rm -f {} \;
	cd build/docs && rm -f style.xsl BUILDING
	cd build/docs/miscellaneous && lynx -dump -nolist changelog.html > ../changelog
endif

override_dh_compress:
	dh_compress -Xchangelog.html

# No check target
override_dh_auto_test:

override_dh_install:
	mv $(CURDIR)/conf/httpd-jk.conf $(CURDIR)/conf/jk.conf
	dh_install

get-orig-source:
	uscan --verbose --download-current-version --force-download