Corrected patching behavior
[onis.git] / debian / rules
index 35b8226..fc3dc45 100755 (executable)
@@ -25,7 +25,12 @@ configure-stamp:
        dh_testdir
        # Add here commands to configure the package.
 
-       patch -p1 <contrib/systemwide-patch/systemwide-patch.diff
+       find . -type d -name '.svn' | xargs rm -rfv
+
+       if [ ! -e patch-stamp ]; then
+               patch -p1 <contrib/systemwide-patch/systemwide-patch.diff
+               touch patch-stamp
+       fi
 
        touch configure-stamp
 
@@ -35,9 +40,7 @@ build: build-stamp
 build-stamp: configure-stamp 
        dh_testdir
 
-       # Add here commands to compile the package.
-       #$(MAKE)
-       #docbook-to-man debian/onis.sgml > onis.1
+       pod2man -r "$(egrep '^\$VERSION' onis | cut -d \' -f 2)" onis >onis.1
 
        touch build-stamp
 
@@ -46,8 +49,12 @@ clean:
        dh_testroot
        rm -f build-stamp configure-stamp
 
-       # Add here commands to clean up after the build process.
-       #-$(MAKE) clean
+       [ -e onis.1 ] && rm -f onis.1
+
+       if [ -e patch-stamp ]; then
+               patch -p1 -R <contrib/systemwide-patch/systemwide-patch.diff
+               rm -f patch-stamp
+       fi
 
        dh_clean 
 
@@ -63,6 +70,7 @@ install: build
        dh_install lib/Onis usr/lib/perl5/
        dh_install lang themes usr/share/onis/
        dh_install reports/*-theme usr/share/onis/themes/
+       dh_installman onis.1
 
 # Build architecture-independent files here.
 binary-indep: build install