8c18f98688b311e681dae7cdae8a627e27ace2dd
[modest] / debian / rules
1 #!/usr/bin/make -f
2 # -*- makefile -*-
3
4 # Uncomment this to turn on verbose mode.
5 #export DH_VERBOSE=1
6
7 # These are used for cross-compiling and for saving the configure script
8 # from having to guess our platform (since we know it already)
9 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
10 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
11
12 CFLAGS = -Wall -g
13 PACKAGENAME = modest
14
15 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
16         CFLAGS += -O0
17 else
18         CFLAGS += -O2
19 endif
20 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
21         INSTALL_PROGRAM += -s
22 endif
23
24 ifneq (,$(findstring thumb,$(DEB_BUILD_OPTIONS)))
25         CFLAGS += -mthumb
26 endif
27
28 # maemo-launcher support is not working properly yet, so leave it disabled
29 # ifeq (,$(findstring nolauncher,$(DEB_BUILD_OPTIONS)))
30 #       LAUNCHER = yes
31 #       LAUNCHER_DEPENDS=-Vlauncher:Depends="maemo-launcher"
32 #       conf_opt := --enable-maemo-launcher
33 # endif
34
35 config.status: configure
36         dh_testdir
37         # commands to configure the package.
38         if [ ! -x configure ]; then ./autogen.sh; fi
39         CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --sysconfdir=/etc --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info $(conf_opt)
40
41 configure: configure-stamp
42 configure-stamp:
43         dh_testdir
44         ./autogen.sh
45         touch configure-stamp
46
47 build: build-stamp
48
49 build-stamp:  config.status
50         dh_testdir
51
52         # commands to compile the package.
53         $(MAKE)
54         touch build-stamp
55
56
57 clean:
58         dh_testdir
59         dh_testroot
60         rm -f build-stamp 
61
62 # commands to clean up after the build process.
63         -$(MAKE) distclean
64 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
65         cp -f /usr/share/misc/config.sub config.sub
66 endif
67 ifneq "$(wildcard /usr/share/misc/config.guess)" ""
68         cp -f /usr/share/misc/config.guess config.guess
69 endif
70         dh_clean 
71
72 install: build
73         dh_testdir
74         dh_testroot
75         dh_clean -k 
76         dh_installdirs
77
78 # install the package into debian/tmp/
79         $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
80
81 ifeq "$(strip $(LAUNCHER))" "yes"
82         mv $(CURDIR)/debian/tmp/usr/bin/modest \
83         $(CURDIR)/debian/modest/usr/bin/modest.launch
84         ln -s /usr/bin/maemo-invoker \
85         $(CURDIR)/debian/modest/usr/bin/modest
86 endif
87
88 # ACHTUNG: hack
89 # we remove the modest.mo english localization, if the current control file contains a reference
90 # to modest-l10n-mr0; thus, the modest package will not conflict with that one.
91 # if modest-l10n-mr0 is not there, we'll install our own (en_GB) .mo file.
92         if grep -q modest-l10n-mr0 $(CURDIR)/debian/control ; then rm $(CURDIR)/debian/tmp/usr/share/locale/en_GB/LC_MESSAGES/modest.mo ; else echo "modest.mo not removed."; fi
93
94
95 # Build architecture-independent files here.
96 binary-indep: build install
97 # We have nothing to do by default.
98
99 # Build architecture-dependent files here.
100 binary-arch: build install
101         dh_testdir
102         dh_testroot
103         dh_installchangelogs 
104         dh_installdocs
105         dh_installexamples
106         dh_install --sourcedir=debian/tmp -v
107         dh_installmenu
108 #       dh_installdebconf       
109 #       dh_installlogrotate
110 #       dh_installemacsen
111 #       dh_installpam
112 #       dh_installmime
113 #       dh_installinit
114 #       dh_installcron
115 #       dh_installinfo
116         dh_installman
117         dh_link
118         dh_strip --keep-debug --dbg-package=modest --dbg-package=libmodest-dbus-client
119         dh_compress
120         dh_fixperms
121 #       dh_perl
122 #       dh_python
123         dh_makeshlibs
124         dh_installdeb
125         dh_shlibdeps
126         dh_gencontrol -- $(LAUNCHER_DEPENDS)
127         dh_md5sums
128         dh_builddeb
129
130 binary: binary-indep binary-arch
131 .PHONY: build clean binary-indep binary-arch binary install