#!/usr/bin/make -f

DEB_MAKE_FLAVORS = py2 py3
DEB_BUILDDIR = build
DEB_MAKE_DESTDIRSKEL_py2 = $(CURDIR)/debian/tmp
DEB_MAKE_DESTDIRSKEL_py3 = $(CURDIR)/debian/tmp-py3

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/gnome.mk
include /usr/share/cdbs/1/rules/utils.mk
include /usr/share/cdbs/1/rules/patchsys-quilt.mk
include /usr/share/gnome-pkg-tools/1/rules/uploaders.mk
include /usr/share/gnome-pkg-tools/1/rules/gnome-get-source.mk

debian/stamp-autotools/py2:: DEB_CONFIGURE_SCRIPT_ENV=PYTHON=python

DEB_CONFIGURE_FLAGS_py2 += --enable-gtk-doc \
                           --enable-vala \
                           --enable-python \
                           --disable-gjs

debian/stamp-autotools/py3:: DEB_CONFIGURE_SCRIPT_ENV=PYTHON=python3

DEB_CONFIGURE_FLAGS_py3 += --disable-gtk-doc \
			   --disable-vala \
			   --enable-python \
			   --disable-gjs

makebuilddir::
	autoreconf

common-install-arch::
	cp -a debian/tmp-py3/usr/lib/libpeas-1.0/loaders/libpythonloader.so \
	      debian/tmp/usr/lib/libpeas-1.0/loaders/libpython3loader.so

# Seed disabled since not in main
#ifeq (,$(filter $(DEB_HOST_ARCH),ia64 mips))
#DEB_CONFIGURE_EXTRA_FLAGS += --enable-seed
#endif

# We clean the test directory before running check because we need to stop
# -Bsymbolic-functions from being used when building the tests.  Else
# the extension-c test fails.  And we want to avoid the gtk-requiring tests.
DEB_MAKE_CHECK_TARGET = -C tests/libpeas clean all check LDFLAGS=""

DEB_DH_MAKESHLIBS_ARGS_libpeas-1.0-0 += -X/usr/lib/libpeas-1.0/

binary-post-install/libpeas-doc::
	# remove compiled python and libtool .la files
	find debian/$(cdbs_curpkg) -name '*.pyo' -delete
	find debian/$(cdbs_curpkg) -name '*.pyc' -delete
	find debian/$(cdbs_curpkg) -name '*.la' -delete
