-
Notifications
You must be signed in to change notification settings - Fork 369
Expand file tree
/
Copy pathmultibuild.sh
More file actions
executable file
·61 lines (54 loc) · 1.49 KB
/
Copy pathmultibuild.sh
File metadata and controls
executable file
·61 lines (54 loc) · 1.49 KB
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/sh
# Convenience build script for w64devkit, primarily for automatic builds of
# multiple release flavors in one shot. By default it does a standard build
# at the current commit.
#
# Example, build a full release on an arbitrary commit:
# $ ./multibuild.sh -as "$(git describe | tr v -)"
set -e
variants=
dryrun=
suffix="$(git describe --exact-match 2>/dev/null | tr v - || true)"
usage() {
cat <<EOF
usage: multibuild.sh [-48ahn] [-s SUFFIX]
-4 Enable x86 build
-8 Enable x64 build
-a All variants
-h Print this help message
-n Dry run, print commands but do nothing
-s SUFFIX Append a version suffix (default: auto from git tag)
EOF
}
while getopts 48ahns: opt; do
case $opt in
4) variants="$variants x86";;
8) variants="$variants x64";;
a) variants="x64 x86";;
h) usage; exit 0;;
n) dryrun=echo;;
s) suffix="$OPTARG";;
?) usage >&2; exit 1;;
esac
done
shift $((OPTIND - 1))
if [ $# -gt 0 ]; then
printf 'multibuild.sh: Too many arguments\n' >&2
usage >&2
exit 1
fi
: ${variants:=x64}
target="tmp-w64-$$"
cleanup() {
$dryrun docker rmi --no-prune $target 2>/dev/null || true
}
trap cleanup EXIT
for variant in $variants; do
$dryrun docker build --build-arg VARIANT=$variant -t $target .
out="w64devkit-$variant$suffix.7z.exe"
if [ -n "$dryrun" ]; then
$dryrun docker run --rm $target ">$out"
else
docker run --rm $target >"$out"
fi
done