#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

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

CXXFLAGS:= $(filter-out -Werror=format-security, $(shell dpkg-buildflags --get CXXFLAGS))

DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)

ifneq (,$(filter $(DEB_BUILD_ARCH),mips mipsel))
	export DEB_CXXFLAGS_MAINT_APPEND = -g0
endif

DOTTED:=`py3versions -d  |  sed 's/python//' `
NODOT:=`py3versions -d | sed 's/\.//' | sed 's/python//' `

%:
	dh $@ --buildsystem=cmake

override_dh_auto_configure:
	dh_auto_configure --			\
                -DPY3VERSION_DOTTED=$(DOTTED)	\
                -DPY3VERSION_NODOT=$(NODOT)	\
                -Denable-mpi=ON			\
                -Denable-ltdl=ON		\
                -Denable-jpeg=ON		\
                -Denable-gsl=ON			\
                -Denable-hdf4=ON		\
                -Denable-hdf5=ON		\
                -Denable-pdf=ON			\
                -Denable-gif=ON			\
                -Denable-glut=ON		\
                -Denable-fltk=ON		\
                -Denable-wx=ON			\
                -Denable-qt5=ON			\
                -Denable-qt5asqt=ON		\
                -Denable-json-sample=ON		\
                -Denable-json-sample-we=ON	\
                -DCMAKE_BUILD_RPATH_USE_ORIGIN=ON \
                -Denable-python=ON

override_dh_python3:
	dh_numpy3

ifneq (,$(filter $(DEB_BUILD_ARCH),mips mipsel alpha))
override_dh_dwz:
	@echo bypass dwz that causes build failues
endif
