#!/usr/bin/make -f
# debian/rules file for the Debian/GNU Linux r-cran and r-mlbench packages
# Copyright 1998 by Douglas M. Bates <bates@stat.wisc.edu>

package=r-cran
r-cran-VR=MASS class nnet spatial
r-cran=bindata cclust chron ctest e1071 lme oz polynom quadprog rational splines

build: build-stamp
build-stamp:
	dh_testdir
# Nothing to do here
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp
	dh_clean

# Build architecture-independent files here.
binary-indep: build
# Nothing to do here

# Build architecture-dependent files here.
binary-arch: build
	dh_testdir -a
	dh_testroot -a
	dh_clean -a -k
	dh_installdirs -a
        # Add here commands to install the files into debian/tmp
	(cd debian/tmp; tar zxf ../../VR_*.tar.gz);
	(cd debian/tmp/VR; R INSTALL -l ../usr/lib/R/library $(r-cran-VR); \
	 cp DESCRIPTION ../usr/doc/r-cran/VR.DESCRIPTION; \
	 for i in $(r-cran-VR); do \
	    cp $$i/DESCRIPTION ../usr/doc/r-cran/$$i.DESCRIPTION; \
	 done; \
	 cd ..; rm -rf VR)
	for i in $(r-cran); do \
	  (cd debian/tmp; tar zxf ../../$${i}*.tar.gz; \
	   R INSTALL -l ./usr/lib/R/library $$i; \
	   cp -a $$i/DESCRIPTION ./usr/doc/r-cran/$$i.DESCRIPTION; rm -rf $$i); \
	done
	rm -f debian/tmp/usr/lib/R/library/LibIndex
	rm -f debian/tmp/usr/lib/R/library/index.html
	dh_installdocs -a
	dh_installchangelogs -a
	dh_strip -a
	dh_compress -a
	dh_fixperms -a
	dh_suidregister -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
#	dh_makeshlibs -a
	dh_md5sums -a
	dh_builddeb -a

source diff:                                                                  
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

binary: binary-indep binary-arch

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


