#!/usr/bin/make -f

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

DEB_GS_FRAMEWORKS = PopplerKit

DEB_GS_CURRENT_VERSION_NAME_PopplerKit = 1.0
DEB_GS_DEVPKG_NAME_PopplerKit = libpopplerkit-dev

include /usr/share/cdbs/1/rules/gnustep.mk
include /usr/share/cdbs/1/class/gnumakefile.mk

DEB_GS_AUTO_LINTIAN_OVERRIDES = y
DEB_GS_AUTO_DH_INSTALL = y

DEB_DH_SHLIBDEPS_INCLUDE = $(d_lib)/$(GS_LIBS_DIR)

framework = PopplerKit
d_lib = debian/$(DEB_GS_LIBPKG_NAME_$(framework))
frameworkver = $(DEB_GS_CURRENT_VERSION_NAME_$(framework))

export messages=yes
LDFLAGS += -Wl,-z,defs -Wl,--as-needed
DEB_MAKE_EXTRA_ARGS += OBJCFLAGS="$(CFLAGS)" CCFLAGS="$(CFLAGS)"

clean::
	rm -f config.make

binary-post-install/libpopplerkit0::
	: # use fonts from gsfonts package instead of locally distributed ones
	fonts=`ls Fonts/ | sed -e s,Fonts/,,`; \
	for i in $$fonts; do \
	  rm $(d_lib)/$(GS_FRAMEWORKS_DIR)/$(framework).framework/Versions/$(frameworkver)/Resources/$$i; \
	  ln -s /usr/share/fonts/type1/gsfonts/$$i \
		$(d_lib)/$(GS_FRAMEWORKS_DIR)/$(framework).framework/Versions/$(frameworkver)/Resources/$$i; \
	done
	dh_link -plibpopplerkit0
