changing condition for sending WS_DBUS_WORDS_LIST_FULL signal;
[mdictionary] / Makefile
1 ARCH = `arch`
2 REP_TAG = ../tags
3 REP_BRANCH = branches
4
5 DEB_REP_DIR = www
6
7 #declaration of directory names
8 BINARIES = bin
9 SOURCE = src
10 INCLUDE = include
11 DATA = data
12 PLUGINS = ${SOURCE}/plugins
13 XDXF_PLUGIN = ${PLUGINS}/xdxf
14 STARDICT_PLUGIN = ${PLUGINS}/stardict
15 GUI = ${SOURCE}/gui
16 MANAGER = ${SOURCE}/manager
17 DBUS = ${SOURCE}/dbus_wrapper
18 BOOKMARKS:=bdb
19 BOOKMARKS_DIR = ${SOURCE}/bookmarks/${BOOKMARKS}
20 DESTDIR = 
21
22 ifeq (${BOOKMARKS}, sql)
23         SQLITE:=-DSQLITE=0
24 endif
25
26 ifeq (${BOOKMARKS}, sql3)
27         SQLITE:=-DSQLITE=3
28 endif
29
30 PACKAGES = packages
31
32 #probably trash
33 STARDICT = stardict
34 APP_NAME = whitestork
35
36 #versions
37 MAJOR_VER = 1
38 MINOR_VER = 0
39 RELEASE_MAJOR_VER = 1
40 RELEASE_MINOR_VER = 0
41 RELEASE_PATCH_VER = 1
42 PACK_VER = 0
43 FRM_VER = 0.1
44
45 # VERSION_FILE = ./${INCLUDE}/ws_version.h
46
47 #package structure
48 GUI_PACK_NAME = whitestorkgui
49 MNG_PACK_NAME = whitestork
50 PLUGINS_PACK_NAME = whitestorkplugins
51 BOOKMARKS_PACK_NAME = whitestorkbookmarks
52 META_PACK_NAME = whitestorkdictionary
53
54 GUI_EXECUTABLE = ${BINARIES}/WhiteStork
55 GUI_SERVICEFILE = org.maemo.WhiteStorkGui.service
56 GUI_DIRS = ${DESTDIR}/usr/bin ${DESTDIR}/usr/share/applications/hildon ${DESTDIR}/usr/share/pixmaps ${DESTDIR}/usr/share/mis ${DESTDIR}/usr/share/dbus-1/services ${DESTDIR}/usr/share/locale  
57 #${DESTDIR}/usr/share/doc/whitestorkgui
58 GUI_DBUS = ${DATA}/other/${GUI_SERVICEFILE}
59 GUI_ICONS = ${DATA}/icons/whitestork_icon.png ${DATA}/icons/whitestork.png ${DATA}/icons/ws_top.png ${DATA}/icons/qgn_indi_search_whitestork.png ${DATA}/icons/ws_tra.png
60 GUI_LOCALE = ${DATA}/locale/out/
61 GUI_DOC = ${DATA}/docs/${GUI_PACK_NAME}/
62 GUI_OTHER = ${DATA}/other/whitestork.desktop
63 GUI_MIS = ${DATA}/mis/whitestork-search.xml
64
65 MNG_EXECUTABLE = ${BINARIES}/WhiteStorkManager 
66 MNG_SERVICEFILE = org.maemo.WhiteStorkManager.service
67 MNG_LIB = ${BINARIES}/ws_bookmark.so
68 MNG_DIRS = ${DESTDIR}/usr/bin ${DESTDIR}/usr/lib/WhiteStork ${DESTDIR}/usr/share/dbus-1/services  ${DESTDIR}/usr/share/WhiteStork ${DESTDIR}/usr/share/doc/${MNG_PACK_NAME}
69 MNG_DBUS = ${DATA}/other/${MNG_SERVICEFILE}
70 MNG_OTHER = ${DATA}/dictionaries 
71 MNG_DICT1 = ${DATA}/dictionaries/elements/dict.cache ${DATA}/dictionaries/elements/dict.xdxf ${DESTDIR}/usr/share/WhiteStork/dictionaries/elements/
72 MNG_DICT2 = ${DATA}/dictionaries/us-en/dict.xdxf ${DESTDIR}/usr/share/WhiteStork/dictionaries/us-en/
73 MNG_DICT_DIRS = ${DESTDIR}/usr/share/WhiteStork/dictionaries/elements/ ${DESTDIR}/usr/share/WhiteStork/dictionaries/us-en/
74 MNG_BOOKMARKS = ${DATA}/bookmarks/${BOOKMARKS}/*
75 MNG_DOC = ${DATA}/docs/${MNG_PACK_NAME}/
76
77 PLUGINS_LIB = ${BINARIES}/engine_*.so
78 PLUGINS_DIRS = ${DESTDIR}/usr/lib/WhiteStork ${DESTDIR}/usr/share/pixmaps
79 #${DESTDIR}/usr/share/doc/${PLUGINS_PACK_NAME} 
80 PLUGINS_ICONS = ${DATA}/icons/engine_xdxf_icon.png
81 PLUGINS_DOC = ${DATA}/docs/${PLUGINS_PACK_NAME}/
82
83 META_DIRS = ${PACKAGES}/${META_PACK_NAME}/usr/share/doc/${META_PACK_NAME}
84 META_DOC = ${DATA}/docs/${META_PACK_NAME}/
85
86 MAIL_ADDRESS = mdictionary-devel@garage.maemo.org
87 LOCALEDIR=/usr/share/locale
88 GETTEXT_PACKAGE=whitestork
89 ALL_LINGUAS="en_GB"
90
91
92 ifeq (${MAKECMDGOALS}, release-package)
93         APP_VER = ${RELEASE_MAJOR_VER}.${RELEASE_MINOR_VER}.${RELEASE_PATCH_VER}
94 else
95         APP_VER = ${MAJOR_VER}.${MINOR_VER}.`svn info | grep "Revision:" | awk '{print $$2}'`
96 endif
97
98 FILES = ${DATA}/files_debbuild
99 LOG_DIR = logs
100 LOG_CLEAN = ${LOG_DIR}/clean.log
101 LOG_BUILD = ${LOG_DIR}/build.log
102 LOG_RUN = ${LOG_DIR}/run.log
103 LOG_DEBS = ${LOG_DIR}/debs.log
104 LOG_INST = ${LOG_DIR}/install.log
105
106 first: build
107         @echo -e -n ""
108
109 tag-version: clean
110                 @install -d ${REP_TAG}/${APP_NAME}-${APP_VER}
111                 @tar -czf ${REP_TAG}/${APP_NAME}-${APP_VER}/${APP_NAME}-${APP_VER}.tar.gz ../trunk/* --exclude .svn
112                 @svn add ${REP_TAG}/${APP_NAME}-${APP_VER} 
113                 @svn ci ${REP_TAG}/${APP_NAME}-${APP_VER} -m "Tagged new version: ${APP_NAME}-${APP_VER}"
114
115 send-last:      debs
116                 @tar -czf ${APP_NAME}-${APP_VER}.tar.gz *_${APP_VER}-${PACK_VER}_${ARCH}.deb
117                 @echo -e -n "#!/bin/bash\n\
118                         mutt -x -a ~/debs.log -a ~/build.log -a ~/${APP_NAME}-${APP_VER}.tar.gz -s \"[WhiteStork]: daily build - version ${APP_NAME}-${APP_VER}\" ${MAIL_ADDRESS} <~/mail.content\n\
119                         rm -f ~/${APP_NAME}-${APP_VER}.tar.gz\n" > mail.script
120
121                 @chmod +x mail.script
122
123                 @echo -e -n "\
124                         This message was generated automatically , please do not reply.\n\
125                         Attachment: ${APP_NAME}-${APP_VER}.tar.gz - tarball with the newest Whitestork's packages.\n\
126                         Attachment: build.log - logs from building binaries.\n\
127                         Attachment: debs.log - logs from making *.deb packages.\n\n\
128                         Automatic Building Framework ver: ${FRM_VER}\nCopyright 2006 ComArch S.A.\n" > mail.content
129                 @scp ${APP_NAME}-${APP_VER}.tar.gz krzsas@localhost:~/
130                 @scp ${LOG_BUILD} krzsas@localhost:~/
131                 @scp ${LOG_DEBS} krzsas@localhost:~/
132                 @scp mail.script krzsas@localhost:~/
133                 @scp mail.content krzsas@localhost:~/
134                 @rm -f mail.script
135                 @rm -f mail.content
136                 @ssh krzsas@localhost  ./mail.script
137
138 localization:
139                 @echo -e -n "Generating locale...\n"
140                 @echo -e -n "Generating locale...\n" > ${LOG_BUILD}
141                 
142                 @./generate_locale ${DATA}/locale/ ${GUI_LOCALE}
143                 @echo -e -n "Locale generation successfully completed...\n"
144                 @echo -e -n "Locale generation successfully completed...\n" > ${LOG_BUILD}
145
146 build: pre-build  ${BINARIES}/ws_dbus.o ${BINARIES}/WhiteStork ${BINARIES}/WhiteStorkManager ${BINARIES}/ws_bookmark.so plugins
147                 @echo -e -n "\nBuilding WhiteStork is finished.\n"
148
149 pre-build:
150                 @echo -e -n "Building WhiteStork... \n"
151                 @echo -e -n "" > ${LOG_BUILD}
152
153 plugins: ${BINARIES}/engine_xdxf.so ${BINARIES}/engine_stardict.so
154                 
155
156 ${BINARIES}/WhiteStorkManager: 
157 # update-version
158                 @echo -e -n "**--> Compiling Manager...\n"
159                 @echo -e -n "**--> Compiling Manager...\n" >> ${LOG_BUILD}
160                 @make SQLITE=${SQLITE} -C ${MANAGER} >> ${LOG_BUILD}
161
162 ${BINARIES}/ws_dbus.o:
163                 @echo -e -n "**--> Compiling D-BUS Wrapper... \n"
164                 @echo -e -n "**--> Compiling D-BUS Wrapper... \n" >> ${LOG_BUILD}
165 #               @cd ${DBUS} && make >> ../../${LOG_BUILD}
166                 @make -C ${DBUS} >> ${LOG_BUILD}
167
168 ${BINARIES}/WhiteStork: 
169 #update-version
170                 @echo -e -n "**--> Compiling User Interface...\n"
171                 @echo -e -n "**--> Compiling User Interface...\n" >> ${LOG_BUILD}
172 #               @cd ${GUI} && make APP_VER=${APP_VER} >> ../../${LOG_BUILD}
173                 @make APP_VER=${APP_VER} -C ${GUI} >> ${LOG_BUILD}
174
175 ${BINARIES}/engine_xdxf.so: 
176 # update-version
177                 @echo -e -n "**--> Compiling XDXF Engine...\n"
178                 @echo -e -n "**--> Compiling XDXF Engine...\n" >> ${LOG_BUILD}
179 #               @cd ${XDXF_PLUGIN} && make >> ../../../${LOG_BUILD}
180                 @make -C ${XDXF_PLUGIN} >> ${LOG_BUILD}
181
182 ${BINARIES}/engine_stardict.so:  
183 # update-version
184                 @echo -e -n "**--> Compiling StarDict Engine...\n"
185                 @echo -e -n "**--> Compiling StarDict Engine...\n" >> ${LOG_BUILD}
186 #               @cd ${STARDICT_PLUGIN} && make >> ../../../${LOG_BUILD}
187                 @make -C ${STARDICT_PLUGIN} >> ${LOG_BUILD}
188
189 ${BINARIES}/ws_bookmark.so: 
190 # update-version
191                 @echo -e -n "**--> Compiling Bookmarks...\n"
192                 @echo -e -n "**--> Compiling Bookmarks...\n" >> ${LOG_BUILD}
193                 @make -C ${BOOKMARKS_DIR} >> ${LOG_BUILD}
194                 
195 clean-logs:      
196                 @echo -e -n "Cleaning all logs\n"
197                 @rm -f ${LOG_DIR}/*.log
198
199 clean: clean-logs
200                 @-echo -e -n "Cleaning project directories\n"
201                 @echo -e -n "" > ${LOG_CLEAN}
202                 @-rm -f ${BINARIES}/* >> ${LOG_CLEAN} 2>> ${LOG_CLEAN}
203                 @-rm -f *~ >> ${LOG_CLEAN} 2>> ${LOG_CLEAN}
204                 @-rm -f *.deb >> ${LOG_CLEAN} 2>> ${LOG_CLEAN}
205                 @-rm -rf ${PACKAGES}/*
206                 @-make -C ${GUI} clean >> ${LOG_CLEAN} 2>> ${LOG_CLEAN}
207                 @-make -C ${DBUS} clean >> ${LOG_CLEAN} 2>> ${LOG_CLEAN}
208                 @-make -C ${XDXF_PLUGIN} clean >> ${LOG_CLEAN} 2>> ${LOG_CLEAN}
209                 @-make -C ${STARDICT_PLUGIN} clean >> ${LOG_CLEAN} 2>> ${LOG_CLEAN}
210                 @-cd ${MANAGER} && make clean >> ../../${LOG_CLEAN} 2>> ../../${LOG_CLEAN}
211                 @-make -C ${MANAGER} clean >> ${LOG_CLEAN} 2>> ${LOG_CLEAN}
212                 @find src/bookmarks/ -mindepth 1 -maxdepth 1 -type d -not -name .svn -exec make -C {} clean >> ${LOG_CLEAN} 2>> ${LOG_CLEAN} \;
213                 @-rm -rf ${GUI_LOCALE}*
214                 
215 #               @-cd ${GUI} && make clean >> ../../${LOG_CLEAN} 2>> ../../${LOG_CLEAN}
216 #               @-cd ${DBUS} && make clean >> ../../${LOG_CLEAN} 2>> ../../${LOG_CLEAN}
217 #               @-cd ${XDXF_PLUGIN} && make clean >> ../../../${LOG_CLEAN} 2>> ../../../${LOG_CLEAN}
218 #               @-cd ${STARDICT_PLUGIN} && make clean >> ../../../${LOG_CLEAN} 2>> ../../../${LOG_CLEAN}
219 #               @-cd ${BOOKMARKS_DIR} && make clean >> ../../../${LOG_CLEAN} 2>> ../../../${LOG_CLEAN}
220
221 run: clean install entries run-dict clean-temp
222
223
224 run-dict:
225                 @run-standalone.sh WhiteStorkManager
226
227 clean-temp:
228                 @-fakeroot rm -rf /usr/share/WhiteStork
229                 @-fakeroot rm -rf /usr/lib/WhiteStork
230                 @-fakeroot rm -rf /usr/include/WhiteStork
231                 @-fakeroot rm -f /etc/others-menu/extra_applications/0112_whitestorkgui.desktop
232                 @-fakeroot rm -f /usr/share/applications/hildon/whitestorkgui.desktop 
233                 @-fakeroot rm -f /usr/share/pixmaps/whitestork.png 
234                 @-fakeroot rm -f /usr/share/pixmaps/whitestork_icon.png
235                 @-fakeroot rm -f /usr/bin/WhiteStork
236                 @-fakeroot rm -f /usr/bin/WhiteStorkManager
237                 @-fakeroot rm -f /usr/share/applications/hildon/whitestorkgui.desktop 
238                 @-fakeroot rm -f /usr/lib/WhiteStork/engine_xdxf.so
239                 @-fakeroot rm -f /usr/lib/WhiteStork/engine_stardict.so
240
241                 gconftool-2 --recursive-unset /apps/maemo/WhiteStork
242
243 install-manager: localization ${BINARIES}/ws_dbus.o  ${BINARIES}/ws_bookmark.so ${BINARIES}/WhiteStorkManager
244                 @install -d ${MNG_DIRS}
245                 @cp ${MNG_EXECUTABLE} ${DESTDIR}/usr/bin
246                 @cp ${MNG_LIB} ${DESTDIR}/usr/lib/WhiteStork
247                 @cp ${MNG_DBUS} ${DESTDIR}/usr/share/dbus-1/services
248                 @find  ${MNG_DOC} -type f -not -path *.svn* -exec cp {} ${DESTDIR}/usr/share/doc/${MNG_PACK_NAME} \;
249                 
250 #               @install -d ${MNG_DICT_DIRS}
251 #               @cp ${MNG_DICT1}
252 #               @cp ${MNG_DICT2}
253                 
254                 @install -d ${DESTDIR}/usr/share/WhiteStork/dictionaries/bookmarks
255                 @cp -rf ${MNG_BOOKMARKS} ${DESTDIR}/usr/share/WhiteStork/dictionaries/bookmarks
256                 
257 install-gui:    ${BINARIES}/ws_dbus.o ${BINARIES}/WhiteStork 
258                 @install -d ${GUI_DIRS}
259                 @cp ${GUI_EXECUTABLE} ${DESTDIR}/usr/bin
260                 @cp ${GUI_ICONS} ${DESTDIR}/usr/share/pixmaps
261                 @cp ${GUI_DBUS} ${DESTDIR}/usr/share/dbus-1/services
262                 @cp ${GUI_OTHER} ${DESTDIR}/usr/share/applications/hildon
263                 @cp ${GUI_MIS} ${DESTDIR}/usr/share/mis
264                 @cp -a ${GUI_LOCALE}* ${DESTDIR}/usr/share/locale/              
265 #               @find  ${GUI_DOC} -type f -not -path *.svn* -exec cp {} ${DESTDIR}/usr/share/doc/${GUI_PACK_NAME} \;
266
267 install-plugins: plugins
268                 @install -d ${PLUGINS_DIRS}
269                 @cp ${PLUGINS_LIB} ${DESTDIR}/usr/lib/WhiteStork
270                 @cp ${PLUGINS_ICONS} ${DESTDIR}/usr/share/pixmaps
271                 @install -d ${MNG_DICT_DIRS}
272                 @cp ${MNG_DICT1}
273                 @cp ${MNG_DICT2}
274 #               @find  ${PLUGINS_DOC} -type f -not -path *.svn* -exec cp {} ${DESTDIR}/usr/share/doc/${PLUGINS_PACK_NAME} \;
275
276 install:        install-manager install-gui install-plugins
277                 @echo -e "\n\nIf you are installing whitestork, please run 'make entries', before running the application ( not as root )\n\n"
278
279 entries:        
280                 gconftool-2 --type string --set /apps/maemo/WhiteStork/Dictionaries/elements/name "Elements Database"
281                 gconftool-2 --type string --set /apps/maemo/WhiteStork/Dictionaries/elements/path "/usr/share/WhiteStork/dictionaries/elements"
282                 gconftool-2 --type bool --set /apps/maemo/WhiteStork/Dictionaries/elements/active true
283                 gconftool-2 --type bool --set /apps/maemo/WhiteStork/Dictionaries/elements/optimized true
284                 gconftool-2 --type string --set /apps/maemo/WhiteStork/Dictionaries/us-en/name "American - English Dictionary"
285                 gconftool-2 --type string --set /apps/maemo/WhiteStork/Dictionaries/us-en/path "/usr/share/WhiteStork/dictionaries/us-en"
286                 gconftool-2 --type bool --set /apps/maemo/WhiteStork/Dictionaries/us-en/active true
287                 gconftool-2 --type bool --set /apps/maemo/WhiteStork/Dictionaries/us-en/optimized false
288                 
289                 gconftool-2 --type string --set /apps/maemo/WhiteStork/Engines/bookmarks/path "/usr/lib/WhiteStork/ws_bookmark.so"
290                 gconftool-2 --type string --set /apps/maemo/WhiteStork/Dictionaries/bookmarks/name "Bookmarks"
291                 gconftool-2 --type string --set /apps/maemo/WhiteStork/Dictionaries/bookmarks/path "/usr/share/WhiteStork/dictionaries/bookmarks"
292                 gconftool-2 --type bool --set /apps/maemo/WhiteStork/Dictionaries/bookmarks/active false
293                 gconftool-2 --type bool --set /apps/maemo/WhiteStork/Dictionaries/bookmarks/optimized true
294                 chmod -R 0777 /usr/share/WhiteStork/dictionaries
295                 
296                 gconftool-2 --type string --set /apps/maemo/WhiteStork/Engines/xdxf/path "/usr/lib/WhiteStork/engine_xdxf.so"
297                 gconftool-2 --type string --set /apps/maemo/WhiteStork/Engines/stardict/path "/usr/lib/WhiteStork/engine_stardict.so"
298                 
299 #               maemo-select-menu-location whitestork.desktop
300
301
302 install_deb: clean-inst-log uninstall eng-deb-i mng-deb-i gui-deb-i
303                 @echo -e -n "All packages have been installed/reinstalled.\n"
304
305 clean-inst-log: 
306                 @echo -n "" > ${LOG_INST}
307
308 uninstall:
309                 @-fakeroot dpkg --purge whitestork
310 #               @-fakeroot dpkg --purge whitestorkdictionary
311
312 display: access
313                 @fakeroot su ${USER} -c 'af-sb-init.sh start'   
314
315 display-s: access
316                 @fakeroot su ${USER} -c 'af-sb-init.sh stop'
317
318 display-r: access
319                 @fakeroot su ${USER} -c 'af-sb-init.sh restart'
320
321 access:
322                 @fakeroot chmod 0777 /var/run
323
324 release-package: clean debs meta-package
325                 @echo "Release package generation successfully completed"
326
327 snapshot: tag-version send-last
328
329 repo:   release-package meta-package
330
331         @rm -rf ${DEB_REP_DIR}
332         @./generate_repo ${DEB_REP_DIR}
333         
334 package: clean
335         dpkg-buildpackage -rfakeroot