#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

export JAVA_HOME=/usr/lib/jvm/default-java
export PACKAGE_NAME=jitsi
export ANT=ant

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

%:
	dh $@ --with javahelper

override_dh_auto_build:
	dh_auto_build -- init deb-src-rebuild

# Copy OS specific and native libs
override_dh_install-indep:
	dh_install -p$(PACKAGE_NAME) -Xslickless.jar -Xslick-runner.jar -X-slick.jar -X.svn -Xcommons-codec.jar -Xcommons-lang.jar
# make and install the debian specific bundles
# use the prebuild and installed bundles to extract/modify and use the
# exising debian java packages
	$(ANT) -file build.xml -Ddebian.bundles.dest=debian/$(PACKAGE_NAME)/usr/share/$(PACKAGE_NAME)/sc-bundles deb-bundle-jna deb-bundle-util deb-bundle-sysactivitynotifications deb-bundle-swing-ui deb-bundle-httputil deb-bundle-json deb-bundle-smacklib deb-bundle-jmdnslib deb-bundle-desktoputil deb-bundle-bouncycastle deb-bundle-plugin-accountinfo

override_dh_install-arch:
ifeq ($(DEB_HOST_ARCH),amd64)
	dh_install -plib$(PACKAGE_NAME)-jni lib/native/linux-64/*.so usr/lib/jni/
else
	dh_install -plib$(PACKAGE_NAME)-jni lib/native/linux/*.so usr/lib/jni/
endif

# we have folders with name *.jar which jh_manifest don't like and fails,
# we do not use it so skip it
override_jh_manifest:
	# do nothing

override_dh_auto_clean:
	dh_auto_clean -- clean-debuild

get-orig-source:
	uscan
