-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmake.sh
69 lines (64 loc) · 1.6 KB
/
make.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
62
63
64
65
66
67
68
69
#!/usr/bin/env bash
function priv_clippit
(
cat <<EOF
Usage: bash ${0} [OPTIONS]
Options:
build Build program
EOF
)
function priv_pkgsearch
(
if ((${#})); then
for REPLY in "${@}"; do
lazbuild --verbose-pkgsearch "${REPLY}" || lazbuild --add-package "${REPLY}"
done
fi
)
function priv_packages
(
if [[ -d 'use' ]]; then
git submodule update --init --recursive
else
mkdir 'use'
fi
if ((${#})); then
for REPLY in "${@}"; do
declare -A VAR=(
[url]="https://packages.lazarus-ide.org/${REPLY}.zip"
[out]=$(mktemp)
[dir]=${REPLY##/*}
)
wget --output-document "${VAR[out]}" "${VAR[url]}"
unzip -o "${VAR[out]}" -d "use/${VAR[dir]}"
rm --verbose "${VAR[out]}"
done
fi
find 'use' -type 'f' -name '*.lpk' -exec lazbuild --add-package-link {} +
)
function priv_main
(
set -euo pipefail
if ! (which lazbuild); then
source '/etc/os-release'
case ${ID:?} in
debian | ubuntu)
sudo apt-get update
sudo apt-get install -y lazarus
;;
esac
fi
if ((${#})); then
case ${1} in
build)
priv_pkgsearch
priv_packages 'FPSpreadsheet' 'Synapse40.1'
find 'source' -type 'f' -name '*.lpi' \
-exec lazbuild --no-write-project --recursive --no-write-project {} 1>&2 +
;;
esac
else
priv_clippit
fi
)
priv_main "${@}" >/dev/null