-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile.osm
1861 lines (1531 loc) · 72.6 KB
/
Makefile.osm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
###############################################################
# Copyright (c) 2008-2024 Wolfram Schneider, https://bbbike.org
#
# Get and convert OpenStreetMap.org data to BBBike
#
# For more information about BBBike, visit https://www.bbbike.org
#
BBMAKE= ${MAKE} -f world/Makefile.osm
MAX_PARALLELS_OSM_DOWNLOADS= 2
NICE= nice -n 10
NICE5= nice -n 9
PERL= perl
GIT_ID= $(shell git show | head -n1 | awk '{ print $$2 }')
TMP_DIR= /tmp/bbbike-$(shell whoami)
LOGNAME= $(shell logname 2>/dev/null || whoami)
OSM2BBD_MAPTYPE= #-map bbbike
OSM_SOCKS_PROXY= --socksproxy=socks://localhost:1080
OSM_TIMEOUT= --timeout=45
DOWNLOADOSM_URL= --osm-api-url=http://www.informationfreeway.org/api/0.6
DOWNLOADOSM= ${PERL} ./miscsrc/downloadosm --debug=1 ${OSM_SOCKS_PROXY} ${OSM_TIMEOUT} ${DOWNLOADOSM_URL}
#OSM2BBD= ${PERL} ./miscsrc/osm2bbd --nodate -f --debug=0 ${OSM2BBD_MAPTYPE} -ignore-unhandled -ignore-underline -experiment add_postal_code #-experiment polar_coord_hack
OSM2BBD_OPT= --ignore-unhandled --ignore-underline-noname --granularity=100
OSM2BBD= ./miscsrc/osm2bbd ${OSM2BBD_OPT} --nodate --no-create --git-id="${GIT_ID}" -f --debug=0 ${OSM2BBD_MAPTYPE} -experiment add_postal_code -experiment handle_relations
DOCKER_IMAGE_FILE?= bbbike-debian11
DOCKER_BBBIKE_TAG?= bbbike/extract-debian11
DOCKER= docker
MAX_CPU= `world/bin/ncpu`
MAX_CPU2= `world/bin/ncpu -1`
MAX_CPU3= `world/bin/ncpu / 2`
MAX_VCPU= `world/bin/ncpu vcpu`
MAX_RCPU= `world/bin/ncpu rcpu -1`
MAX_HCPU= `world/bin/ncpu hcpu`
MAX_OSM2PBF= 1
MAX_OSM2SHAPE= ${MAX_CPU}
MAX_PBF2OSM= ${MAX_CPU}
MAX_PBF2OPL= $$(( ${MAX_CPU} * 2 / 3 + 1 ))
MAX_OSM2OSMAND= ${MAX_CPU3}
MAX_OSM2GARMIN= $$(( ${MAX_CPU} / 4 + 1 ))
MAX_OSM2PNG= ${MAX_CPU2}
MAX_OSM2SVG= ${MAX_CPU}
MAX_OSM2MAPSFORGE= $$(( ${MAX_CPU} / 3 + 1 ))
MAX_OSM2MBTILES=${MAX_CPU3}
MAX_CPU_20= $$(( ${MAX_CPU} * 2 / 10 + 1 ))
MAX_CPU_30= $$(( ${MAX_CPU} * 3 / 10 + 1 ))
MAX_CPU_40= $$(( ${MAX_CPU} * 4 / 10 + 1 ))
MAX_CPU_50= $$(( ${MAX_CPU} * 5 / 10 + 1 ))
MAX_CPU_80= $$(( ${MAX_CPU} * 8 / 10 + 1 ))
MAX_OSM2ORGANICMAPS=${MAX_CPU_50}
CURL_USER_AGENT= -A "BBBike.org-CacheHeater/1.0"
XARGS= ${NICE} `which gxargs xargs | head -1`
XARGS5= `which gxargs xargs | head -1`
TIME= time
OSM2PBF= world/legacy/bin/osm2pbf
PBF2OSM= world/bin/pbf2osm
OSM_CHECKSUM= world/bin/osm-checksum
PBF2PBF= world/legacy/bin/pbf2pbf
OSM2GARMIN= world/bin/pbf2osm --garmin-osm
OSM2GARMIN_CYCLE= world/bin/pbf2osm --garmin-cycle
OSM2GARMIN_ONROAD= world/bin/pbf2osm --garmin-onroad
OSM2GARMIN_AJT03= world/bin/pbf2osm --garmin-ajt03
OSM2GARMIN_ONTRAIL= world/bin/pbf2osm --garmin-ontrail
OSM2GARMIN_ALL= world/bin/pbf2osm --garmin-osm:onroad
OSM2GARMIN_OSEAM= world/bin/pbf2osm --garmin-oseam
OSM2GARMIN_SRTM= world/bin/pbf2osm --garmin-srtm
OSM2PNG= world/bin/wrapper-instable world/bin/bomb --timeout=1400 -- env max_file_size_maperitive=200000 world/bin/pbf2osm --png-osm
OSM2SVG= world/bin/wrapper-instable world/bin/bomb --timeout=1400 -- env max_file_size_maperitive=200000 world/bin/pbf2osm --svg-osm
OSM2SHAPE= world/bin/pbf2osm --shape
OSM2OSMAND= world/bin/pbf2osm --osmand
OSM2MAPSFORGE= world/bin/pbf2osm --mapsforge-osm
OSM2ORGANICMAPS=world/bin/pbf2osm --organicmaps-osm
OSM2MBTILES= world/bin/pbf2osm --mbtiles-openmaptiles
CITIES_DB= world/etc/cities.csv
CITIES_FILE=world/etc/cities.txt
DB=world/bin/bbbike-db --city-database=${CITIES_DB}
GZIP:= $(shell which pigz gzip | head -1)
BZIP2:= $(shell which pbzip2 bzip2 | head -1)
OSMOSIS= osmosis -q
OSMOSIS_BUFFER_CAPACITY=6000
OSM_DIR= osm
OSP_DIR= osp
DATA_OSM_DIR= data-osm
DATA_OSM_BBBIKE_DIR= data-osm.bbbike
OSMBIKE_DATA= ${DATA_OSM_BBBIKE_DIR}.tgz
DATA_DIR= data
BBBIKE_CACHE_DIR= /opt/bbbike/cache
LIGHTTPD_CACHE_DIR= /var/cache/lighttpd
MAX_OSMOSIS= ${MAX_CPU}
MAX_OSMCONVERT= ${MAX_CPU}
LANGUAGES= m de en es fr ru
ELEVATION_SCRIPT=world/bin/elevation-database
MAX_ELEVATION_SCRIPTS= 1
BBBIKE_SERVER=""
BBBIKE_WEBSERVER_DOWNLOAD_DIR=/usr/local/www/download.bbbike.org
BBBIKE_WEBSERVER_DIR=/usr/local/www/bbbike.org
BBBIKE_WEB_DIR= ./
CACHE_HEATER_MAX=50
TMP=world/tmp
WEB_GROUP= www-data
EXTRACTS_SPOOL_DIR=/opt/bbbike/extract
POSTGIS_STYLE=/usr/share/osm2pgsql/osm2pgsql/bbbike.style
POSTGIS_STYLE9=/usr/share/osm2pgsql/bbbike.style
BBBIKE_WEB_SERVER ?= www.bbbike.org
BBBIKE_API_SERVER ?= api.bbbike.org
API_DIR= api/0.2
LOG_DIR=tmp
BBBIKE_PARTITION= /opt/bbbike
BBBIKE_ESERTE_DIR= ../bbbike-eserte
OSMOSIS_PLUGIN_DIR=$$HOME/.openstreetmap/osmosis/plugins
# for tile-extract
OSM_PLANET_PBF= ../osm/download/planet-daily.osm.pbf
# BBBIKE_RANDOM_FILES=1
PROVE_FILES= t/*.t world/t/*.t
CITIES=$(shell ${PERL} -npe 's/\#.*//' ${CITIES_FILE})
CITIES_BY_AREA=$(shell world/bin/bbbike-db --list-by-area)
TILES_DIR= tile
all: help
build-runtime-perl:
@world/bin/bbbike-build-runtime-perl.pl
build-runtime-symlinks:
@world/bin/bbbike-build-symlinks
build-runtime: build-runtime-perl build-runtime-symlinks
@world/bin/bbbike-build-runtime
convert-wgs84 convert: build-runtime convert2 #convert-post
convert-post: create-osp bbbike2wgs84 elevation-update
# convert bbbike files from OSM files
convert-bbbike-full: build-runtime-perl
${BBMAKE} DATA_OSM_DIR=${DATA_OSM_BBBIKE_DIR} OSM2BBD_MAPTYPE="-map bbbike" convert2
rm -f ${DATA_OSM_BBBIKE_DIR}/*/opensearch.*
rm -f ${DATA_OSM_BBBIKE_DIR}/*/_*
rm -f ${DATA_OSM_BBBIKE_DIR}/*/*.gz
set -e; for i in ${CITIES}; do \
( cd ${DATA_OSM_BBBIKE_DIR}; tar cf - $$i | ${BZIP2} > $$i.tbz.tmp; mv -f $$i.tbz.tmp $$i.tbz; \
rm -rf $$i ); \
done
# convert bbbike files from wgs84, much faster
convert-bbbike: build-runtime-perl
echo ${CITIES} | ${XARGS} -E " " -n4 -P${MAX_CPU} ./world/bin/wgs84-to-bbbike
tar --exclude='_*' -cf - ${DATA_DIR} | ${NICE} bzip2 > ${DATA_OSM_BBBIKE_DIR}/data.tbz.tmp
mv -f ${DATA_OSM_BBBIKE_DIR}/data.tbz.tmp ${DATA_OSM_BBBIKE_DIR}/data.tbz
_tarball:
tar --exclude='_*' -cf - ${DATA_OSM_BBBIKE_DIR} | ${NICE} ${GZIP} > ${OSMBIKE_DATA}.tmp
mv -f ${OSMBIKE_DATA}.tmp ${OSMBIKE_DATA}
mkdir -p ../bbbike-macos/download
cp -f ${OSMBIKE_DATA} ../bbbike-macos/download
tar --exclude='_*' -cf - ${DATA_DIR} | ${NICE} ${BZIP2} > ${DATA_DIR}.tbz.tmp
mv -f ${DATA_DIR}.tbz.tmp ${DATA_DIR}.tbz
cities-api:
@for i in `${PERL} -e 'print "x " x 2'`; do ${BBMAKE} _cities; done
${BBMAKE} cleanup-osm-error
${BBMAKE} _cities_complete
${BBMAKE} check-osm
OSMOSIS_BOUNDING_BOX= --bounding-box left=-180 right=180 top=90 bottom=-90 clipIncompleteEntities=true
OSMOSIS_BOUNDING_POLYGON= clipIncompleteEntities=true
OSMOSIS_BOUNDING_OPT= ${OSMOSIS_BOUNDING_POLYGON}
# completeWays=no completeRelations=no
_osmosis_opt:
for i in ${CITIES}; do printf " --bounding-polygon file=${OSM_DIR}/$$i/$$i.poly ${OSMOSIS_BOUNDING_OPT} --wx file=${OSM_DIR}/$$i/$$i.osm.gz"; done
_osmosis_opt_pbf:
if [ "$$OSM_DIR_NOSUBDIR" = "true" ]; then \
for i in ${CITIES}; do printf " --bounding-polygon file=${OSM_DIR}/$$i.poly ${OSMOSIS_BOUNDING_OPT} --write-pbf file=${OSM_DIR}/$$i.osm.pbf omitmetadata=true"; done; \
else \
for i in ${CITIES}; do printf " --bounding-polygon file=${OSM_DIR}/$$i/$$i.poly ${OSMOSIS_BOUNDING_OPT} --write-pbf file=${OSM_DIR}/$$i/$$i.osm.pbf omitmetadata=true"; done; \
fi
_cities-osm: poly
${NICE5} ${OSMOSIS} --read-pbf ${OSM_PLANET_PBF} --buffer bufferCapacity=${OSMOSIS_BUFFER_CAPACITY} --tee `${BBMAKE} -s CITIES="${CITIES}" CITIES_DB=${CITIES_DB} city-count` `${BBMAKE} -s CITIES="${CITIES}" CITIES_DB=${CITIES_DB} _osmosis_opt`
_cities-pbf: poly
${NICE5} ${OSMOSIS} --read-pbf ${OSM_PLANET_PBF} --buffer bufferCapacity=${OSMOSIS_BUFFER_CAPACITY} --tee `${BBMAKE} -s CITIES="${CITIES}" CITIES_DB=${CITIES_DB} city-count` `${BBMAKE} -s CITIES="${CITIES}" CITIES_DB=${CITIES_DB} _osmosis_opt_pbf`
test "$$NO_PBF2PBF" = "true" || ${BBMAKE} CITIES="${CITIES}" _pbf2pbf
cities: cities-parallel
cities-pbf: _cities-pbf
${BBMAKE} _pbf2pbf-checksum
cities-osm: _cities-osm
${BBMAKE} osm2pbf
# if an extract does not exists localy, try to fetch it from the web
fetch-extracts fetch-extracts-pbf fetch:
set -e; \
tmpfile=$$(mktemp); echo '# dummy' > $$tmpfile; \
for i in ${CITIES}; do \
if [ ! -e ${OSM_DIR}/$$i/$$i.osm.pbf ]; then \
url=https://download.bbbike.org; \
printf "set -e; mkdir -p ${OSM_DIR}/$$i; \
curl -sSf -A BBBike.org/fetch-extracts -o ${OSM_DIR}/$$i/$$i.osm.pbf \
$$url/osm/bbbike/$$i/$$i.osm.pbf; " >> $$tmpfile; \
if [ $@ != 'fetch-extracts-pbf' ]; then \
printf "./world/bin/pbf2osm ${OSM_DIR}/$$i/$$i.osm.pbf | ${GZIP} > ${OSM_DIR}/$$i/$$i.osm.gz.tmp; \
mv -f ${OSM_DIR}/$$i/$$i.osm.gz.tmp ${OSM_DIR}/$$i/$$i.osm.gz" >> $$tmpfile; \
fi; \
printf "\0" >> $$tmpfile; \
fi; \
done; \
time ${XARGS} -n1 -0 -P${MAX_HCPU} /bin/sh -c < $$tmpfile; rm -f $$tmpfile;
osm2pbf:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.gz\0, ' | ${XARGS} -n 1 -0 -P${MAX_OSM2PBF} ${OSM2PBF}
pbf2osm:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | \
env MULTI_CPU=NO ${XARGS} -n1 -0 -P${MAX_PBF2OSM} ${PBF2OSM} --gzip
${BBMAKE} _pbf2osm-checksum
_pbf2osm-checksum:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.gz\0, ' | ${XARGS} -n 1 -0 -P${MAX_PBF2OSM} ${OSM_CHECKSUM}
pbf2csv:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | \
env MULTI_CPU=NO ${XARGS} -n1 -0 -P${MAX_CPU} ${PBF2OSM} --csv-xz
${BBMAKE} _pbf2csv-checksum
_pbf2csv-checksum:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.csv.xz\0, ' | ${XARGS} -n 1 -0 -P${MAX_PBF2OSM} ${OSM_CHECKSUM}
pbf2opl:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | \
env MULTI_CPU=NO ${XARGS} -n1 -0 -P${MAX_PBF2OPL} ${PBF2OSM} --opl-xz
${BBMAKE} _pbf2opl-checksum
pbf2geojson:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | \
env MULTI_CPU=NO ${XARGS} -n1 -0 -P${MAX_PBF2OPL} ${PBF2OSM} --geojson-xz
pbf2geojsonseq:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | \
env MULTI_CPU=NO ${XARGS} -n1 -0 -P${MAX_PBF2OPL} ${PBF2OSM} --geojsonseq-xz
pbf2text:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | \
env MULTI_CPU=NO ${XARGS} -n1 -0 -P${MAX_PBF2OPL} ${PBF2OSM} --text-xz
pbf2sqlite:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | \
env MULTI_CPU=NO ${XARGS} -n1 -0 -P${MAX_CPU} ${PBF2OSM} --sqlite-xz
_pbf2opl-checksum:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.opl.xz\0, ' | ${XARGS} -n 1 -0 -P${MAX_PBF2OSM} ${OSM_CHECKSUM}
_pbf2pbf:
if [ "$$OSM_DIR_NOSUBDIR" = "true" ]; then \
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_.osm.pbf\0, ' | ${XARGS} -n32 -0 -P${MAX_PBF2OSM} ${PBF2PBF}; \
else \
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | ${XARGS} -n1 -0 -P${MAX_PBF2OSM} ${PBF2PBF}; \
fi
_pbf2pbf-checksum:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | ${XARGS} -n 1 -0 -P${MAX_PBF2OSM} ${OSM_CHECKSUM}
osm2garmin: osm2garmin-multi
osm2garmin-single: osm2garmin-osm osm2garmin-onroad osm2garmin-opentopo # osm2garmin-ontrail osm2garmin-oseam osm2garmin-cycle osm2garmin-leisure osm2garmin-bbbike osm2garmin-openfietslite osm2garmin-openfietsfull check-zip
osm2garmin-multi:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,world/bin/osm2garmin '${OSM_DIR}'/$$_/$$_.osm.pbf onroad-latin1:ontrail-latin1:osm:opentopo-latin1\0, ' | env osm2xxx_max_jobs=1 java_heap=5G ${XARGS} -n 1 -0 -P${MAX_OSM2GARMIN} /bin/sh -c
osm2garmin-osm:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | env osm2xxx_max_jobs=1 ${XARGS} -n 1 -0 -P${MAX_OSM2GARMIN} ${OSM2GARMIN}
osm2garmin-cycle:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | env osm2xxx_max_jobs=1 ext=cycle ${XARGS} -n 1 -0 -P${MAX_OSM2GARMIN} ${OSM2GARMIN}
osm2garmin-leisure:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | env osm2xxx_max_jobs=1 ext=leisure ${XARGS} -n 1 -0 -P${MAX_OSM2GARMIN} ${OSM2GARMIN}
osm2garmin-bbbike:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | env osm2xxx_max_jobs=1 ext=bbbike ${XARGS} -n 1 -0 -P${MAX_OSM2GARMIN} ${OSM2GARMIN}
osm2garmin-onroad:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | env osm2xxx_max_jobs=1 ext=onroad ${XARGS} -n 1 -0 -P${MAX_OSM2GARMIN} ${OSM2GARMIN}
osm2garmin-ajt03:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | env osm2xxx_max_jobs=1 ext=ajt03 ${XARGS} -n 1 -0 -P${MAX_OSM2GARMIN} ${OSM2GARMIN}
osm2garmin-ontrail:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | env osm2xxx_max_jobs=1 ext=ontrail ${XARGS} -n 1 -0 -P${MAX_OSM2GARMIN} ${OSM2GARMIN}
osm2garmin-opentopo:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | env osm2xxx_max_jobs=1 ext=opentopo ${XARGS} -n 1 -0 -P${MAX_OSM2GARMIN} ${OSM2GARMIN}
osm2garmin-openfietslite:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | env osm2xxx_max_jobs=1 ext=openfietslite ${XARGS} -n 1 -0 -P${MAX_OSM2GARMIN} ${OSM2GARMIN}
osm2garmin-openfietsfull:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | env osm2xxx_max_jobs=1 ext=openfietsfull ${XARGS} -n 1 -0 -P${MAX_OSM2GARMIN} ${OSM2GARMIN}
osm2garmin-oseam:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | env osm2xxx_max_jobs=1 ext=oseam ${XARGS} -n 1 -0 -P${MAX_OSM2GARMIN} ${OSM2GARMIN}
osm2png:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | BBBIKE_MAPERITIVE_MAPSTYLE=google ${XARGS} -n 1 -0 -P${MAX_OSM2PNG} ${OSM2PNG}
osm2svg:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | BBBIKE_MAPERITIVE_MAPSTYLE=google ${XARGS} -n 1 -0 -P${MAX_OSM2SVG} ${OSM2SVG}
osm2obf osm2osmand:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | env osm2xxx_max_jobs=1 ${XARGS} -n 1 -0 -P${MAX_OSM2OSMAND} ${OSM2OSMAND}
osm2mapsforge:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | env osm2xxx_max_jobs=1 ${XARGS} -n 1 -0 -P${MAX_OSM2MAPSFORGE} ${OSM2MAPSFORGE}
osm2shape osm2shp:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | ${XARGS} -n 1 -0 -P${MAX_OSM2SHAPE} ${OSM2SHAPE}
osm2organicmaps:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | ${XARGS} -n 1 -0 -P${MAX_OSM2ORGANICMAPS} ${OSM2ORGANICMAPS}
osm2mbtiles:
echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | ${PERL} -ne 'chomp; print qq,'${OSM_DIR}'/$$_/$$_.osm.pbf\0, ' | ${XARGS} -n 1 -0 -P${MAX_OSM2MBTILES} ${OSM2MBTILES}
osm-readme:
for i in ${CITIES}; do \
perl -npe "s/%{city}/$$i/g" world/download/etc/CITY.txt > ${OSM_DIR}/$$i/HEADER.txt; \
done
osm-html:
cd cgi; \
for i in ${CITIES}; do \
./area.cgi --offline --city=$$i > ../${OSM_DIR}/$$i/index.html & \
( cd ../${OSM_DIR}/$$i; sort -k2 $$i.osm.*.md5 ) > ../${OSM_DIR}/$$i/CHECKSUM.txt; \
done; wait
_cities-parallel:
@echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | env CITIES_DB=${CITIES_DB} ./world/bin/cities-parallel --xargs ${MAX_OSMOSIS} cities-pbf | ${TIME} ${XARGS} -0 -n1 -P${MAX_OSMOSIS} /bin/sh -c
_cities-parallel-pbf:
@echo ${CITIES} | ${PERL} -npe 's/\s+/\n/g' | env CITIES_DB=${CITIES_DB} ./world/bin/cities-parallel --xargs ${MAX_OSMOSIS} _cities-pbf | ${TIME} ${XARGS} -0 -n1 -P${MAX_OSMOSIS} /bin/sh -c
_cities-parallel-osmconvert: poly
@for c in ${CITIES_BY_AREA}; do world/bin/bbbike-db --planet $$c; done | ${TIME} ${XARGS} -0 -n1 -P${MAX_OSMCONVERT} /bin/sh -c
${BBMAKE} _pbf2pbf-checksum
cities-parallel: _cities-parallel-osmconvert check-osm
_cities:
@echo ${CITIES} | \
${PERL} -npe 's/\s+/-download /g' | \
${XARGS} -n 1 -P ${MAX_PARALLELS_OSM_DOWNLOADS} ${BBMAKE}
_cities_complete:
${BBMAKE} OSM_TIMEOUT="--timeout=300" `echo ${CITIES} | ${PERL} -npe 's/\s+/-download /g'`
poly:
${BBMAKE} -j ${MAX_CPU} `echo ${CITIES} | ${PERL} -npe 's/\s+/-poly /g'`
city-count:
@echo ${CITIES} | wc -w
city-reorder:
@cd ${OSM_DIR}; du -ks * | sort -nr | ../world/bin/bbbike-reorder-cities.pl
city-file:
#( echo Bogota; ${MAKE} -s city-reorder | awk '{print $$2 }' | egrep -v Bogota ) > ${CITIES_FILE}
${MAKE} -s city-reorder | awk '{print $$2 }' > ${CITIES_FILE}
city-memory:
echo ${CITIES} | ${TIME} ${XARGS} -E " " -n1 -P${MAX_RCPU} ./world/bin/bbbike-memory
update-robots.txt:
( LANG=C; LC_ALL=C; cat world/web/robots.txt.in; \
echo ${LANGUAGES} | ${PERL} -npe 's,\s+,\n,g' | sort | egrep -v "^en$$" | \
${PERL} -ne 'chomp; next if $$_ eq "m"; s,^,Disallow: /,; print "$$_/\n" '; \
${PERL} -e 'for ("A".."Z") { print qq{Disallow: /m/$$_\n} }'; \
echo ${CITIES} | ${PERL} -npe 's,\s+,\n,g' | sort | \
${PERL} -ne 'chomp; s,^,Disallow: /,; print "$$_/?\n" '; \
${DB} --robots-local-lang ${CITIES}; \
) > world/web/robots.txt
##########################################################################################
# check if the downloaded OSM files are valid
#
check-osm: check-osm-pbf
check-osm-gzip:
@find ${OSM_DIR} -name '*.gz' -print0 | ${XARGS} -0 -n8 -P${MAX_CPU} ${GZIP} -t
check-osm-pbf:
@find ${OSM_DIR} -name '*.pbf' -print0 | ${XARGS} -0 -n1 -P${MAX_CPU} osmconvert >/dev/null
check-zip:
@find ${OSM_DIR} -name '*.zip' -print0 | ${XARGS} -0 -n1 -P${MAX_CPU} unzip -qq -t
find ${OSM_DIR} -name '*.zip' -size -10k
check-osm-error:
@find ${OSM_DIR} -name '*.gz' -print0 | ${XARGS} -0 -n8 -P${MAX_CPU} zegrep -l '<error>' || true
cleanup-osm-error:
${BBMAKE} check-osm 2>&1 | grep ^gzip | awk '{ print $$2 }' | ${PERL} -npe 's,:,,' | sort -u | ${XARGS} rm -f
@find ${OSM_DIR} -name '*.gz' -print0 | ${XARGS} -0 -n8 -P${MAX_CPU} zegrep -l '<error>' | ${XARGS} rm -f
check-data-osm:
echo ${CITIES} | ${XARGS} -E " " -n1 -P${MAX_CPU} ./world/bin/check-data-osm
check-routing:
echo ${CITIES} | ${XARGS} -E " " -n8 -P1 ./world/bin/routing-validate.pl --number=1 | \
${XARGS} -0 -n1 -P${MAX_CPU} sh -c
echo ${CITIES} | ${XARGS} -E " " -n8 -P1 ./world/bin/routing-validate.pl --number=50 | \
${XARGS} -0 -n1 -P${MAX_CPU} sh -c
check-routing-fast:
@echo ${CITIES} | ${XARGS} -E " " -n1 -P${MAX_CPU} ./world/bin/routing-validate.pl --number=1 | \
${XARGS} -0 -n1 -P${MAX_CPU} /bin/sh -c
@echo ${CITIES} | ${XARGS} -E " " -n1 -P${MAX_CPU} ./world/bin/routing-validate.pl --number=4 | \
${XARGS} -0 -n1 -P${MAX_CPU} /bin/sh -c
convert2: convert3 convert-workarounds
# using GNU xargs -P parallel
convert3:
mkdir -p ${DATA_OSM_DIR}
cd ${OSM_DIR} # test
echo ${CITIES} " " | ${PERL} -npe 's/\s+/-convert /g' | \
${XARGS} -n 1 -P ${MAX_CPU} ${TIME} ${BBMAKE}
check: check-runtime
@echo "In case of failure run:"
@echo " make check-failed"
@echo ""
time ${BBMAKE} test
check-runtime:
${BBMAKE} PROVE_FILES="world/t/runtime*.t" test
check-world check-w: check-runtime
@echo "In case of failure run:"
@echo " make check-failed"
@echo ""
time ${BBMAKE} PROVE_FILES="world/t/*.t" test
check-full: check-runtime
@echo "In case of failure run:"
@echo " BBBIKE_TEST_FAST=\"\" BBBIKE_TEST_LONG=1 make check-failed"
@echo ""
BBBIKE_TEST_FAST="" BBBIKE_TEST_LONG=1 time ${BBMAKE} test
check-devel:
prove world/t/website-images.t ./world/t/080-perlcheck.t
check-failed: check-runtime
TMPDIR=${TMP_DIR} LANG=C LC_ALL=C time prove --state=failed
check-bbd:
for i in ${CITIES}; do echo ${DATA_OSM_DIR}/$$i; done | \
${XARGS} -n 1 -P ${MAX_CPU} ./miscsrc/check_bbd --debug=0 -dir
convert-workarounds:
osm2bbd-workarounds opensearch:
for i in ${CITIES}; do echo $$i; done | \
${XARGS} -n 1 -P ${MAX_CPU} world/bin/osm2bbd-workarounds ${DATA_OSM_DIR}
bbbike-osm2pbf:
find ${OSM_DIR} -name '*.osm.gz' -print0 | ${XARGS} -0 -n 1 -P ${MAX_CPU} ${OSM2PBF}
opensearch-bbbike:
world/bin/opensearch-suggestion --gps=0 --input-charset=iso-8859-1 < data/strassen > data/opensearch.streetnames
_c = ${CITIES}
_cd = $(_c:=-download)
_cc = $(_c:=-convert)
_cp = $(_c:=-poly)
_co = $(_c:=-osmconvert)
$(_cd):
c=`basename $@ -download`; mkdir -p ${OSM_DIR}/$$c; \
${DOWNLOADOSM} --step=`${DB} --step $$c` -o ${OSM_DIR}/$$c -- `${DB} --coord $$c`
$(_cc):
${DB} --lang `basename $@ -convert` >/dev/null
c=`basename $@ -convert`; \
test -n "$$c"; \
mkdir -p ${DATA_OSM_DIR}/tmp; \
rm -rf ${DATA_OSM_DIR}/tmp/$$c; \
if [ -e ${LOG_DIR}/city.$$c.log ]; then gzip -f ${LOG_DIR}/city.$$c.log; fi; \
( \
${TIME} ${OSM2BBD} -lang `${DB} --lang $$c` -o ${DATA_OSM_DIR}/tmp/$$c ${OSM_DIR}/$$c/$$c.osm.pbf; \
${TIME} world/bin/osm2bbd-workarounds ${DATA_OSM_DIR}/tmp $$c; \
) > ${LOG_DIR}/city.$$c.log 2>&1 ; \
if [ $$? != 0 ]; then \
tail -n 40 ${LOG_DIR}/city.$$c.log; \
exit 1; \
fi; \
rm -rf ${DATA_OSM_DIR}/$$c; mv ${DATA_OSM_DIR}/tmp/$$c ${DATA_OSM_DIR}
$(_cp):
if [ "$$OSM_DIR_NOSUBDIR" = "true" ]; then \
c=`basename $@ -poly`; ${DB} --poly $$c > ${OSM_DIR}/$$c.poly; \
else \
c=`basename $@ -poly`; mkdir -p ${OSM_DIR}/$$c; ${DB} --poly $$c > ${OSM_DIR}/$$c/$$c.poly.tmp; mv -f ${OSM_DIR}/$$c/$$c.poly.tmp ${OSM_DIR}/$$c/$$c.poly; \
fi
$(_co):
c=`basename $@ -osmconvert`; world/bin/bbbike-db --planet $$c | xargs -0 /bin/sh -c
${CITIES}:
${BBMAKE} $@-download $@-convert
######################################################################
rsync: sync-sitemap osm-header _rsync rsync-osm
rsync-bg: _rsync
_rsync:
rsync -a --delay-updates --exclude='*.bak' --exclude='*.tmp' --exclude='*.gz' --exclude=${LOG_DIR} --delete-excluded --delete --max-delete=512 ${DATA_OSM_DIR} ${BBBIKE_SERVER}${BBBIKE_WEBSERVER_DIR}
-rsync -av --exclude='*.bak' data/opensearch.streetnames ${BBBIKE_SERVER}${BBBIKE_WEBSERVER_DIR}/data
@echo ""
@echo "don't forget to cleanup the data cache in ${BBBIKE_CACHE_DIR}, run:"
@echo "$$ sudo make clean-cache; make cache-heater"
rsync-osm:
rsync -a --delay-updates --exclude='*.bak' --exclude='*.tmp' ${OSM_DIR} ${BBBIKE_SERVER}${BBBIKE_WEBSERVER_DIR}
# delete old files
rsync-osm-full:
rsync -a --delay-updates --exclude='*.bak' --exclude='*.tmp' --delete-excluded --delete --max-delete=512 ${OSM_DIR} ${BBBIKE_SERVER}${BBBIKE_WEBSERVER_DIR}
osm-header:
if ! test -e ${OSM_DIR}/HEADER.txt; then \
cd ${OSM_DIR}; \
ln -fs ../world/download/osm/bbbike/HEADER.txt .; \
fi
rsync-osm-devel rsync-osm-dev:
rsync -azv --delay-updates --delete --max-delete=512 bbbike.org:projects/bbbike/osm .
create-bbbike-web-symlinks-bbbike.en.cgi:
cd ${BBBIKE_WEB_DIR}/cgi && ln -fs bbbike.cgi bbbike.en.cgi
update-feed:
${MAKE} -C world/web/feed
create-usr-local-bin-symlink: create-perl-symlink create-bash-symlink
create-perl-symlink:
test -e /usr/local/bin/perl || sudo ln -fs /usr/bin/perl /usr/local/bin/perl
create-bash-symlink:
test -e /usr/local/bin/bash || sudo ln -fs /bin/bash /usr/local/bin/bash
symlinks: create-bbbike-web-symlinks
create-makefile-symlinks:
ln -fs world/Makefile.osm ${BBBIKE_WEB_DIR}
ln -fs Makefile.osm Makefile
create-bbbike-web-symlinks: create-usr-local-bin-symlink create-bbbike-web-symlinks-bbbike.en.cgi index update-feed bbbike-org-t create-bbbike-org-symlinks create-makefile-symlinks
cd cgi; ln -fs ../world/cgi/bbbike.cgi.config .
cd world/web; \
for i in images html cgi osm data-osm doc osp; do \
ln -fs -T ../../$$i $$i ; \
done; \
ln -fs images/srtbike1.ico favicon.ico # buggy browsers
cd world/web && \
rm -rf ${LANGUAGES}; \
mkdir -p ${LANGUAGES}; \
for city in ${CITIES} bbbike; do \
( rm -rf $$city; mkdir -p $$city; cd $$city; \
ln -fs ../../cgi/world.cgi index.cgi; \
ln -fs ../../../cgi/bbbike.cgi $$city.cgi; \
); \
for lang in ${LANGUAGES}; do \
( cd $$lang && ln -fs -T ../$$city $$city ); \
done; \
done
for script in MyCgiSimple.pm api.cgi area.cgi city.cgi livesearch.cgi location.cgi maptype.cgi street-coord.cgi crossing.cgi weather.cgi languages.cgi extract.cgi extract-email.cgi tile-size.cgi livesearch-extract.cgi download.cgi log.cgi route.cgi timestamp.cgi; do \
( cd ${BBBIKE_WEB_DIR}/cgi && ln -fs ../world/cgi/$$script ); \
done
cp -f world/web/index.de.html world/web/de/index.html
cp -f world/web/index.m.html world/web/m/index.html
for i in ${LANGUAGES}; do \
case $$i in \
m | de );; \
*) ${PERL} -npe "s,<a href=\"../$$i/\" title=\"(.*?)\">$$i</a>,<span class=\"current_language\" title=\"$1\">$$i</span>," world/web/index.en.html > world/web/$$i/index.html;; \
esac \
done
create-bbbike-org-symlinks:
cd images; ln -fs ../world/images/* .
cd html; ln -fs ../world/html/[a-zO]* .
cd cgi/msg/; ln -fs ../../world/cgi/msg/* .
bbbike-org-t:
cd world/web; ln -fs -T ../../data data
cd cgi; ln -fs bbbike.cgi bbbike-test.cgi
TAGCLOUD= world/bin/tagcloud
MOBILE_LINKS= world/bin/mobile-links
INDEX_UPDATE= world/bin/index-update ${TMP}
tagcloud index:
( cd world/web && mkdir -p ${LANGUAGES} )
( cd ${TMP} && rm -f de.cities.* en.cities.* local.cities.* mobile.en )
${TAGCLOUD} --lang=de --area=de < ${CITIES_DB} > ${TMP}/de.cities.de
${TAGCLOUD} --lang=de --area=eu < ${CITIES_DB} > ${TMP}/de.cities.eu
${TAGCLOUD} --lang=de --area=other --level=9 < ${CITIES_DB} > ${TMP}/de.cities.other
${TAGCLOUD} --lang=en --area=de < ${CITIES_DB} > ${TMP}/en.cities.de
${TAGCLOUD} --lang=en --area=eu < ${CITIES_DB} > ${TMP}/en.cities.eu
${TAGCLOUD} --lang=en --area=other --level=9 < ${CITIES_DB} > ${TMP}/en.cities.other
${TAGCLOUD} --lang=local --area=de < ${CITIES_DB} > ${TMP}/local.cities.de
${TAGCLOUD} --lang=local --area=eu < ${CITIES_DB} > ${TMP}/local.cities.eu
${TAGCLOUD} --lang=local --area=other --level=9 < ${CITIES_DB} > ${TMP}/local.cities.other
${PERL} -i -npe 's,( href="(.*?)/?"), class="C_$$2"$$1,g' ${TMP}/de.cities.* ${TMP}/en.cities.* ${TMP}/local.cities.*
${MOBILE_LINKS} --local-names=1 --split-city-names=1 --lang=en < ${CITIES_DB} > ${TMP}/mobile.en
${INDEX_UPDATE} world/web/index.m.html.in > world/web/index.m.html
${INDEX_UPDATE} world/web/index.de.html.in > world/web/index.de.html
${INDEX_UPDATE} world/web/index.en.html.in > world/web/index.en.html
${INDEX_UPDATE} world/web/index.html.in > world/web/index.html
kml:
world/bin/bbbike-world-kml ${CITIES_DB} > world/web/bbbike-world.kml
bbbike2wgs84:
./world/bin/bbbike2wgs84
bbbike2wgs84-mapnik:
if [ -e ${LOG_DIR}/bbbike-mapnik.osm.gz ]; then \
mv -f ${LOG_DIR}/bbbike-mapnik.osm.gz ${LOG_DIR}/bbbike-mapnik.osm.gz.old; \
fi
${NICE} ${BBBIKE_ESERTE_DIR}/miscsrc/bbd2osm --optimize-for=mapnik-bbbike --experiment=cycle-route ${DATA_DIR} | ${GZIP} > ${LOG_DIR}/bbbike-mapnik.osm.gz.tmp
mv -f ${LOG_DIR}/bbbike-mapnik.osm.gz.tmp ${LOG_DIR}/bbbike-mapnik.osm.gz
bbbike-tile-update:
cd ${BBBIKE_ESERTE_DIR} && \
git pull -q; \
git log --format=oneline | head -1 | awk '{ print $$1 }' > .tile-status.new
# skip update if there are no new git commits
if cmp ${BBBIKE_ESERTE_DIR}/.tile-status ${BBBIKE_ESERTE_DIR}/.tile-status.new; then \
true; \
else \
${MAKE} bbbike-tile-update-real; \
fi
bbbike-tile-update-real:
@echo "Updating postgis database from ${BBBIKE_ESERTE_DIR}..., see tmp/log.bbbike-mapnik-postgis${POSTGIS_VERSION}"
${MAKE} DATA_DIR=${BBBIKE_ESERTE_DIR}/data bbbike2wgs84-mapnik
time ${MAKE} bbbike-mapnik-postgis${POSTGIS_VERSION} > tmp/log.bbbike-mapnik-postgis${POSTGIS_VERSION} 2>&1
cd ${BBBIKE_ESERTE_DIR} && git log --format=oneline | head -1 | awk '{ print $$1 }' > .tile-status
${MAKE} tile-cache-cleanup
${MAKE} bbbike-tile-git-gc
#prove world/t/mc-tilecheck.t ./world/t/websites.t
bbbike-tile-git-gc:
cd ${BBBIKE_ESERTE_DIR} && git gc -q
bbbike-mapnik-config8:
if test -e ${POSTGIS_STYLE}; then \
mv -f ${POSTGIS_STYLE} ${POSTGIS_STYLE}.bak; \
fi
cat /usr/share/osm2pgsql/osm2pgsql/default.style world/tile/etc/bbbike.style.inc > ${POSTGIS_STYLE}
bbbike-mapnik-config9 bbbike-mapnik-config:
if test -e ${POSTGIS_STYLE9}; then \
mv -f ${POSTGIS_STYLE9} ${POSTGIS_STYLE9}.bak; \
fi
cat /usr/share/osm2pgsql/default.style world/tile/etc/bbbike.style.inc > ${POSTGIS_STYLE9}
bbbike-mapnik-postgis8:
osm2pgsql --slim -S ${POSTGIS_STYLE} -c ${LOG_DIR}/bbbike-mapnik.osm.gz
bbbike-mapnik-postgis bbbike-mapnik-postgis9:
osm2pgsql --cache-strategy sparse --cache=100 --slim -S ${POSTGIS_STYLE9} -c ${LOG_DIR}/bbbike-mapnik.osm.gz
mapnik-restart:
sudo /etc/init.d/postgresql restart; sleep 1.5
sudo /etc/init.d/apache2 restart; sleep 1.0
sudo /etc/init.d/renderd restart; sleep 0.5
./world/bin/tile-cache-cleanup
planet-download: planet-download-pbf
planet-download-pbf:
download_script=$$(pwd)/world/bin/$@; cd ../osm/download && $$download_script
planet-download-alert:
@./world/bin/$@
planet-daily-update-cron:
@./world/bin/$@.sh
bbbike-deb-repository-setup:
@./world/bin/$@.sh
bbbike-deb-repository-install:
sudo apt-get update -qq
egrep -q '^VERSION_CODENAME=bullseye' /usr/lib/os-release && opt='-t bullseye-backports'; \
sudo apt-get install -qq -y $$opt pyosmium osmium-tool libosmium2-dev
sudo apt-get install -qq -y bbbike-world
sudo apt-get install -qq -y bbbike-world-debian-meta-dev
sudo apt-get clean
sub-planet sub-planet-daily sub-srtm: sub-planet-clean
mkdir -p ../osm/download/$@
make -C world/etc/$@
program=$@ ./world/bin/sub-planet
srtm-download:
./world/bin/$@.sh
sub-planet-statistic:
find ../extract/trash -mtime -7 -type f | xargs ./world/bin/sub-planet-statistic.pl | awk '{ print $$2 }' | sort | uniq -c | sort -nr
sub-planet-clean:
find ../osm/download/sub-* -name '*.tmp' -mmin +240 -print0 | xargs -0 rm -f
create-osp:
rm -rf ${OSP_DIR}
mkdir ${OSP_DIR}
./world/bin/bbbike-world-opensearch-plugin ${OSP_DIR} ${CITIES} bbbike
rsync-tgz:
rsync -a --delay-updates ${DATA_OSM_BBBIKE_DIR}/ ${BBBIKE_SERVER}/usr/local/www/download.bbbike.org/bbbike/${DATA_OSM_DIR}
rsync -a --delay-updates world/etc/cities.csv ${BBBIKE_SERVER}/usr/local/www/download.bbbike.org/bbbike/${DATA_OSM_DIR}
clean-tile tile-cache-cleanup:
world/bin/tile-cache-cleanup
clean: rotate-data-osm
${MAKE} -C world/cgi/msg $@
${MAKE} -C world/bin $@
${MAKE} -C world/cgi $@
${MAKE} -C world/lib $@
${MAKE} -C world/cgi/msg $@
${MAKE} -C world/web/feed $@
${MAKE} -C world/etc/mkgmap $@
rm -f *.bak *.tdy *.ERR
cd world/web && rm -rf ${LANGUAGES}
cd world/web && rm -rf ${CITIES} bbbike
rm -f ${OSMBIKE_DATA}
rm -f world/cgi/msg/*.bak
clean-cache cache-clean:
-du -hs ${BBBIKE_CACHE_DIR}/
-du -hs ${BBBIKE_CACHE_DIR}/* 2>/dev/null
mkdir -p ${BBBIKE_CACHE_DIR}/${BBBIKE_WEB_SERVER} ${BBBIKE_CACHE_DIR}/localhost
mkdir -p ${BBBIKE_CACHE_DIR}/.tmp.$$$$; \
mv -f ${BBBIKE_CACHE_DIR}/*bbbike.org ${BBBIKE_CACHE_DIR}/localhost ${BBBIKE_CACHE_DIR}/.tmp.$$$$ || true; \
rm -rf ${BBBIKE_CACHE_DIR}/.tmp.$$$$ &
# XXX: we dont a caching web server
cache-clean-lighttpd:
mkdir -p ${LIGHTTPD_CACHE_DIR}/${BBBIKE_WEB_SERVER} \
${LIGHTTPD_CACHE_DIR}/dev.bbbike.org \
${LIGHTTPD_CACHE_DIR}/devel.bbbike.org \
${LIGHTTPD_CACHE_DIR}/localhost.bbbike.org \
${LIGHTTPD_CACHE_DIR}/compress
find /var/cache/lighttpd/ -type f -print0 | ${PERL} -n0e unlink
chown -R www-data:www-data ${LIGHTTPD_CACHE_DIR}
cache-gc:
find ${BBBIKE_CACHE_DIR}/ -type f -mtime +21 -print0 | sudo ${PERL} -n0e unlink
rotate-data-osm:
rm -rf ${DATA_OSM_DIR}.old2 ${DATA_OSM_BBBIKE_DIR}.old2
if [ -e ${DATA_OSM_DIR}.old ]; then mv ${DATA_OSM_DIR}.old ${DATA_OSM_DIR}.old2; fi
if [ -e ${DATA_OSM_DIR} ]; then mv ${DATA_OSM_DIR} ${DATA_OSM_DIR}.old; fi
if [ -e ${DATA_OSM_BBBIKE_DIR}.old ]; then mv ${DATA_OSM_BBBIKE_DIR}.old ${DATA_OSM_BBBIKE_DIR}.old2; fi
if [ -e ${DATA_OSM_BBBIKE_DIR} ]; then mv ${DATA_OSM_BBBIKE_DIR} ${DATA_OSM_BBBIKE_DIR}.old; fi
mkdir -p ${DATA_OSM_BBBIKE_DIR}
git checkout ${DATA_OSM_DIR}
rotate-osm:
rm -rf ${OSM_DIR}.old2
if [ -e ${OSM_DIR}.old ]; then mv ${OSM_DIR}.old ${OSM_DIR}.old2; fi
if [ -e ${OSM_DIR} ]; then mv ${OSM_DIR} ${OSM_DIR}.old; fi
git checkout ${OSM_DIR}
update-database: build-runtime
@${BBMAKE} -s opensearch-bbbike
${TIME} ./world/bin/update-database
@${BBMAKE} -s rotate-clean
planet-update planet-daily-update:
./world/bin/planet-daily-update
perlcheck-bbbike-cgi:
perl -I world/lib -c cgi/bbbike.cgi
perltidy perlcheck: perlcheck-bbbike-cgi
${MAKE} -C world/cgi/msg $@
${MAKE} -C world/bin $@
${MAKE} -C world/lib $@
${MAKE} -C world/cgi $@
${MAKE} -C world/etc $@
${MAKE} -C world/web/feed $@
${MAKE} -C world/t $@
${MAKE} git-diff
jsbeautifier js jsb:
${MAKE} -C world/html $@
${MAKE} -C world/tile/web $@
${MAKE} -C world/etc/extract $@
spaces:
cd world && git grep -I ' $$' ./bin ./cgi ./web || true
tidy:
tidy -i -m -w 128 world/web/help.html
create-sitemap:
${MAKE} -C world/sitemap sitemaps
sync-sitemap: create-sitemap
rsync -a world/web/sitemap.xml.gz ${BBBIKE_SERVER}${BBBIKE_WEBSERVER_DIR}/world/web
rsync -a world/download/sitemap.xml.gz ${BBBIKE_SERVER}${BBBIKE_WEBSERVER_DIR}/../download.bbbike.org
update-files: update-files-fast data-distclean
update-files-slow: kml create-osp index update-robots.txt create-bbbike-web-symlinks java-config test-org extract-config data-distclea #create-sitemap
update-files-fast: create-bbbike-web-symlinks
for i in update-robots.txt create-bbbike-web-symlinks garmin-legend update-javascript; do \
LC_ALL=C LANG=C ${BBMAKE} $$i & \
done; wait
LC_ALL=C LANG=C ${BBMAKE} kml create-osp index java-config update-javascript test-org extract-config
garmin-legend:
@if which convert >/dev/null; then \
make -C./world/etc/mkgmap legend; \
else \
echo "convert tool not found, imagemagick package not installed? skip"; \
fi
extract-config:
if [ -e $$HOME/.bbbike-extract.rc ]; then test -e .bbbike-extract.rc || ln -fs $$HOME/.bbbike-extract.rc . ; fi
if [ -e $$HOME/.bbbike-extract-pro.rc ]; then test -e .bbbike-extract-pro.rc || ln -fs $$HOME/.bbbike-extract-pro.rc . ; fi
update-javascript bbbike-js:
make -C./world/html bbbike-js
java-config:
test -r $$HOME/.osmosis || ln -fs $$HOME/projects/bbbike/world/etc/env/dot.osmosis $$HOME/.osmosis
dist-clean devel-clean distclean: clean temp-clean clean-t data-distclean download-clean \
log-clean index-clean cache-clean-local deb-distclean stale-symlink-clean \
rotate-clean bootstrap-clean sub-planet-clean
${MAKE} -C./world/etc/mkgmap distclean
${MAKE} -C./cgi/msg distclean
distclean-real:
cd world; git clean -fdx
git clean -fdx
${BBMAKE} update-files bbbike-c
bootstrap-clean:
rm -rf ${BBBIKE_PARTITION}/tmp/bbbike-bootstrap.*
rotate-clean:
rm -rf rm -rf ${DATA_OSM_DIR}.old rm -rf ${DATA_OSM_DIR}.old2
rm -rf rm -rf ${OSM_DIR}.old rm -rf ${OSM_DIR}.old2
rm -rf rm -rf ${DATA_OSM_BBBIKE_DIR}.old rm -rf ${DATA_OSM_BBBIKE_DIR}.old2
tilesize-clean clean-tilesize-db:
rm -f /var/tmp/_tilesize-$$(perl -e 'print $$<')-*
stale-symlink-clean:
find . -type l -print0 | perl -n0e 'unlink if ! -e'
index-clean:
rm -f ${TMP}/??.cities.*
rm -f ${TMP}/mobile.en
rm -f ${TMP}/local.*
distclean-osm: rotate-osm
clean-t:
${MAKE} -C./t distclean
${MAKE} -C./world/t distclean
temp-clean:
rm -rf ${TMP_DIR}
cache-clean-local: tilesize-clean
rm -rf ./cache
rm -rf /tmp/bbbike-localhost-$$(perl -e 'print $$<')
rm -rf /tmp/bbbike-localhost-$$(whoami)
rm -rf /tmp/bbbike-cgicache-$$(perl -e 'print $$<')
rm -rf /tmp/bbbike-cgicache-$$(whoami)
log-clean:
rm -f log.check log.check-full log.check-world
rm -f tmp/*.log
download-clean:
rm -rf ../osm/download/.tmp.[0-9]*
clean-planet:
rm -f ../osm/download/*.old.*
elevation-check:
${NICE} ${ELEVATION_SCRIPT} --database=../osm/srtm/elevation.db --check
elevation-repair:
${NICE} ${ELEVATION_SCRIPT} --database=../osm/srtm/elevation.db --repair-database
elevation-fetch:
${NICE} ${ELEVATION_SCRIPT} --database=../osm/srtm/elevation.db --debug=1 --geonames-user=bbbikeworld ${CITIES}
elevation-update:
echo ${CITIES} | ${XARGS} -E " " -n500 -P${MAX_ELEVATION_SCRIPTS} ${ELEVATION_SCRIPT} --readonly-database --database=../osm/srtm/elevation.db --debug=0
# re-build cache
_cache-heater: cache-gc cache-heater-homepage cache-heater-opensearch cache-heater-osp cache-heater-streets cache-heater-searches cache-du purge-cache-js
cache-heater: _cache-heater
# do not care about cache failures
cache-heater-k:
${BBMAKE} cache-heater || true
cache-du:
@echo "cache usage"
du -hs ${BBBIKE_CACHE_DIR}/
@if `ls ${BBBIKE_CACHE_DIR}/* >/dev/null`; then du -hs ${BBBIKE_CACHE_DIR}/*; fi
cache-heater-streets:
echo ${CITIES} | ${PERL} -npe 's/ /\n/g' | \
${PERL} -e 'while(<>) { chomp; push @a, "https://'${BBBIKE_WEB_SERVER}'/$$_/streets.html"; push @b, "https://'${BBBIKE_WEB_SERVER}'/en/$$_/streets.html" } print join "\0", @a, ""' | \
cat > tmp/$@.txt
${XARGS} -0 -n8 -P2 curl -sS ${CURL_USER_AGENT} -X PURGE < tmp/$@.txt >/dev/null
${XARGS} -0 -n1 -P${MAX_CPU} curl -sSf ${CURL_USER_AGENT} < tmp/$@.txt >/dev/null
purge-cache-js:
find html \( -name '*.js' -or -name '*.css' \) -print0 | perl -0npe 's,^,https://'${BBBIKE_WEB_SERVER}'/,g' | ${XARGS} -0 -n1 -P1 curl -sS ${CURL_USER_AGENT} -X PURGE
cache-heater-searches:
random=$$(bash -c 'echo $$RANDOM'); \
for city in ${CITIES}; do \
perl -e 'print qq{curl -sSf -A "BBBike.org-CacheHeater/1.0" "https://'${BBBIKE_WEB_SERVER}/$$city/?$$(./world/bin/bbbike-db --startc $$city)'&pref_cat=N1&pref_quality=Q2&cache='$$random'" | egrep real_time\0}'; \
done > tmp/$@.txt.tmp
mv -f tmp/$@.txt.tmp tmp/$@.txt
${XARGS} -0 -n1 -P${MAX_CPU} /bin/bash -c < tmp/$@.txt > tmp/$@.log
perl -n0pe 's/^curl/curl -X PURGE/; s/\|.*\0/\0/' tmp/$@.txt | ${XARGS} -0 -n1 /bin/sh -c >/dev/null
cache-heater-homepage: cache-heater-osp
echo ${CITIES} | ${PERL} -npe 's/ /\n/g' | \
${PERL} -e 'while(<>) { chomp; push @a, "https://'${BBBIKE_WEB_SERVER}'/$$_/"; push @b, "https://'${BBBIKE_WEB_SERVER}'/en/$$_/"; push @c, "https://'${BBBIKE_WEB_SERVER}'/m/$$_/" } print join "\0", @a, ""' | \
cat > tmp/$@.txt
${XARGS} -0 -n8 -P2 curl -sS ${CURL_USER_AGENT} -X PURGE < tmp/$@.txt >/dev/null
${XARGS} -0 -n1 -P${MAX_CPU} curl -sSf ${CURL_USER_AGENT} < tmp/$@.txt >/dev/null
cache-heater-osp:
find osp -name '*.xml' -print0 | perl -n0e 'print qq{https://'${BBBIKE_WEB_SERVER}'/$$_}' | \
cat > tmp/$@.txt
${XARGS} -0 -n8 -P2 curl -sS ${CURL_USER_AGENT} -X PURGE < tmp/$@.txt >/dev/null
${XARGS} -0 -n8 -P${MAX_CPU} curl -sSf ${CURL_USER_AGENT} < tmp/$@.txt >/dev/null
cache-heater-opensearch:
cat ${BBBIKE_WEBSERVER_DIR}/data-osm/*/opensearch.streetnames | wc -c >/dev/null
varnish-purge-all:
./world/bin/varnish-purge-all
symlink-download:
cd ${BBBIKE_WEBSERVER_DIR}/../download.bbbike.org; \
ln -fs ../bbbike.org/world/download/favicon.ico . ; \
ln -fs ../bbbike.org/world/download/osm/index.html . ; \
ln -fs ../bbbike.org/world/web/robots-download.txt robots.txt ; \
cd osm; ln -fs ../../bbbike.org/world/download/osm/index.html .
cache-install:
cd ${BBBIKE_PARTITION}; mkdir -p cache
# make EXTRACTS_SPOOL_DIR=/opt/bbbike/extract-pro extract-bbbike-org-install
extract-bbbike-org-install: create-usr-local-www
sudo mkdir -p ${BBBIKE_PARTITION}/$$(basename ${EXTRACTS_SPOOL_DIR})
mkdir -p ${BBBIKE_PARTITION}/projects/osm/download
sudo chown -R ${LOGNAME} ${BBBIKE_PARTITION}/$$(basename ${EXTRACTS_SPOOL_DIR})
if [ ! -e ${EXTRACTS_SPOOL_DIR} ]; then \
sudo ln -fs -T ${BBBIKE_PARTITION}/$$(basename ${EXTRACTS_SPOOL_DIR}) ${EXTRACTS_SPOOL_DIR}; \
fi
mkdir -p ${EXTRACTS_SPOOL_DIR}/confirmed
mkdir -p ${EXTRACTS_SPOOL_DIR}/running
mkdir -p ${EXTRACTS_SPOOL_DIR}/osm
mkdir -p ${EXTRACTS_SPOOL_DIR}/download
mkdir -p ${EXTRACTS_SPOOL_DIR}/trash
mkdir -p ${EXTRACTS_SPOOL_DIR}/failed
mkdir -p ${EXTRACTS_SPOOL_DIR}/failed2
sudo chown -R ${LOGNAME}:${WEB_GROUP} ${EXTRACTS_SPOOL_DIR}/
chmod -R a+rX,gu+w ${EXTRACTS_SPOOL_DIR}/
${MAKE} osmconvert-install
${MAKE} extract-bin-install