#!/usr/bin/make -f

export DH_VERBOSE=1

include $(CURDIR)/build.number
BUNDLE_VERSION="$(version.major).$(version.minor).$(version.patch)"

override_dh_auto_build:
	# Build Jline
	ant -f debian/build-jline.xml -propertyfile debian/ant-jline.properties
	# Build Scala
	ANT_OPTS="-Xmx1024M -Xss64M" ant -Dversion.number=$(BUNDLE_VERSION) fastdist

	for file in scala scala-library; do \
		sed "s/@VERSION@/$(BUNDLE_VERSION)/" debian/$${file}.pom.xml.in > debian/$${file}.pom.xml; \
	done

override_dh_auto_clean:
	rm -rf build dist

override_dh_compress:
	dh_compress -X.js -X.scala
	# dh_compress is executed after mh_installpoms and mh_linkjars
	# ugly hack to fix #654549
	find debian/scala \( -type f -or -type l \) -name "scala-library*.jar" -delete

%:
	dh $@ --with javahelper --with jh_maven_repo_helper
