author | wenzelm |
Fri, 09 Sep 2022 21:15:11 +0200 | |
changeset 76101 | e59d7d6fe1bd |
parent 73705 | ac07f6be27ea |
child 79749 | a861b0df74b4 |
permissions | -rwxr-xr-x |
47799 | 1 |
#!/usr/bin/env bash |
2 |
# |
|
3 |
# Multi-platform build script |
|
4 |
||
73705
ac07f6be27ea
avoid unexpected output+behaviour when CDPATH is set
kleing
parents:
73599
diff
changeset
|
5 |
unset CDPATH |
47799 | 6 |
THIS="$(cd "$(dirname "$0")"; pwd)" |
7 |
PRG="$(basename "$0")" |
|
8 |
||
9 |
||
10 |
# diagnostics |
|
11 |
||
12 |
function usage() |
|
13 |
{ |
|
14 |
echo |
|
76101
e59d7d6fe1bd
clarified directory names (e.g. for multi-platform remote execution): avoid being deleted via isabelle.Components.purge;
wenzelm
parents:
73705
diff
changeset
|
15 |
echo "Usage: $PRG PLATFORM" |
47799 | 16 |
echo |
17 |
exit 1 |
|
18 |
} |
|
19 |
||
20 |
function fail() |
|
21 |
{ |
|
22 |
echo "$1" >&2 |
|
23 |
exit 2 |
|
24 |
} |
|
25 |
||
26 |
||
27 |
# command line args |
|
28 |
||
29 |
[ "$#" -eq 0 ] && usage |
|
76101
e59d7d6fe1bd
clarified directory names (e.g. for multi-platform remote execution): avoid being deleted via isabelle.Components.purge;
wenzelm
parents:
73705
diff
changeset
|
30 |
PLATFORM="$1"; shift |
47799 | 31 |
|
32 |
[ "$#" -eq 0 ] || usage |
|
33 |
||
34 |
||
35 |
# main |
|
36 |
||
76101
e59d7d6fe1bd
clarified directory names (e.g. for multi-platform remote execution): avoid being deleted via isabelle.Components.purge;
wenzelm
parents:
73705
diff
changeset
|
37 |
PLATFORM_DIR="platform_${PLATFORM}" |
47799 | 38 |
|
76101
e59d7d6fe1bd
clarified directory names (e.g. for multi-platform remote execution): avoid being deleted via isabelle.Components.purge;
wenzelm
parents:
73705
diff
changeset
|
39 |
case "$PLATFORM" in |
73599 | 40 |
arm64-linux) |
76101
e59d7d6fe1bd
clarified directory names (e.g. for multi-platform remote execution): avoid being deleted via isabelle.Components.purge;
wenzelm
parents:
73705
diff
changeset
|
41 |
mkdir -p "$PLATFORM_DIR" |
e59d7d6fe1bd
clarified directory names (e.g. for multi-platform remote execution): avoid being deleted via isabelle.Components.purge;
wenzelm
parents:
73705
diff
changeset
|
42 |
cc -Wall bash_process.c -o "$PLATFORM_DIR/bash_process" |
73599 | 43 |
;; |
47801 | 44 |
x86_64-linux | x86_64-darwin) |
76101
e59d7d6fe1bd
clarified directory names (e.g. for multi-platform remote execution): avoid being deleted via isabelle.Components.purge;
wenzelm
parents:
73705
diff
changeset
|
45 |
mkdir -p "$PLATFORM_DIR" |
e59d7d6fe1bd
clarified directory names (e.g. for multi-platform remote execution): avoid being deleted via isabelle.Components.purge;
wenzelm
parents:
73705
diff
changeset
|
46 |
cc -Wall -m64 bash_process.c -o "$PLATFORM_DIR/bash_process" |
47799 | 47 |
;; |
73599 | 48 |
x86_64-cygwin) |
76101
e59d7d6fe1bd
clarified directory names (e.g. for multi-platform remote execution): avoid being deleted via isabelle.Components.purge;
wenzelm
parents:
73705
diff
changeset
|
49 |
mkdir -p "$PLATFORM_DIR" |
e59d7d6fe1bd
clarified directory names (e.g. for multi-platform remote execution): avoid being deleted via isabelle.Components.purge;
wenzelm
parents:
73705
diff
changeset
|
50 |
cc -Wall bash_process.c -o "$PLATFORM_DIR/bash_process.exe" |
47799 | 51 |
;; |
52 |
*) |
|
76101
e59d7d6fe1bd
clarified directory names (e.g. for multi-platform remote execution): avoid being deleted via isabelle.Components.purge;
wenzelm
parents:
73705
diff
changeset
|
53 |
fail "Bad target platform: \"$PLATFORM\"" |
47799 | 54 |
;; |
55 |
esac |