Make build system update version number, so it doesn't need to be maintained separately.
[hermes] / package / Makefile
index 6501e47..cd218f0 100644 (file)
@@ -1,21 +1,37 @@
+#
+# Makefile for Hermes: Contacts Updated
+# (c) Andrew Flegg 2009. Released under the Artistic Licence.
+
+DEBVERS := $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p')
+
 compile:
+       perl -pi -e "s/(WimpWorks\.__init__.*?version\s*=\s*)['\"].*?['\"]/\1'${DEBVERS}'/" src/org/maemo/hermes/gui/gtkui.py
        perl -ni -e 'print; exit if /^XB-Maemo-Icon-26:$$/' debian/control
        uuencode -m share/hermes-48.png - | perl -ne 'print " $$_" unless $$. == 1 or /^====$$/' >>debian/control
-       py_compilefiles src/*.py
+       py_compilefiles `find src -type f -name '*.py'`
+       cd po && $(MAKE) compile
        mkdir bin
 
 install:
-       mkdir -p ${DESTDIR}/opt/hermes/lib ${DESTDIR}/opt/hermes/bin
-       ln -s ../lib/gui.py ${DESTDIR}/opt/hermes/bin/hermes
+       mkdir -p ${DESTDIR}/opt/hermes/lib ${DESTDIR}/opt/hermes/bin ${DESTDIR}/opt/hermes/share
+       ln -s ../lib/main.py ${DESTDIR}/opt/hermes/bin/hermes
+       cp -r src/* ${DESTDIR}/opt/hermes/lib/
+       chown -R root:root ${DESTDIR}/opt/hermes/lib/
        install -D -m 0644 -o root -g root src/*.py* ${DESTDIR}/opt/hermes/lib/
+       install -D -m 0644 -o root -g root share/account-*.png share/background.png ${DESTDIR}/opt/hermes/share/
        install -D -m 0644 -o root -g root share/hermes-64.png ${DESTDIR}/usr/share/icons/hicolor/scalable/hildon/hermes.png
        install -D -m 0644 -o root -g root share/hermes-48.png ${DESTDIR}/usr/share/icons/hicolor/48x48/hildon/hermes.png
        install -D -m 0644 -o root -g root share/hermes.desktop ${DESTDIR}/usr/share/applications/hildon/hermes.desktop
        install -D -m 0644 -o root -g root share/hermes.service ${DESTDIR}/usr/share/dbus-1/services/hermes.service
-       chmod 755 ${DESTDIR}/opt/hermes/lib/gui.py
+       chmod 755 ${DESTDIR}/opt/hermes/lib/main.py
+       cd po && $(MAKE) install 
 
 clean:
-       rm -f src/*.py[oc]
+       rm -f `find src -type f -name '*.pyo' -o -name '*.pyc'`
        rm -f build-stamp configure-stamp
        rm -rf debian/hermes bin
        find . -name *~ -exec rm -f {} \;
+       cd po && $(MAKE) clean
+
+package:
+       dpkg-buildpackage -rfakeroot -uc -us