-
Notifications
You must be signed in to change notification settings - Fork 2
/
make-deps.sh
executable file
·130 lines (121 loc) · 3.09 KB
/
make-deps.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/bash
# Copyright 2018, Microsoft Research, Daan Leijen
echo "--- Building NodeC dependencies ---"
curdir=`pwd`
export curdir
echo $curdir
build_libhandler="yes"
build_libuv="yes"
build_zlib="yes"
build_mbedtls="yes"
# Parse command-line arguments
while : ; do
flag="$1"
case "$flag" in
*=*) flag_arg="${flag#*=}";;
*) flag_arg="yes" ;;
esac
# echo "option: $flag, arg: $flag_arg"
case "$flag" in
"") break;;
--libuv)
build_libuv="yes";;
--no-libuv)
build_libuv="no";;
--libhandler)
build_libhandler="yes";;
--no-libhandler)
build_libhandler="no";;
--zlib)
build_zlib="yes";;
--no-zlib)
build_zlib="no";;
--mbedtls)
build_mbedtls="yes";;
--no-mbedtls)
build_mbedtls="no";;
-h|--help|-\?|help|\?)
echo "./configure [options]"
echo " --libuv build libuv (default)"
echo " --no-libuv skip libuv"
echo " --libhandler build libhandler (default)"
echo " --no-libhandler skip libhandler"
echo " --zlib build zlib (default)"
echo " --no-zlib skip zlib"
exit 0;;
*) echo "warning: unknown option \"$1\"." 1>&2
esac
shift
done
echo "use '--help' for help on configuation options."
if test "$build_libhandler" = "yes"; then
echo "--- Building Libhandler ---"
cd deps/libhandler
if test -f "./out/makefile.config"; then
echo "found previous out/makefile.config; skip configure"
else
echo "--- Libhandler: configure..."
./configure
fi
echo ""
echo "--- Libhandler: debug build..."
make
echo ""
echo "--- Libhandler: release build..."
make VARIANT=release
echo ""
echo "--- Libhandler done ---"
cd "$curdir"
fi
if test "$build_libuv" = "yes"; then
echo ""
echo "--- Building LibUV ---"
cd deps/libuv
if test -f "./config.status"; then
echo "found previous config.status; skip configure"
else
if test -f "./configure"; then
echo "found previous configure; skip autogen.sh"
else
echo "--- LibUV: autogen..."
./autogen.sh
fi
echo "--- LibUV: configure..."
config_cmd="./configure --prefix=$curdir/deps/libuv/out --enable-static --config-cache"
echo "$config_cmd"
$config_cmd
fi
echo
echo "--- LibUV: release build..."
make install
echo ""
echo "--- LibUV: done ---"
cd "$curdir"
fi
if test "$build_zlib" = "yes"; then
echo "--- Building ZLib ---"
cd deps/zlib
if test -f "./configure.log"; then
echo "found previous configure.log; skip configure"
else
echo "--- ZLib: configure..."
config_cmd="./configure --prefix=$curdir/deps/zlib/out --static"
echo "$config_cmd"
$config_cmd
fi
echo ""
echo "--- ZLib: release build..."
make install
echo ""
echo "--- ZLib: done ---"
cd "$curdir"
fi
if test "$build_mbedtls" = "yes"; then
echo "--- Building mbedTLS ---"
cd deps/mbedtls
make lib
echo ""
echo "--- mbedTLS: done ---"
cd "$curdir"
fi
echo "--- Done building dependencies ---"