#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

NJOBS := -j$(shell getconf _NPROCESSORS_ONLN)

%:
	dh $@ --with autoreconf

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_MULTIARCH  ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
buildroot = $(CURDIR)/debian/tmp

override_dh_auto_configure:
	find doc -type f -executable -print -exec chmod 0644 {} ';'
	dh_testdir
	# Add here commands to configure the package.
	CC_FOR_BUILD=cc ./configure \
		--enable-static --enable-shared \
		--host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
		--prefix=/opt/alt/libxml2/usr \
		--datadir=/opt/alt/libxml2/usr/share \
		--libdir=/opt/alt/libxml2/usr/lib/$(DEB_HOST_MULTIARCH) \
		--without-python

override_dh_auto_build:
	$(MAKE) $(NJOBS) VERBOSE=1

override_dh_auto_install:
	make install DESTDIR=$(buildroot)
	find -name parser.h
	find ${buildroot} -type f -name '*.la' -print -delete
	rm -rf ${buildroot}${_datadir}/doc/
	gzip -9 -c doc/libxml2-api.xml > doc/libxml2-api.xml.gz

override_dh_auto_clean:
