debian/rules
author Alexandre Fayolle <alexandre.fayolle@logilab.fr>
Mon, 22 May 2006 12:38:25 +0200
changeset 1 b9b031063093
parent 0 7710b138d4eb
permissions -rwxr-xr-x
packaging updates

#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

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

# This is the debhelper compatability version to use.
export DH_COMPAT=5

PYVERSIONS=2.3

build: DH_OPTIONS=
build: build-stamp
build-stamp: 
	dh_testdir
	
	for v in $(PYVERSIONS) ; do \
		python$$v setup.py -q build ; \
	done
	touch build-stamp

clean: 
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp
	rm -rf build
	rm -rf debian/python?.?-tmp*/
	find . -name "*.pyc" | xargs rm -f
	rm -f changelog.gz
	dh_clean

install: DH_OPTIONS=
install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	
	python2.3 setup.py -q install_lib --no-compile --install-dir=debian/python2.3-oobrother/usr/lib/python2.3/site-packages
	python2.3 setup.py -q install_headers --install-dir=debian/python2.3-oobrother/usr/include/
	python2.3 setup.py -q install_scripts --install-dir=debian/python2.3-oobrother/usr/bin/
	# remove test directory (installed in a separated package)
	rm -rf debian/python2.3-oobrother/usr/lib/python2.3/site-packages/oobrother/test
	python setup.py -q install_data --install-dir=debian/oobrother-common/usr/
            
	
	for v in $(PYVERSIONS) ; do \
		PYTHON=python$$v ; \
		PYTMP="debian/$$PYTHON-oobrother" ; \
		i=$$PYTMP/usr/bin/oobrother ; \
		if head -1 $$i | grep "^#! */usr/bin" | grep "python" >/dev/null ; then \
			sed "s@^#! */usr/bin/env \+python\$$@#!/usr/bin/$$PYTHON@;s@^#! */usr/bin/python\$$@#!/usr/bin/$$PYTHON@" <$$i >$$i.$$PYTHON; \
			rm $$i ; \
		else \
			mv $$i $$i.$$PYTHON ; \
		fi ; \
		chmod a+x $$i.$$PYTHON ; \
	done
	
	
	
	# install tests
	(cd test && find . -type f -not \( -path '*/CVS/*' -or -name '*.pyc' \) -exec install -D --mode=644 {} ../debian/oobrother-test/usr/share/doc/oobrother/test/{} \;)


# Build architecture-independent files here.
binary-indep: DH_OPTIONS=-i
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_install
	
	
	
	# install text documentation
	for v in $(PYVERSIONS) ; do \
		PACKAGE=python$$v-oobrother ; \
		cp -r doc/*.txt doc/*.py debian/$$PACKAGE/usr/share/doc/$$PACKAGE/ ; \
	done
	# install html documentation
	for v in $(PYVERSIONS) ; do \
		PACKAGE=python$$v-oobrother ; \
		cp -r doc/*.html debian/$$PACKAGE/usr/share/doc/$$PACKAGE/html ; \
	done
	gzip -9 -c ChangeLog > changelog.gz
	dh_installdocs -A README TODO changelog.gz 
	dh_installchangelogs
	
	dh_link
	dh_compress -X.py -X.ini -X.xml
	dh_fixperms
	dh_installdeb
	dh_gencontrol 
	dh_md5sums
	dh_builddeb

# Build architecture-dependent files here.
binary-arch: DH_OPTIONS=-a
binary-arch: build install
	dh_testdir 
	dh_testroot 
	dh_install
	
	
	
	# install text documentation
	for v in $(PYVERSIONS) ; do \
		PACKAGE=python$$v-oobrother ; \
		cp -r doc/*.txt doc/*.py debian/$$PACKAGE/usr/share/doc/$$PACKAGE/ ; \
	done
	# install html documentation
	for v in $(PYVERSIONS) ; do \
		PACKAGE=python$$v-oobrother ; \
		cp -r doc/*.html debian/$$PACKAGE/usr/share/doc/$$PACKAGE/html ; \
	done
	gzip -9 -c ChangeLog > changelog.gz
	dh_installdocs -A README TODO changelog.gz 
	dh_installchangelogs
	
	dh_strip
	dh_link
	dh_compress -X.py -X.ini -X.xml
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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