forked from aantron/bisect_ppx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
npm-install.sh
50 lines (43 loc) · 1.17 KB
/
npm-install.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
#!/usr/bin/env bash
esy_build() {
set -e
set -x
esy install -P binaries.esy.json
esy -P binaries.esy.json dune build -p bisect_ppx src/ppx/js/ppx.exe
cp _build/default/src/ppx/js/ppx.exe ./ppx
esy -P binaries.esy.json dune build -p bisect_ppx src/report/main.exe
cp _build/default/src/report/main.exe ./bisect-ppx-report
exit 0
}
UNAME=`uname -s`
RESULT=$?
if [ "$RESULT" != 0 ]
then
echo "Cannot detect OS; falling back to a source build."
esy_build
fi
case "$UNAME" in
"Linux") OS=linux;;
"Darwin") OS=macos;;
*) echo "Unknown OS '$UNAME'; falling back to a source build."; esy_build;;
esac
if [ ! -f bin/$OS/ppx ]
then
echo "bin/$OS/ppx not found; falling back to a source build."
esy_build
fi
if [ ! -f bin/$OS/bisect-ppx-report ]
then
echo "bin/$OS/bisect-ppx-report not found; falling back to a source build."
esy_build
fi
bin/$OS/bisect-ppx-report --help plain > /dev/null
RESULT=$?
if [ "$RESULT" != 0 ]
then
echo "Pre-built binaries invalid; falling back to a source build."
esy_build
fi
echo "Using pre-built binaries for system '$OS'."
cp bin/$OS/ppx ./ppx
cp bin/$OS/bisect-ppx-report ./bisect-ppx-report