#!/usr/bin/make -f

export DEB_CFLAGS_MAINT_APPEND  = -pipe -Wall
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

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

SHLIBVER = 2.0.1

# features -- disable building as plugins, otherwise dh_shlibs
confflags =  --disable-jpg-shared
confflags += --disable-tif-shared
confflags += --disable-png-shared
confflags += --disable-webp-shared

%:
	dh $@ --with autoreconf --parallel

override_dh_autoreconf:
	AUTOMAKE="automake --foreign" dh_autoreconf --as-needed

override_dh_auto_configure:
	dh_auto_configure -- $(confflags)

override_dh_install:
	dh_install --fail-missing -XlibSDL2_image.la

override_dh_installchangelogs:
	dh_installchangelogs -- CHANGES.txt

override_dh_link:
	# fix lintian warning dev-pkg-without-shlib-symlink
	dh_link -plibsdl2-image-dev usr/lib/$(DEB_HOST_MULTIARCH)/libSDL2_image-2.0.so.0.0.1 usr/lib/$(DEB_HOST_MULTIARCH)/libSDL2_image-2.0.so
	dh_link --remaining-packages

override_dh_compress:
	dh_compress -Xshowimage.c

override_dh_strip:
	dh_strip --dbg-package=libsdl2-image-dbg

override_dh_makeshlibs:
	dh_makeshlibs -V"libsdl2-image-2.0-0 (>= $(SHLIBVER))"
