* Fixes NB#76991, the send/receive refreshes the current folder as well
[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 LAUNCHER = no
29 #ifneq (,$(findstring maemo-launcher,$(DEB_BUILD_OPTIONS)))
30 #       LAUNCHER = yes
31 #endif
32
33 ifeq "$(strip $(LAUNCHER))" "yes"
34         LAUNCHER_DEPENDS = -Vlauncher:Depends="maemo-launcher"
35         LAUNCHER_CFLAGS = -shared
36         LAUNCHER_LDFLAGS = -pie -shared -export-dynamic
37         CFLAGS += -fPIC
38 endif
39
40
41 config.status: configure
42         dh_testdir
43         # commands to configure the package.
44         if [ ! -x configure ]; then ./autogen.sh; fi
45         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
46
47 configure: configure-stamp
48 configure-stamp:
49         dh_testdir
50         ./autogen.sh
51         touch configure-stamp
52
53 build: build-stamp
54
55 build-stamp:  config.status
56         dh_testdir
57
58         # commands to compile the package.
59         $(MAKE) \
60          MAEMO_LAUNCHER_CFLAGS="$(LAUNCHER_CFLAGS)" \
61          MAEMO_LAUNCHER_LDFLAGS="$(LAUNCHER_LDFLAGS)"
62         touch build-stamp
63
64
65 clean:
66         dh_testdir
67         dh_testroot
68         rm -f build-stamp 
69
70 # commands to clean up after the build process.
71         -$(MAKE) distclean
72 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
73         cp -f /usr/share/misc/config.sub config.sub
74 endif
75 ifneq "$(wildcard /usr/share/misc/config.guess)" ""
76         cp -f /usr/share/misc/config.guess config.guess
77 endif
78         dh_clean 
79
80 install: build
81         dh_testdir
82         dh_testroot
83         dh_clean -k 
84         dh_installdirs
85
86 # install the package into debian/tmp/
87         $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
88
89 ifeq "$(strip $(LAUNCHER))" "yes"
90         mv $(CURDIR)/debian/tmp/usr/bin/modest \
91         $(CURDIR)/debian/modest/usr/bin/modest.launch
92         ln -s /usr/bin/maemo-invoker \
93         $(CURDIR)/debian/modest/usr/bin/modest
94 endif
95
96 # ACHTUNG: hack
97 # we remove the modest.mo english localization, if the current control file contains a reference
98 # to modest-l10n-mr0; thus, the modest package will not conflict with that one.
99 # if modest-l10n-mr0 is not there, we'll install our own (en_GB) .mo file.
100         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
101
102
103 # Build architecture-independent files here.
104 binary-indep: build install
105 # We have nothing to do by default.
106
107 # Build architecture-dependent files here.
108 binary-arch: build install
109         dh_testdir
110         dh_testroot
111         dh_installchangelogs 
112         dh_installdocs
113         dh_installexamples
114         dh_install --sourcedir=debian/tmp -v
115         dh_installmenu
116 #       dh_installdebconf       
117 #       dh_installlogrotate
118 #       dh_installemacsen
119 #       dh_installpam
120 #       dh_installmime
121 #       dh_installinit
122 #       dh_installcron
123 #       dh_installinfo
124         dh_installman
125         dh_link
126         dh_strip --keep-debug --dbg-package=modest --dbg-package=libmodest-dbus-client
127         dh_compress
128         dh_fixperms
129 #       dh_perl
130 #       dh_python
131         dh_makeshlibs
132         dh_installdeb
133         dh_shlibdeps
134         dh_gencontrol -- $(LAUNCHER_DEPENDS)
135         dh_md5sums
136         dh_builddeb
137
138 binary: binary-indep binary-arch
139 .PHONY: build clean binary-indep binary-arch binary install