#!/usr/bin/make -f
# debian/rules that uses debhelper >= 7.

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

# This has to be exported to make some magic below work.
export DH_OPTIONS

%:
	dh  $@

.PHONY: override_dh_auto_configure
override_dh_auto_configure:
	dh_auto_configure -- --enable-python2 --enable-python3 CFLAGS="-g"

.PHONY: override_dh_auto_test
override_dh_auto_test:

.PHONY: override_dh_install
override_dh_install:
	# Create the libvmdk package.
	dh_install "debian/tmp/usr/lib/lib*.so.*.*.*" -p libvmdk
	# Create the libvmdk-dev package.
	dh_install "debian/tmp/usr/include/*.h" -p libvmdk-dev
	dh_install "debian/tmp/usr/include/lib*/*.h" -p libvmdk-dev
	dh_install "debian/tmp/usr/lib/*.a" -p libvmdk-dev
	dh_install "debian/tmp/usr/lib/*.la" -p libvmdk-dev
	dh_install "debian/tmp/usr/lib/*.so" -p libvmdk-dev
	dh_install "debian/tmp/usr/lib/pkgconfig/*" -p libvmdk-dev
	dh_install "debian/tmp/usr/share/man/man3/*" -p libvmdk-dev
	# Create the libvmdk-tools package.
	dh_install "debian/tmp/usr/bin/*" -p libvmdk-tools
	dh_install "debian/tmp/usr/share/man/man1/*" -p libvmdk-tools
	# Create the libvmdk-python package.
	dh_install -X"*_d.so" "debian/tmp/usr/lib/python2*/*" -p libvmdk-python
	# Create the libvmdk-python3 package.
	dh_install -X"*_d.so" "debian/tmp/usr/lib/python3*/*" -p libvmdk-python3
	# The libvmdk-dbg, libvmdk-python-dbg and libvmdk-python3-dbg packages
	# are created by dh_strip.
	dh_install

.PHONY: override_dh_installmenu
override_dh_installmenu:

.PHONY: override_dh_installmime
override_dh_installmime:

.PHONY: override_dh_installmodules
override_dh_installmodules:

.PHONY: override_dh_installlogcheck
override_dh_installlogcheck:

.PHONY: override_dh_installlogrotate
override_dh_installlogrotate:

.PHONY: override_dh_installpam
override_dh_installpam:

.PHONY: override_dh_installppp
override_dh_installppp:

.PHONY: override_dh_installudev
override_dh_installudev:

.PHONY: override_dh_installwm
override_dh_installwm:

.PHONY: override_dh_installxfonts
override_dh_installxfonts:

.PHONY: override_dh_gconf
override_dh_gconf:

.PHONY: override_dh_icons
override_dh_icons:

.PHONY: override_dh_perl
override_dh_perl:

.PHONY: override_dh_pysupport
override_dh_pysupport:

.PHONY: override_dh_strip
override_dh_strip:
ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
	dh_strip -plibvmdk --dbg-package=libvmdk-dbg
	dh_strip -plibvmdk-python --dbg-package=libvmdk-python-dbg
	dh_strip -plibvmdk-python3 --dbg-package=libvmdk-python3-dbg
endif

.PHONY: override_dh_shlibdeps
override_dh_shlibdeps:
	dh_shlibdeps -Llibvmdk -l${CURDIR}/debian/tmp/usr/lib

.PHONY: override_dh_makeshlibs
override_dh_makeshlibs:
	dh_makeshlibs -Xlibvmdk-dev

