#!/usr/bin/make -f
# PLEASE NOTE: when building a development version or a version where the minor
# library version changes or has changed but the major so version stays the 
# same, make sure to Build-Conflict on libgimpX.X, Where libgimpX.X contains
# a previous version of the same major version of the library. Otherwise,
# libtool will stupidly relink against the system version of the library
# when installing, and create a dependency on the old version of libgimp.
# TODO: maybe set LD_LIBRARY_PATH instead?

## WARNING: compiling without -O2 (DEB_BUILD_OPTIONS=noopt) may produce
## undesired effects, especially when scaling JPEG images

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/class/gnome.mk


LDFLAGS = -Wl,--as-needed
DEB_CONFIGURE_EXTRA_FLAGS := --enable-python --enable-default-binary
DEB_BUILDDIR := $(DEB_SRCDIR)/build

DEB_DH_SHLIBDEPS_ARGS_ALL := -Llibgimp2.0 -l$(CURDIR)/debian/libgimp2.0/usr/lib
DEB_DH_SHLIBDEPS_ARGS_gimp := -Xlibcontroller-midi.so

clean::
	rm -rf build

common-install-impl::
	# Remove compiled python files from the distribution, they're compiled in
	# postrm by dh_python
	find $(CURDIR)/debian/tmp -name "*.py[co]" -exec rm '{}' ';'

	rm debian/tmp/usr/lib/*.la

	dh_movefiles

binary-install/gimp::
	dh_pysupport -pgimp /usr/lib/gimp/2.0/python
