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