#! /usr/bin/make -f

include /usr/share/dpkg/architecture.mk

export DEB_CFLAGS_MAINT_APPEND = -I/usr/include/tirpc

CONFIGURE_FLAGS := \
	--disable-fem-toolbox \
	--without-gpskca \
	--without-OpenGL \
	--without-gltools \
	--without-OpenDX \
	--without-grape \
	--without-silo

ifneq (,$(filter powerpc ppc64 ppc64el,$(DEB_HOST_ARCH)))
  export DEB_BUILD_MAINT_OPTIONS=hardening=-stackprotector
  CONFIGURE_FLAGS += CC=clang

# Force dwarf version 4. If compiled with clang (e.g. ppc64el) building failes
  # otherwise with
  # dwz: debian/libalberta4t64/usr/lib/powerpc64le-linux-gnu/libalberta_1d.so.4.0.0: Unknown debugging section .debug_addr
  DEB_CFLAGS_MAINT_APPEND += -gdwarf-4
endif


%:
	dh $@ --with-autoreconf

# Make autoreconf call the script fromsvnreconf.sh that will (re-)create all automake/autoconf files and create some additional
# needed directories.
override_dh_autoreconf:
	dh_autoreconf ./fromsvnreconf.sh

override_dh_auto_configure:
	dh_auto_configure -- $(CONFIGURE_FLAGS)

override_dh_strip:
	dh_strip --dbgsym-migration='libalberta-dbg (<< 3.0.1-2~)'
