Add systemd service file; create initscripts and db in %install
[framework/messaging/email-service.git] / debian / rules
1 #!/usr/bin/make -f
2 # -*- makefile -*-
3 # Sample debian/rules that uses debhelper.
4 # This file was originally written by Joey Hess and Craig Small.
5 # As a special exception, when this file is copied by dh-make into a
6 # dh-make output file, you may use that output file without restriction.
7 # This special exception was added by Craig Small in version 0.37 of dh-make.
8
9 # Uncomment this to turn on verbose mode.
10 #export DH_VERBOSE=1
11
12
13 # These are used for cross-compiling and for saving the configure script
14 # from having to guess our platform (since we know it already)
15 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
16 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
17
18 CFLAGS ?=
19 CXXFLAGS ?=
20 LDFLAGS ?=
21 PREFIX ?= /usr
22 DATADIR ?= /opt
23
24 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
25         CFLAGS += -O2
26         CXXFLAGS += -O2
27 else
28         CFLAGS += -O0
29         CXXFLAGS += -O0
30 endif
31
32 CFLAGS += -fPIC -Wall -g -fvisibility=hidden
33 CXXFLAGS += -fPIC -Wall -g -fvisibility=hidden
34 LDFLAGS += -Wl,--hash-style=both 
35
36 LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed
37
38 CMAKE_TMP_DIR = $(CURDIR)/cmake_tmp
39
40 configure: configure-stamp
41 configure-stamp:
42         dh_testdir
43         # Add here commands to configure the package.
44
45         mkdir -p $(CMAKE_TMP_DIR);
46         cd $(CMAKE_TMP_DIR); CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" cmake .. -DCMAKE_INSTALL_PREFIX=$(PREFIX)
47         touch configure-stamp
48
49 build: build-stamp
50
51 build-stamp: configure-stamp 
52         dh_testdir
53
54         # Add here commands to compile the package.
55         cd $(CMAKE_TMP_DIR) && $(MAKE)
56         
57         for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
58                 cat $$f > $${f%.in}; \
59                 sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
60                 sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
61         done
62
63         # Make .db file
64         #$(CMAKE_TMP_DIR)/utilities/email-service_initDB create 0 $(CMAKE_TMP_DIR)/utilities 
65
66         touch $@
67
68
69 clean:
70         dh_testdir
71         dh_testroot
72         rm -f build-stamp configure-stamp
73
74         # Add here commands to clean up after the build process.
75         -$(MAKE) clean
76         rm -rf CMakeCache.txt
77         rm -rf CMakeFiles
78         rm -rf cmake_install.cmake
79         rm -rf Makefile
80         rm -rf install_manifest.txt
81         rm -rf *.so
82         rm -rf $(CMAKE_TMP_DIR)
83
84         for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
85                 rm -f $${f%.in}; \
86         done
87
88         # Delete .db file
89         rm -f .*.db .*.db-journal
90         # Delete auto created files
91         rm -f Makefile.in aclocal.m4 configure config.sub config.guess config.h.in depcomp ltmain.sh missing install-sh 
92
93         dh_clean 
94
95 install: build
96         dh_testdir
97         dh_testroot
98         dh_clean -k 
99         dh_installdirs
100
101         # Add here commands to install the package into debian/mm-log.
102         cd $(CMAKE_TMP_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
103         mkdir -p $(CURDIR)/debian/tmp/opt/dbspace
104         #cp $(CMAKE_TMP_DIR)/utilities/.email-service.db $(CURDIR)/debian/tmp/opt/dbspace
105         #cp $(CMAKE_TMP_DIR)/utilities/.email-service.db-journal $(CURDIR)/debian/tmp/opt/dbspace
106
107
108 # Build architecture-independent files here.
109 binary-indep: build install
110 # We have nothing to do by default.
111
112 # Build architecture-dependent files here.
113 binary-arch: build install
114         dh_testdir
115         dh_testroot
116         dh_installchangelogs 
117         dh_installdocs
118         dh_installexamples
119         dh_install --sourcedir=debian/tmp
120 #       dh_installmenu
121 #       dh_installdebconf       
122 #       dh_installlogrotate
123 #       dh_installemacsen
124 #       dh_installpam
125 #       dh_installmime
126 #       dh_python
127 #       dh_installinit
128 #       dh_installcron
129 #       dh_installinfo
130         dh_installman
131         dh_link
132 #       dh_strip
133         dh_strip --dbg-package=email-service-dbg
134         dh_compress
135         dh_fixperms
136 #       dh_perl
137         dh_makeshlibs
138         dh_installdeb
139         dh_shlibdeps
140         dh_gencontrol
141         dh_md5sums
142         dh_builddeb
143
144 binary: binary-indep binary-arch
145 .PHONY: build clean binary-indep binary-arch binary install 
146