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