source: osm/applications/editors/josm/debian/make_install_files.sh@ 26673

Last change on this file since 26673 was 16661, checked in by joerg, 15 years ago

Be more verbose in case of josm compiler errors

  • Property svn:executable set to *
File size: 8.1 KB
Line 
1#!/bin/bash
2
3dst_path=debian/openstreetmap-josm
4
5#test -n "$1" || help=1
6quiet=" -q "
7verbose=1
8
9do_update_icons=true
10do_update_josm=true
11do_update_josm_ng=true
12do_update_plugins=true
13do_remove_jar=true
14do_cleanup=true
15
16for arg in "$@" ; do
17 case $arg in
18 --dest-path=*) # Destination path to install the final *.jar Files
19 dst_path=${arg#*=}
20 ;;
21
22 --no-update-icons) # Do not update icons
23 do_update_icons=false
24 ;;
25
26 --no-update-josm) # Do not update Josm
27 do_update_josm=false
28 ;;
29
30 --no-update-josm-ng) # Do not update Josm-NG
31 do_update_josm_ng=false
32 ;;
33
34 --no-update-plugins) # Do not update the plugins
35 do_update_plugins=false
36 ;;
37
38 --no-remove-jar) # Do not remove old jar Files
39 do_remove_jar=false
40 ;;
41
42 --no-clean) # no cleanup before build
43 do_cleanup=false
44 ;;
45
46 *)
47 echo ""
48 echo "!!!!!!!!! Unknown option $arg"
49 echo ""
50 help=1
51 ;;
52 esac
53done
54
55if [ -n "$help" ] ; then
56 # extract options from case commands above
57 options=`grep -E -e esac -e '\s*--.*\).*#' $0 | sed '/esac/,$d;s/.*--/ [--/; s/=\*)/=val]/; s/)[\s ]/]/; s/#.*\s*//; s/[\n/]//g;'`
58 options=`for a in $options; do echo -n " $a" ; done`
59 echo "$0 $options"
60 echo "
61
62 This script tries to compile and copy all josm Files
63 and all the plugins.
64 In case a plugin will not compile it is omitted.
65 "
66 # extract options + description from case commands above
67 grep -E -e esac -e '--.*\).*#' -e '^[\t\s ]+#' $0 | \
68 grep -v /bin/bash | sed '/esac/,$d;s/.*--/ --/;s/=\*)/=val/;s/)//;s/#//;'
69 exit;
70fi
71
72
73# define colors
74ESC=`echo -e "\033"`
75RED="${ESC}[91m"
76GREEN="${ESC}[92m"
77YELLOW="${ESC}[93m"
78BLUE="${ESC}[94m"
79MAGENTA="${ESC}[95m"
80CYAN="${ESC}[96m"
81WHITE="${ESC}[97m"
82BG_RED="${ESC}[41m"
83BG_GREEN="${ESC}[42m"
84BG_YELLOW="${ESC}[43m"
85BG_BLUE="${ESC}[44m"
86BG_MAGENTA="${ESC}[45m"
87BG_CYAN="${ESC}[46m"
88BG_WHITE="${ESC}[47m"
89BRIGHT="${ESC}[01m"
90UNDERLINE="${ESC}[04m"
91BLINK="${ESC}[05m"
92REVERSE="${ESC}[07m"
93NORMAL="${ESC}[0m"
94
95echo "copying Files to '$dst_path'"
96package_name=openstreetmap-josm
97dst_path=${dst_path%/}
98
99jar_path="$dst_path/usr/local/share/josm"
100mkdir -p "$jar_path"
101
102bin_path="$dst_path/usr/bin"
103mkdir -p "$bin_path"
104
105#plugin_dir="$dst_path/usr/local/share/josm/plugins"
106plugin_dir="$dst_path/usr/lib/josm/plugins"
107mkdir -p "$plugin_dir"
108
109mkdir -p "$dst_path/usr/share/josm"
110#( # map-icons to be symlinked
111# cd "$dst_path/usr/share/josm"
112# ln -s ../map-icons/classic.small images
113#)
114
115# --------------------------------------------
116# Try to update Icons
117if $do_update_icons ; then
118 echo "Now we try our best ... to get more icons ..."
119 find ../../share/map-icons/build/square.small -type f -name "*.png" | while read src_file ; do
120 file=${src_file#.*square.small/}
121 dst_dir="plugins/mappaint/icons/`dirname $file`"
122 mkdir -p $dst_dir
123 #echo "File $file"
124 cp -u "$src_file" "plugins/mappaint/icons/$file"
125 done
126fi
127mkdir -p "$dst_path/usr/lib/josm"
128
129# ------------------------------------------------------------------
130# Remove Old Jar Files in dist/*.jar
131
132$do_cleanup && {
133 $do_remove_jar && rm -f dist/*.jar
134 $do_remove_jar && rm -f plugins/*/dist/*.jar
135 }
136
137# ------------------------------------------------------------------
138# Compile the Josm Main File(s)
139if $do_update_josm ; then
140 echo "------------- Compile Josm"
141 cd core
142 $do_cleanup && ant clean 2>build.err
143 ant dist >>build.log 2>>build.err
144 rc=$?
145 if [ "$rc" -ne "0" ] ; then
146 cat build.log build.err
147 echo "${BG_RED}!!!!!!!!!! ERROR $rc compiling josm core${NORMAL}"
148 echo "${BG_RED}!!!!!!!!!! See build.log build.err${NORMAL}"
149 exit -1
150 fi
151 cd ..
152fi
153
154# ------------------------------------------------------------------
155# Try to Compile as many Josm Plugins as possible
156if $do_update_plugins ; then
157 echo "------------- Compile Josm Plugin webkit-image for wmsplugin"
158 cd plugins/wmsplugin
159 $do_cleanup && make clean
160 make
161 cd ../..
162 cp plugins/wmsplugin/webkit-image $bin_path/webkit-image
163fi
164# ------------------------------------------------------------------
165# Try to Compile as many Josm Plugins as possible
166if $do_update_plugins ; then
167 echo "------------- Compile Josm Plugins"
168 compiling_error=''
169 compiling_ok=''
170 cd plugins
171 plugins=`ls */build.xml | sed s,/build.xml,,`
172 echo "Plugins(`echo "$plugins"| wc -l`): " $plugins
173 for dir in $plugins; do
174 cd $dir
175 echo -n -e "----- $dir\r"
176 $do_cleanup && {
177 $do_remove_jar && rm -f dist/*.jar
178 $do_remove_jar && rm -f ../../dist/$dir.jar
179 rm -f *.log
180 echo "ant clean" >build.log
181 echo "ant clean" >build.err
182 ant -q clean >>build.log 2>>build.err
183 }
184 echo "ant dist" >>build.log
185 echo "ant dist" >>build.err
186 ant -q dist >>build.log 2>>build.err
187 rc=$?
188 number_of_jar=`(find . -name "*.jar" ;find ../../dist -name "$dir.jar")| grep -v '/lib'| wc -l`
189 if [ "$rc" -eq "0" ] ; then
190 echo "${GREEN}------------------------- compiling $dir successfull${NORMAL} ( $number_of_jar jar Files)"
191 grep -i -e error -e warn *.log *.err
192 compiling_ok="$compiling_ok $dir"
193 else
194 echo "${BG_RED}!!!!!!!!!! ERROR compiling $dir${NORMAL} ( $number_of_jar jar Files)"
195 #echo "Details see:"
196 #echo " `pwd`/build.log"
197 #echo " `pwd`/build.err"
198 compiling_error="$compiling_error $dir"
199 fi
200 find . -name "*.jar" | grep -v -e '/lib'
201
202 cd ..
203 done
204 if [ -n "$compiling_error" ] ; then
205 echo "${BG_RED}!!!!!!!!!! ERROR compiling Plugins${NORMAL}"
206 echo "Details see:"
207
208 err_log_path=''
209 for dir in $compiling_error; do
210 echo " `pwd`/$dir/build.log"
211 err_log_path="$err_log_path $dir/build.log $dir/build.err"
212 done
213 zip -q errors.zip $err_log_path
214 echo "${RED}Combined ERROR Logfiles are at: `pwd`/errors.zip${NORMAL}"
215 echo "${RED}Compiling ERRORs(`echo "$compiling_error"| wc -w`): $compiling_error${NORMAL}"
216 fi
217 echo "Compiling OK(`echo "$compiling_ok"| wc -w`): $compiling_ok"
218 cd ..
219fi
220
221# ------------------------------------------------------------------
222# Compile the Josm-ng Files
223if $do_update_josm_ng ; then
224 echo "------------- Compile Josm-ng"
225 cd ../josm-ng
226 $do_cleanup && ant -q clean
227 ant -q josm-ng-impl.jar >>build.log 2>>build.err
228 rc=$?
229 if [ "$rc" -ne "0" ] ; then
230 echo "------------- ERROR Compiling Josm-ng"
231 echo "${RED}!!!!!!!!!!!!!!!!! WARNING Josm-NG is not included into the package${NORMAL}"
232 #exit -1
233 fi
234 cd ../josm
235fi
236
237
238# ------------------------------------------------------------------
239echo "------------- Copy Jar Files"
240
241cp ./core/dist/josm-custom.jar $jar_path/josm.jar || exit -1
242rc=$?
243if [ "$rc" -ne "0" ] ; then
244 echo "${RED}------------- ERROR Compiling Josm-ng${NORMAL}"
245fi
246cp ../josm-ng/dist/josm-ng.jar $jar_path/josm-ng.jar || {
247 echo "${RED}!!!!!!!!!!!!!!!!! WARNING Josm-NG is not included into the package${NORMAL}"
248 #exit -1
249}
250
251# Find all existing plugin-jar files and generate a pluginlist from it
252plugin_jars=`find dist -name "*.jar"`
253plugins=''
254for src_fn in $plugin_jars ; do
255 fn="`basename ${src_fn}`"
256 dst_fn="$plugin_dir/$fn"
257 echo "cp $src_fn $dst_fn"
258 cp "$src_fn" "$dst_fn"
259 if [ "$?" -ne "0" ] ; then
260 echo "${RED}------------- ERROR Copying $src_fn ${NORMAL}"
261 exit -1
262 fi
263 plugin_name=${fn%.jar}
264 echo $plugin_name | grep -q -e plastic_laf -e lang && continue
265 plugins="$plugins$plugin_name,"
266done || exit -1
267
268# remove last empty plugin definition ,
269plugins=${plugins%,}
270
271echo "Activated Plugins:"
272echo "$plugins"
273
274# Copy words.cfg for spelling
275mkdir -p "$jar_path/speller"
276cp ../../utils/planet.osm/java/speller/words.cfg "$jar_path/speller/" || {
277 echo "!!!!!!!!!! words.cfg is missing"
278 exit -1
279}
280
281
282# ------------------------------------------------------------------
283cp "debian/bin/josm.sh" "$bin_path/josm" || {
284 echo "!!!!!!!!!! josm.sh is missing"
285 exit -1
286}
287
288cp "debian/bin/josm-ng.sh" "$bin_path/josm-ng" || {
289 echo "!!!!!!!!!!!!!!!!! WARNING Josm-NG is not included into the package"
290 #exit -1
291}
292
293# add plugins to default preferences
294sed "s/PLUGIN_LIST/$plugins/;" <debian/bin/preferences >"$jar_path/preferences" || {
295 echo "!!!!!!!! WARNING cannot create preferences"
296 exit -1
297}
298
299
300# Copy default Bookmarks
301cp nsis/bookmarks "$jar_path/bookmarks"
302
303exit 0
Note: See TracBrowser for help on using the repository browser.