-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathbuild.sh
executable file
·61 lines (46 loc) · 1.72 KB
/
build.sh
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
#!/bin/bash
# Build artefacts required by http://download.xcsoar.org/.
# Halt on errors:
set -e
## Output directory:
OUT="${1}"
# Set default to output if not specified
if [ -z "${OUT}" ]; then
OUT="./output"
fi
# Ensure output dir is empty
if [ -d "${OUT}" ]; then
rm -rf "${OUT}"
fi
# Rsync static content
rsync -apt --mkpath data/content/ "${OUT}/content/"
## REMOTE Stage
# add the openaip cup files
./script/build/xcsoar-openaip-generate-all-cup.py "${OUT}"
# Download weglide segments
./script/build/download-file.py "https://api.weglide.org/v1/segment/export?format=tsk" "${OUT}/content/task/global/" GLB-TSK-Segments-Weglide.tsk.json
## GENERATE Stage
# Web site artefacts: waypoints
./script/build/waypoints_js.py data/content/waypoint/country/ "${OUT}/content/waypoint/0_META/"
# Concatenate all waypoints to xcsoar-waypoints.cup
CUPHEADER="name,code,country,lat,lon,elev,style,rwdir,rwlen,freq,desc"
XCSWAYPOINTSDIR="${OUT}/content/waypoint/global"
XCSWAYPOINTS="${XCSWAYPOINTSDIR}/xcsoar_waypoints.cup"
XCSWAYPOINTSTMP="$(mktemp)"
for each in $(find data/content/waypoint/country/ -name "*.cup")
do
dos2unix < "${each}" | grep -v "${CUPHEADER}" >> "${XCSWAYPOINTSTMP}"
done
mkdir -p "${XCSWAYPOINTSDIR}"
echo "${CUPHEADER}" > "${XCSWAYPOINTS}"
sort -bu "${XCSWAYPOINTSTMP}" >> "${XCSWAYPOINTS}"
rm "${XCSWAYPOINTSTMP}"
# Web site artefacts: maps
./script/build/maps_config_js.py "${OUT}/source/map/0_META/"
# Build maps if needed
bash -x ./script/build/generate_maps.sh "${OUT}"
## REPO Stage
# XCSoar App's manifest file (https://download.xcsoar.org/repository)
./script/build/repository.py "${OUT}"
./script/build/sortrepo.py "${OUT}"/repository > "${OUT}"/repository.sorted
mv "${OUT}"/repository.sorted "${OUT}"/repository