#!/usr/bin/make -f

export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
		--disable-safe-mode \
		--prefix=/usr \
		--sysconfdir=/etc/parser3 \
		--datadir=/usr/share/parser3 \
		--libdir=/usr/lib/parser3 \
		--includedir=/usr/include/parser3 \
		--with-shared-xml=/usr/ \
		--with-shared-gc=/usr/ \
		--with-mysql-client=/usr \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--with-apache=/usr/bin/apxs2 \
		--with-dynamic-stdcpp \
		CFLAGS="$(CFLAGS) -fPIC" CXXFLAGS="$(CXXFLAGS) -fPIC" \
		LDFLAGS="-Wl,-z,defs" LIBS="-lpcre"

override_dh_auto_install:
	dh_auto_install
	mv debian/tmp/etc/parser3/auto.p.dist \
		debian/tmp/etc/parser3/auto.p
	mkdir debian/tmp/etc/parser3/apache2 ; cp debian/tmp/etc/parser3/auto.p \
		debian/tmp/etc/parser3/apache2/auto.p

override_dh_link:
	for package in parser3 parser3-cgi parser3-dev libapache2-mod-parser3; do \
	  rm -rf debian/$$package/usr/share/doc/$$package; \
	done
	dh_link

