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