#!/usr/bin/make -f

ifneq (,$(filter-out amd64 arm64,$(DEB_HOST_ARCH_CPU)))
	confflags = -Denable_avx512=false -Denable_tests=false -Denable_asm=false
endif

%:
	dh $@ -Smeson+ninja -Dlibvmaf -Blibvmaf/build

# git describe --tags --long  --always
# libvmaf/include/vcs_version.h

override_dh_auto_configure:
	dh_auto_configure -- \
	-Dbuilt_in_models=true \
	$(confflags)


#	exit 1

override_dh_auto_build:
	dh_auto_build -Smeson+ninja -Dlibvmaf
	dh_auto_build -Spybuild -Dpython

override_dh_auto_install:
	dh_auto_install \
	-O-Dlibvmaf -O-Smeson+ninja

	dh_auto_install \
	-O-Dpython -O-Spybuild

execute_after_dh_install:
	dh_installdirs -pvmaf usr/bin

	dh_python3 -ppython3-vmaf --requires=python/requirements.txt

	dh_numpy3 --strict -ppython3-vmaf

	find debian -name __pycache__ | xargs rm -rf

override_dh_clean:
	-rm -rf .pybuild
	-rm -rf python/vmaf.egg-info

	dh_clean python/src/vmaf.egg-info/* python/vmaf/core/*.so \
	third_party/libsvm/*.so* python/vmaf/core/adm_dwt2_cy.c \
	python/build/temp.linux-x86_64-cpython-311/vmaf/core/adm_dwt2_cy.o \
	matlab/STMAD_2011_MatlabCode/*. \
	matlab/strred/matlabPyrTools/MEX/corrDn.mexw32

override_dh_auto_test:
