correct link to project homepage
[beats-applet] / src / Makefile
1 # Example custom makefile for creating .deb without using dpkg tools.
2 #
3 # Author: Tim Wegener <twegener@madabar.com>
4 #
5 # This requires deb_hand.mak
6
7 # Sources:
8 # SOURCE_DIR - directory containing files to be packaged
9 # ICON_SOURCE - 26x26 icon file for maemo
10 # description.txt - description with summary on first line
11 # preinst, postinst, prerm, postrm - optional control shell scripts
12
13 PACKAGE = beats-applet
14 VERSION = 0.1
15 SECTION = user/other
16 PRIORITY = optional
17 ARCH = armel
18 DEPENDS = python2.5, python2.5-gobject, python2.5-gtk2, python2.5-osso, python2.5-hildon, python2.5-mutagen
19 MAINTAINER = Paul Philippov <paul@ppds.ws>
20
21 SOURCE_DIR = .
22 PACKAGE_DIR ?= ..
23 ICON_SOURCE = ${SOURCE_DIR}/beats26.png
24 CTRL_EXTRAS ?= ${wildcard preinst postinst prerm postrm}
25
26 ${PACKAGE_DIR}/data: ${SOURCE_DIR}
27         rm -rf $@
28         mkdir -p $@
29         mkdir -p $@/usr/lib/hildon-desktop
30         cp ${SOURCE_DIR}/beats-applet.py $@/usr/lib/hildon-desktop/
31         mkdir -p ${PACKAGE_DIR}/data/usr/share/applications/hildon-home
32         cp ${SOURCE_DIR}/beats-applet.desktop $@/usr/share/applications/hildon-home/
33         mkdir -p ${PACKAGE_DIR}/data/usr/share/pixmaps
34         cp ${SOURCE_DIR}/beats26.png $@/usr/share/pixmaps/beats.png
35         mkdir -p ${PACKAGE_DIR}/data/usr/share/icons/hicolor/26x26/apps
36         cp ${SOURCE_DIR}/beats26.png $@/usr/share/icons/hicolor/26x26/apps/beats.png
37         mkdir -p ${PACKAGE_DIR}/data/usr/share/icons/hicolor/128x128/apps
38         cp ${SOURCE_DIR}/beats128.png $@/usr/share/icons/hicolor/128x128/apps/beats.png
39         mkdir -p ${PACKAGE_DIR}/data/usr/share/icons/hicolor/scalable/apps
40         cp ${SOURCE_DIR}/beats.svg $@/usr/share/icons/hicolor/scalable/apps
41         mkdir -p ${PACKAGE_DIR}/data/usr/share/beats
42         cp ${SOURCE_DIR}/prefs.glade $@/usr/share/beats/
43
44 ${PACKAGE_DIR}/control: ${PACKAGE_DIR}/data ${CTRL_EXTRAS} description.txt ${ICON_SOURCE}
45         rm -rf $@
46         mkdir -p $@
47
48 ifneq (${CTRL_EXTRAS},)
49         cp ${CTRL_EXTRAS} $@
50 endif
51
52         echo "Package: ${PACKAGE}" > $@/control
53         echo "Version: ${VERSION}" >> $@/control
54         echo "Section: ${SECTION}" >> $@/control
55         echo "Priority: ${PRIORITY}" >> $@/control
56         echo "Architecture: ${ARCH}" >> $@/control
57         echo "Depends: ${DEPENDS}" >> $@/control
58         echo "Installed-Size: ${shell du -s ${PACKAGE_DIR}/data | cut -f1}" >> $@/control
59         echo "Maintainer: ${MAINTAINER}" >> $@/control
60         echo -n "Description:" >> $@/control
61         cat description.txt | gawk '{print " "$$0;}' >> $@/control
62
63 ifneq (${ICON_SOURCE},)
64         echo "Maemo-Icon-26:" >> $@/control
65         base64 ${ICON_SOURCE} | gawk '{print " "$$0;}' >> $@/control
66 endif
67
68         cd ${PACKAGE_DIR}/data && find . -type f -exec md5sum {} \; | sed -e 's| \./||' > $@/md5sums
69
70 ${PACKAGE_DIR}/debian-binary:
71         echo "2.0" > $@
72
73 ${PACKAGE_DIR}/build: ${PACKAGE_DIR}/debian-binary ${PACKAGE_DIR}/control
74         rm -rf $@
75         mkdir -p $@
76
77         cp ${PACKAGE_DIR}/debian-binary $@/
78         cd ${PACKAGE_DIR}/control && tar czvf $@/control.tar.gz ./*
79         cd ${PACKAGE_DIR}/data    && tar czvf $@/data.tar.gz ./*
80
81 ${PACKAGE_DIR}/${PACKAGE}_${VERSION}_${ARCH}.deb: ${PACKAGE_DIR}/build
82         ar -rc $@tmp $</debian-binary $</control.tar.gz $</data.tar.gz
83         sed -e 's|^\([^/]\+\)/ \(.*\)|\1  \2|g' $@tmp > $@fail
84         rm -f $@tmp
85         mv $@fail $@
86
87 .PHONY: data
88 data: ${PACKAGE_DIR}/data
89
90 .PHONY: control
91 control: ${PACKAGE_DIR}/control
92
93 .PHONY: build
94 build: ${PACKAGE_DIR}/build
95
96 .PHONY: deb
97 deb: ${PACKAGE_DIR}/${PACKAGE}_${VERSION}_${ARCH}.deb
98
99 clobber:
100         rm -rf ${PACKAGE_DIR}/debian_binary ${PACKAGE_DIR}/control ${PACKAGE_DIR}/data ${PACKAGE_DIR}/build