#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

RUBYLIBDIR1.8    := $(strip $(shell ruby1.8 -rrbconfig -e 'puts Config::CONFIG["rubylibdir"]'))
PKG_NAME1.8      := libmathml-ruby1.8
DESTDIR_PKG1.8   := $(CURDIR)/debian/$(PKG_NAME1.8)
RUBYLIBDIR1.9.1    := $(strip $(shell ruby1.9.1 -rrbconfig -e 'puts Config::CONFIG["rubylibdir"]'))
PKG_NAME1.9.1    := libmathml-ruby1.9.1
DESTDIR_PKG1.9.1 := $(CURDIR)/debian/$(PKG_NAME1.9.1)
DEB_RDOC_OPTS    := --all --inline-source --diagram --fileboxes --line-numbers --fmt=html

%:
	dh $@ 

override_dh_auto_install:
	cp -r lib/* $(DESTDIR_PKG1.8)/$(RUBYLIBDIR1.8)/
	cp -r lib/* $(DESTDIR_PKG1.9.1)/$(RUBYLIBDIR1.9.1)/

override_dh_installdocs:
	rdoc1.8 $(rdoc_opts) \
	  -o $(DESTDIR_PKG1.8)/usr/share/doc/$(PKG_NAME1.8)/rdoc lib
	rdoc1.9.1 $(rdoc_opts) \
	  -o $(DESTDIR_PKG1.9.1)/usr/share/doc/$(PKG_NAME1.9.1)/rdoc lib
	rm -f $(DESTDIR_PKG1.9.1)/usr/share/doc/$(PKG_NAME1.9.1)/rdoc/js/jquery.js
	( cd $(DESTDIR_PKG1.9.1)/usr/share/doc/$(PKG_NAME1.9.1)/rdoc/js/ \
	  && ln -s ../../../../javascript/jquery/jquery.js .)
	dh_installdocs

override_dh_compress:
	dh_compress -X.js
