#!/usr/bin/make -f
#                                                       -*- makefile -*-
# debian/rules file for the Debian/GNU Linux package 'r-cran-sgeostat'
# Copyright 2004 by Dirk Eddelbuettel <edd@debian.org>
#
# automatically generated on Tue Jun 16 2009  by CRAN2DEB 0.0.1

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/langcore.mk

# We need the CRAN (upstream) name 
##cranName       := $(shell grep "^Package:\|^Bundle:" DESCRIPTION | awk "{print $2}")
cranName        := $(shell grep "^Package:\|^Bundle:" DESCRIPTION | sed 's/[\t ]//g' | cut -d: -f2)
# and we need to build a Debian Policy-conformant lower-case package name
cranNameLC      := $(shell echo $(cranName) | tr "[A-Z]" "[a-z]" )
# which we can use to build the package directory 
package         := r-cran-$(cranNameLC)
# which we use for the to-be-installed-in directory
debRlib         :=$(CURDIR)/debian/$(package)/usr/lib/R/site-library

common-install-indep:: R_any_arch
common-install-arch:: R_any_arch

R_any_arch:
	dh_installdirs          usr/lib/R/site-library
	R CMD INSTALL -l $(debRlib) .
	##rm -rf debian/$(cranName)
	##mkdir -p debian/$(cranName)
	##find . -not -path "./debian*" | cpio -p -m debian/$(cranName)
	##cd debian && R CMD check $(cranName) && rm -rf $(cranName)
	-rm -vf $(debRlib)/R.css $(debRlib)/$(cranName)/COPYING 
	echo "cranName is $(cranName)"

