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