#!/usr/bin/make -f

# CGNS_ENABLE_SCOPING doens't seem compatible with CGNS_ENABLE_FORTRAN,
# causing FTBFS
# CGNS_ENABLE_64BIT=OFF: keeping the previous release setting
CMAKE_EXTRA_FLAGS := \
	-DCGNS_BUILD_CGNSTOOLS=ON \
	-DCGNS_BUILD_SHARED=ON \
	-DCGNS_ENABLE_64BIT=OFF \
	-DCGNS_ENABLE_BASE_SCOPE=ON \
	-DCGNS_ENABLE_FORTRAN=ON \
	-DCGNS_ENABLE_HDF5=ON \
	-DCGNS_ENABLE_LEGACY=ON \
	-DCGNS_ENABLE_SCOPING=OFF \
	-DCGNS_ENABLE_TESTS=ON \
	-DCGNS_USE_SHARED=ON \
	-DFORTRAN_NAMING=LOWERCASE_ \

# Workaround for FTBFS with GCC-10:
# Error: Type mismatch between actual argument at (1) and actual argument at (2)
export DEB_FFLAGS_MAINT_APPEND := -fallow-argument-mismatch

%:
	dh $@ --no-parallel

override_dh_auto_configure:
	dh_auto_configure -- $(CMAKE_EXTRA_FLAGS)

override_dh_install:
	dh_install
	rm -fr debian/cgns-convert/usr/bin/cgnstools
	rm -f debian/cgns-convert/usr/bin/cgconfig
	# Rename usr/bin/unitconv (name already used by package xcrysden)
	cd debian/cgns-convert/usr/bin && mv unitconv cgns_unitconv

override_dh_compress:
	dh_compress -X.pdf

get-orig-source:
	uscan --force-download --rename
