-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·64 lines (59 loc) · 1.58 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
62
63
64
#!/usr/bin/env bash
function run_darwin {
# https://source.android.com/setup/build/initializing#setting-up-a-mac-os-x-build-environment
if [[ ! -f espressobin_build.dmg || ! -f espressobin_build.dmg.sparseimage ]]; then
hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 40g ./espressobin_build.dmg
fi
hdiutil attach ./espressobin_build.dmg.sparseimage -mountpoint ./build/ \
|| hdiutil attach ./espressobin_build.dmg -mountpoint ./build/
run_build
hdiutil detach ./build/
}
function run_build {
docker run --rm -it \
--name espressobin-build \
--mount type=bind,source="$(pwd)"/bin/,target=/data/ \
--mount type=bind,source="$(pwd)"/build/,target=/build/ \
--mount type=bind,source="$(pwd)"/cache/,target=/cache/ \
espressobin/build:latest
}
function clean_build {
case "$(uname -s)" in
Linux*)
rm -rf build/*
;;
Darwin*)
rm espressobin_build.dmg*
;;
* )
printf "Uncertain how to clean build!\n"
;;
esac
}
while true; do
read -p "Reset build folders? [Y/N]: " yn
case $yn in
[Yy]* )
clean_build
break
;;
[Nn]* )
break
;;
* )
printf "Please answer [Yy]es or [Nn]o.\n"
;;
esac
done
docker build -t espressobin/build .
case "$(uname -s)" in
Linux*)
run_build
;;
Darwin*)
run_darwin
;;
* )
printf "OS currently unsupported!\n"
;;
esac