#!/usr/bin/make -f
# -*- makefile -*-

# to update the source tree:
# create a temporary directory to construct the runtime with the cordova CLI tool
# cordova create runtime
# cd runtime
# cordova platform add ubuntu
# cordova plugin add org.apache.cordova.camera
# cordova plugin add <other plugins>
# ...
# cordova prepare
# then copy back files from the platforms/ubuntu directory

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
INSTALL_PREFIX="/usr/share/ubuntu-html5-platform-3.4/${DEB_HOST_MULTIARCH}"
PACKAGE_NAME=ubuntu-html5-platform-3.4-dev

override_dh_auto_configure:
	cd build; cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
	                -DCMAKE_VERBOSE_MAKEFILE=ON \
	                -DCMAKE_BUILD_TYPE=RelWithDebInfo

override_dh_install:
	dh_install
	cp -R www debian/${PACKAGE_NAME}/${INSTALL_PREFIX}/; \
	cp -R qml debian/${PACKAGE_NAME}/${INSTALL_PREFIX}/; \
	rm -f debian/${PACKAGE_NAME}/${INSTALL_PREFIX}/cordova-ubuntu

override_dh_strip:

%:
	dh $@ --sourcedirectory=build --fail-missing
