#!/usr/bin/make -f

# Upstream build system seems to just ignore these, and as a result, libgsf
# fails to find libxml headers (see #707417).
CPPFLAGS += $(shell pkg-config libgsf-1 --cflags)

# Files on CIFS shares can have 64 bit inode numbers, which means we need LFS
# enabled to read them (which is something which a library which reads Word
# documents really should support).
CPPFLAGS += -D_FILE_OFFSET_BITS=64

# Disable debug output, which is very noisy.
# (#329109 and (after upstream moved to cmake and the fix was lost) #603871)
CXXFLAGS += -DNDEBUG

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
	$(MAKE) -C obj-* test
	cp tests/*.doc obj-*/tests
	cd obj-*/tests ; for t in *test ; do \
	  echo "Running test $$t" ;\
	  if [ $$t = handlertest ]; then \
	    set -e ; ./$$t testole.doc ;\
	  else \
	    set -e ; ./$$t ;\
	  fi \
	done
endif
endif
