#!/usr/bin/make -f

export OPENJPEG = $(CURDIR)/openjpeg
export INPUT = $(CURDIR)/src
export OUTPUT = $(CURDIR)/debian/build

%:
	dh $@

override_dh_auto_configure:
	# Nothing to configure; upstream's two scripts drive the build.

override_dh_auto_build:
	# Both the WebAssembly and the JavaScript fallback build need their own
	# static library, with different optimisation flags.
	BUILD_TYPE=wasm BUILD_DIR=build_wasm sh compile_lib.sh
	BUILD_TYPE=js BUILD_DIR=build_js sh compile_lib.sh
	mkdir -p $(OUTPUT)
	BUILD_TYPE=wasm BUILD_DIR=build_wasm sh compile.sh
	BUILD_TYPE=js BUILD_DIR=build_js sh compile.sh

override_dh_auto_install:
	# Nothing to do; debian/install lists the files built above.

override_dh_auto_test:
	# The generated modules need a browser environment to run in.
