| author | wenzelm |
| Thu, 04 Aug 2022 11:29:40 +0200 | |
| changeset 75749 | 45fc58d48e4a |
| parent 73705 | ac07f6be27ea |
| child 76101 | e59d7d6fe1bd |
| 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 |
|
15 |
echo "Usage: $PRG TARGET" |
|
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 |
|
30 |
TARGET="$1"; shift |
|
31 |
||
32 |
[ "$#" -eq 0 ] || usage |
|
33 |
||
34 |
||
35 |
# main |
|
36 |
||
37 |
mkdir -p "$TARGET" |
|
38 |
||
39 |
case "$TARGET" in |
|
| 73599 | 40 |
arm64-linux) |
41 |
cc -Wall bash_process.c -o "$TARGET/bash_process" |
|
42 |
;; |
|
| 47801 | 43 |
x86_64-linux | x86_64-darwin) |
| 62566 | 44 |
cc -Wall -m64 bash_process.c -o "$TARGET/bash_process" |
| 47799 | 45 |
;; |
| 73599 | 46 |
x86_64-cygwin) |
| 62566 | 47 |
cc -Wall bash_process.c -o "$TARGET/bash_process.exe" |
| 47799 | 48 |
;; |
49 |
*) |
|
| 73599 | 50 |
fail "Bad target platform: \"$TARGET\"" |
| 47799 | 51 |
;; |
52 |
esac |