1 | #!/bin/sh |
---|
2 | # This script replaces a make ; make install for creation of the debian package. |
---|
3 | # Maybe you can also use it to install the stuff on your system. |
---|
4 | # If sou please state so here. |
---|
5 | |
---|
6 | dst_path=$1 |
---|
7 | |
---|
8 | if [ ! -n "$dst_path" ] ; then |
---|
9 | echo "Please specify a Directory to use as Basedirectory" |
---|
10 | echo "Usage:" |
---|
11 | echo " $0 <working-dir>" |
---|
12 | exit -1 |
---|
13 | fi |
---|
14 | |
---|
15 | # define Colors |
---|
16 | ESC=`echo -e "\033"` |
---|
17 | RED="${ESC}[91m" |
---|
18 | GREEN="${ESC}[92m" |
---|
19 | YELLOW="${ESC}[93m" |
---|
20 | BLUE="${ESC}[94m" |
---|
21 | MAGENTA="${ESC}[95m" |
---|
22 | CYAN="${ESC}[96m" |
---|
23 | WHITE="${ESC}[97m" |
---|
24 | BG_RED="${ESC}[41m" |
---|
25 | BG_GREEN="${ESC}[42m" |
---|
26 | BG_YELLOW="${ESC}[43m" |
---|
27 | BG_BLUE="${ESC}[44m" |
---|
28 | BG_MAGENTA="${ESC}[45m" |
---|
29 | BG_CYAN="${ESC}[46m" |
---|
30 | BG_WHITE="${ESC}[47m" |
---|
31 | BRIGHT="${ESC}[01m" |
---|
32 | UNDERLINE="${ESC}[04m" |
---|
33 | BLINK="${ESC}[05m" |
---|
34 | REVERSE="${ESC}[07m" |
---|
35 | NORMAL="${ESC}[0m" |
---|
36 | |
---|
37 | echo "copying Files to '$dst_path'" |
---|
38 | package_name=openstreetmap |
---|
39 | dst_path=${dst_path%/} |
---|
40 | |
---|
41 | perl_path="$dst_path/usr/share/perl5" |
---|
42 | bin_path="$dst_path/usr/bin" |
---|
43 | lib_path="$dst_path/usr/lib" |
---|
44 | share_path="$dst_path/usr/share/$package_name" |
---|
45 | man1_path="$dst_path/usr/man/man1" |
---|
46 | mkdir -p "$perl_path" |
---|
47 | mkdir -p "$bin_path" |
---|
48 | mkdir -p "$lib_path" |
---|
49 | mkdir -p "$share_path" |
---|
50 | mkdir -p "$man1_path" |
---|
51 | |
---|
52 | platform=`uname -m` |
---|
53 | |
---|
54 | # ------------------------------------------------------------------ |
---|
55 | # Utilities written in C |
---|
56 | |
---|
57 | # ------------------------------------------------------------------ |
---|
58 | # Various libs |
---|
59 | for lib in ccoord libosm libimg ; do |
---|
60 | if [ "$platform" == "x86_64" ] ; then |
---|
61 | if echo $lib | grep -q -e libosm -e ccoord -e libimg ; then |
---|
62 | echo "Ignored '$lib' because it does not compile on my debian $platform machine" |
---|
63 | continue |
---|
64 | fi |
---|
65 | fi |
---|
66 | |
---|
67 | echo "${BLUE}----------> lib/$lib${NORMAL}" |
---|
68 | cd ../lib/$lib |
---|
69 | # for a in *.cpp ; do perl -p -i -e 's,libshp/shapefil.h,shapefil.h,g' $a; done |
---|
70 | make clean >build.log 2>build.err |
---|
71 | make >>build.log 2>>build.err |
---|
72 | if [ "$?" -ne "0" ] ; then |
---|
73 | echo "${RED}!!!!!! ERROR compiling $lib ${NORMAL}" |
---|
74 | echo "Logfile is at `pwd`/build.log build.err" |
---|
75 | exit -1 |
---|
76 | fi |
---|
77 | cd .. |
---|
78 | result_lib=$lib/lib${lib}.a |
---|
79 | result_lib=`find . -name "*${lib}*.a"` |
---|
80 | test -s "$result_lib" || result_lib="$lib/${lib}.a" |
---|
81 | if [ ! -s "$result_lib" ] ; then |
---|
82 | echo "${RED}!!!!!! ERROR compiling $lib no Resulting '$result_lib'${NORMAL}" |
---|
83 | exit -1 |
---|
84 | fi |
---|
85 | cp "$result_lib" "../utils/${lib_path}" || exit -1 |
---|
86 | done |
---|
87 | cd ../utils/ |
---|
88 | |
---|
89 | |
---|
90 | # ------------------------------------------------------------------ |
---|
91 | # Importer |
---|
92 | for import in `ls import/*/Makefile| sed 's,/Makefile,,;s,import/,,'` ; do |
---|
93 | if echo $import | grep -q and_import ; then |
---|
94 | echo "Ignored '$import' because it does not compile on my debian machine" |
---|
95 | continue |
---|
96 | fi |
---|
97 | |
---|
98 | echo "${BLUE}----------> import/$import${NORMAL}" |
---|
99 | cd import/$import/ |
---|
100 | make clean >build.log 2>build.err |
---|
101 | make >>build.log 2>>build.err |
---|
102 | if [ "$?" -ne "0" ] ; then |
---|
103 | echo "${RED}!!!!!! ERROR compiling import/${import} ${NORMAL}" |
---|
104 | exit -1 |
---|
105 | fi |
---|
106 | cd ../.. |
---|
107 | cp import/$import/2AND ${bin_path}/osm2AND |
---|
108 | done |
---|
109 | |
---|
110 | # ------------------------------------------------------------------ |
---|
111 | # Filter |
---|
112 | # As soon it compiles here on my debian machine |
---|
113 | # i will remove the excludes |
---|
114 | for filter in `ls filter/*/Makefile| sed 's,/Makefile,,;s,filter/,,'` ; do |
---|
115 | if echo $filter | grep -q wayclean ; then |
---|
116 | echo "Ignored '$filter' because it does not compile on my debian machine" |
---|
117 | continue |
---|
118 | fi |
---|
119 | |
---|
120 | echo "${BLUE}----------> filter/${filter}${NORMAL}" |
---|
121 | cd filter/${filter} || exit -1 |
---|
122 | make clean >build.log 2>build.err |
---|
123 | make >>build.log 2>>build.err |
---|
124 | if [ "$?" -ne "0" ] ; then |
---|
125 | echo "${RED}!!!!!! ERROR compiling filter/${filter} ${NORMAL}" |
---|
126 | exit -1 |
---|
127 | fi |
---|
128 | cd ../.. |
---|
129 | cp filter/${filter}/${filter} ${bin_path} |
---|
130 | done |
---|
131 | |
---|
132 | # ------------------------------------------------------------------ |
---|
133 | # Export |
---|
134 | # As soon it compiles here on my debian machine |
---|
135 | # i will remove the excludes |
---|
136 | for export in `ls export/*/Makefile| sed 's,/Makefile,,;s,export/,,'` ; do |
---|
137 | if echo $export | grep -q -e osmgarminmap -e osm2shp -e osmgoogleearth; then |
---|
138 | echo "Ignored '$export' because it does not compile on my debian machine" |
---|
139 | continue |
---|
140 | fi |
---|
141 | |
---|
142 | echo "${BLUE}----------> export/${export}${NORMAL}" |
---|
143 | cd export/${export} || exit -1 |
---|
144 | |
---|
145 | if [ -s "Makefile.$export" ] ;then |
---|
146 | custom_makefile=" -f Makefile.$export" |
---|
147 | else |
---|
148 | custom_makefile='' |
---|
149 | fi |
---|
150 | |
---|
151 | make $custom_makefile clean >build.log 2>build.err |
---|
152 | make $custom_makefile >>build.log 2>>build.err |
---|
153 | if [ "$?" -ne "0" ] ; then |
---|
154 | echo "${RED}!!!!!! ERROR compiling export/${export} ${NORMAL}" |
---|
155 | exit -1 |
---|
156 | fi |
---|
157 | cd ../.. |
---|
158 | cp export/${export}/${export} ${bin_path} |
---|
159 | done |
---|
160 | |
---|
161 | # ------------------------------------------------------------------ |
---|
162 | if true ; then |
---|
163 | echo "${BLUE}----------> color255${NORMAL}" |
---|
164 | cd color255 || exit -1 |
---|
165 | make clean >build.log 2>build.err |
---|
166 | make >>build.log 2>>build.err |
---|
167 | if [ "$?" -ne "0" ] ; then |
---|
168 | echo "${RED}!!!!!! ERROR compiling color255 ${NORMAL}" |
---|
169 | exit -1 |
---|
170 | fi |
---|
171 | cd .. |
---|
172 | cp color255/color255 ${bin_path} |
---|
173 | fi |
---|
174 | |
---|
175 | # ------------------------------------------------------------------ |
---|
176 | if true ; then |
---|
177 | echo "${BLUE}----------> osm2pqsql${NORMAL}" |
---|
178 | cd export/osm2pgsql || exit -1 |
---|
179 | make clean >build.log 2>build.err |
---|
180 | make >>build.log 2>>build.err |
---|
181 | if [ "$?" -ne "0" ] ; then |
---|
182 | echo "${RED}!!!!!! ERROR compiling osm2pgsql ${NORMAL}" |
---|
183 | exit -1 |
---|
184 | fi |
---|
185 | cd ../.. |
---|
186 | cp export/osm2pgsql/osm2pgsql ${bin_path} |
---|
187 | if [ "$?" -ne "0" ] ; then |
---|
188 | echo "${RED}!!!!!! ERROR osm2pgsql not copied ${NORMAL}" |
---|
189 | exit -1 |
---|
190 | fi |
---|
191 | cp export/osm2pgsql/default.style ${share_path}/default.style |
---|
192 | if [ "$?" -ne "0" ] ; then |
---|
193 | echo "${RED}!!!!!! ERROR osm2pgsql/default.style no copied ${NORMAL}" |
---|
194 | exit -1 |
---|
195 | fi |
---|
196 | fi |
---|
197 | |
---|
198 | # ------------------------------------------------------------------ |
---|
199 | if true; then |
---|
200 | echo "${BLUE}----------> UTF8Sanitizer${NORMAL}${NORMAL}" |
---|
201 | cd planet.osm/C/ || exit -1 |
---|
202 | make clean >build.log 2>build.err |
---|
203 | make >>build.log 2>>build.err |
---|
204 | if [ "$?" -ne "0" ] ; then |
---|
205 | echo "${RED}!!!!!! ERROR compiling color255 ${NORMAL}" |
---|
206 | exit -1 |
---|
207 | fi |
---|
208 | cd ../.. |
---|
209 | cp planet.osm/C/UTF8Sanitizer ${bin_path} || exit -1 |
---|
210 | fi |
---|
211 | |
---|
212 | # ------------------------------------------------------------------ |
---|
213 | echo "${BLUE}----------> Copy Perl libraries${NORMAL}${NORMAL}" |
---|
214 | find perl_lib/ -name "*.pm" | while read src_fn ; do |
---|
215 | dst_fn="$perl_path/${src_fn#perl_lib/}" |
---|
216 | dst_dir=`dirname "$dst_fn"` |
---|
217 | test -d "$dst_dir" || mkdir -p "$dst_dir" |
---|
218 | cp "$src_fn" "$dst_fn" |
---|
219 | done |
---|
220 | |
---|
221 | echo "${BLUE}----------> Copy Perl Binaries${NORMAL}${NORMAL}" |
---|
222 | find ./ -name "*.pl" | while read src_fn ; do |
---|
223 | dst_fn="$bin_path/${src_fn##*/}" |
---|
224 | filename="`basename $src_fn`" |
---|
225 | dst_fn="${dst_fn/.pl}" |
---|
226 | if ! echo $dst_fn | grep -e osm ; then |
---|
227 | dst_fn="`dirname ${dst_fn}`/osm-`basename ${dst_fn}`" |
---|
228 | fi |
---|
229 | man1_fn="$man1_path/${filename%.pl}.1" |
---|
230 | if head -1 "$src_fn" | grep -q -e '^#! */usr/bin/perl' ; then |
---|
231 | cp "$src_fn" "$dst_fn" |
---|
232 | else |
---|
233 | echo "${RED}WARNING!!! Perl Hash Bang is missing at File '$src_fn'${NORMAL}" |
---|
234 | echo " I'm not adding this File to the debian Package" |
---|
235 | echo "First Line: `head -1 '$src_fn'`" |
---|
236 | fi |
---|
237 | |
---|
238 | # ----- Try to create man Pages |
---|
239 | if perldoc "$src_fn" >/dev/null 2>&1 ; then |
---|
240 | echo "Create Man Page from pod '$man1_fn'" |
---|
241 | pod2man $src_fn >"$man1_fn" |
---|
242 | else |
---|
243 | if grep -q -e "--man" "$src_fn"; then |
---|
244 | echo "Create Man Page '$man1_fn'" |
---|
245 | perl $src_fn --man >"$man1_fn" |
---|
246 | else |
---|
247 | if grep -q -e "--help" "$src_fn"; then |
---|
248 | echo "Create Man Page from Help '$man1_fn'" |
---|
249 | perl $src_fn --help >"$man1_fn" |
---|
250 | else |
---|
251 | echo "!!!! No idea how to create Man Page for $src_fn" |
---|
252 | fi |
---|
253 | fi |
---|
254 | fi |
---|
255 | done |
---|
256 | |
---|
257 | # -------------------------------------------- |
---|
258 | echo "${BLUE}----------> Copy Python Binaries${NORMAL}" |
---|
259 | find ./ -name "*.py" | while read src_fn ; do |
---|
260 | dst_fn="$bin_path/${src_fn##*/}" |
---|
261 | dst_fn="${dst_fn/.py}" |
---|
262 | if head -1 "$src_fn" | grep -q -e '^#! */usr/bin/python' -e '^#!/opt/python-2_5/bin/python' -e '^#!/usr/bin/env python'; then |
---|
263 | cp "$src_fn" "$dst_fn" |
---|
264 | else |
---|
265 | if head -1 "$src_fn" | grep -q -e '^#!/opt/python-2_5/bin/python' -e '^#!/usr/bin/env python'; then |
---|
266 | (echo '#!/usr/bin/python2.5'; cat "$src_fn") >"$dst_fn" |
---|
267 | else |
---|
268 | echo "${RED}WARNING!!! Python Hash Bang is missing at File '$src_fn'${NORMAL}" |
---|
269 | echo " I'm not adding this File to the debian Package" |
---|
270 | echo " First Line: `head -1 $src_fn`" |
---|
271 | fi |
---|
272 | fi |
---|
273 | done |
---|
274 | |
---|
275 | |
---|
276 | # ####################################################### |
---|
277 | # Osmosis |
---|
278 | # ####################################################### |
---|
279 | echo "${BLUE}----------> Osmosis${NORMAL}" |
---|
280 | cd osmosis/trunk |
---|
281 | ant clean >build.log 2>build.err |
---|
282 | ant dist >>build.log 2>>build.err |
---|
283 | if [ "$?" -ne "0" ] ; then |
---|
284 | echo "${RED}!!!!!! ERROR compiling Osmosis ${NORMAL}" |
---|
285 | exit -1 |
---|
286 | fi |
---|
287 | cd ../.. |
---|
288 | mkdir -p $dst_path/usr/local/share/osmosis/ |
---|
289 | cp ./osmosis/dist/result/osmosis.jar $dst_path/usr/local/share/osmosis/ |
---|
290 | |
---|
291 | cp debian/osmosis.sh "$bin_path/osmosis" |
---|
292 | |
---|
293 | |
---|
294 | ######################################################### |
---|
295 | # Mapnik installation tool |
---|
296 | ######################################################### |
---|
297 | echo "${BLUE}----------> Mapnik${NORMAL}" |
---|
298 | cp export/osm2pgsql/mapnik-osm-updater.sh "$bin_path" |
---|
299 | cp export/osm2pgsql/900913.sql "$bin_path" |
---|
300 | cp export/osm2pgsql/default.style "$bin_path" |
---|
301 | |
---|
302 | |
---|
303 | ################################################################## |
---|
304 | # XXX |
---|
305 | # For later: |
---|
306 | # Add java tools, but for these a build.xml with a target jar or similar would be best |
---|