#!/usr/bin/make -f

%:
	dh $@ --with elpa $(WITH_MAVEN)


#
# Parameters to configure.
#
CONFIGURE_OPTIONS = \
  --enable-threads \
  --disable-native-java \
  --disable-rpath \
  --without-emacs

ifeq (,$(filter nojava,$(DEB_BUILD_PROFILES)))
  WITH_MAVEN = --with maven-repo-helper
endif

# On emulated m68k and sh4 targets, OpenMP can cause lockups,
# we therefore disable it for the time being.
ifneq (,$(findstring $(DEB_HOST_ARCH), m68k sh4))
  CONFIGURE_OPTIONS += --disable-openmp
else
  CONFIGURE_OPTIONS += --enable-openmp
endif

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

override_dh_auto_configure:
	dh_auto_configure -- $(CONFIGURE_OPTIONS)


#
# Parameters to make.
#
MAKE_OPTIONS =

# Disable use of Java in gettext-tools/urlget.
# See <https://bugs.debian.org/292988>.
MAKE_OPTIONS += USEJAVA=0

override_dh_auto_build:
	dh_auto_build -- $(MAKE_OPTIONS)


#
# We package gettext-el using dh_elpa, but upstream doesn't provide
# ELPA package metadata so we have to give it some hints.
#
ELPA_NAME=po-mode
export ELPA_NAME
include /usr/share/dpkg/pkg-info.mk
export DEB_VERSION_UPSTREAM

# gettext-el has no test suite, but the package as a whole does have a
# test suite, run by the normal dh_auto_test, that should not be skipped.
export DH_ELPA_TEST_DISABLE=disable
