#!/usr/bin/make -f
# Based on mozilla-firefox-locale-uk
# Thanks to Eugeniy Meshcheryakov <eugen@univ.kiev.ua>

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

BUILDDIR = $(CURDIR)/debian/build

configure: configure-stamp
configure-stamp:
	dh_testdir

	touch configure-stamp

build: configure-stamp build-stamp
build-stamp:
	dh_testdir

	mkdir -p $(BUILDDIR)
	unzip -d $(BUILDDIR) $(CURDIR)/*.xpi

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp

	-rm -rf $(BUILDDIR)

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	install -m 644 $(BUILDDIR)/chrome/de-DE.jar \
	        $(CURDIR)/debian/mozilla-firefox-locale-de/usr/lib/mozilla-firefox/chrome/

	install -m 644 $(CURDIR)/debian/50de-locale $(CURDIR)/debian/mozilla-firefox-locale-de/var/lib/mozilla-firefox/chrome.d
	echo "de:DE" > debian/mozilla-firefox-locale-de/var/lib/mozilla-firefox/locales.d/50_locale-de-DE
#	Install profile, bookmarks etc.
# This goes into subdir
#	install -m 644 $(BUILDDIR)/defaults/profile/DE/panels.rdf \
#		$(CURDIR)/debian/mozilla-firefox-locale-de/usr/lib/mozilla-firefox/defaults/profile/DE/
#	Leave this out for now to avoid collision with the search plugin contained in mozilla-firefox
#	install -m 644 $(BUILDDIR)/sp/google.gif \
#		$(CURDIR)/debian/mozilla-firefox-locale-de/usr/lib/mozilla-firefox/searchplugins/
#	install -m 644 $(BUILDDIR)/sp/google.src \
#		$(CURDIR)/debian/mozilla-firefox-locale-de/usr/lib/mozilla-firefox/searchplugins/google.src
#
# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installdebconf
	dh_installdocs 
	dh_installchangelogs 
	dh_link 
	dh_compress 
	dh_fixperms 
	dh_installdeb 
	dh_gencontrol 
	dh_md5sums 
	dh_builddeb 

# Build architecture-dependent files here.
binary-arch: build install
# We have nothing to do by default.

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
