#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
VERSION=__PACKAGE_VERSION__
INSTALL_PATH=/var/lib/erp5
SOFTWARE_PATH=/opt/erp5/$(VERSION)

configure:
# We have nothing to do.

build:
	svn co https://svn.erp5.org/repos/public/erp5/release/5.4.6/ $(INSTALL_PATH)
	echo "[software_definition]" >> $(INSTALL_PATH)/timmy-base.cfg
	echo "software_home = $(SOFTWARE_PATH)" >> $(INSTALL_PATH)/timmy-base.cfg
	$(SOFTWARE_PATH)/bin/python2.4 -S $(INSTALL_PATH)/bootstrap/bootstrap.py -c $(INSTALL_PATH)/timmy-base.cfg
	$(INSTALL_PATH)/bin/buildout -vv -c $(INSTALL_PATH)/timmy-base.cfg

clean: 
	dh_testdir
	dh_testroot
	rm -rf $(INSTALL_PATH)

install:
	dh_testdir
	dh_testroot
	cp -ar --parents $(INSTALL_PATH) $(CURDIR)/debian/tmp
	find $(CURDIR)/debian/tmp -type d -name '.svn' | xargs -d '\n' rm -rf
	find $(CURDIR)/debian/tmp -name '*.pyc' -delete

# Build architecture-dependent files here.
binary-arch: install
	dh_testdir
	dh_testroot
	dh_installchangelogs 
	dh_installdocs
	dh_installexamples
#	dh_install
#	dh_installmenu
#	dh_installdebconf
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_python
#	dh_installinit
#	dh_installcron
#	dh_installinfo
	dh_installman
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_perl
	dh_makeshlibs
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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