forked from openthread/wpantund
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·128 lines (110 loc) · 3.14 KB
/
bootstrap.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
#!/bin/sh
#
# Copyright (c) 2016 Nest Labs, Inc.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
LOGFILE=`mktemp -q /tmp/bootstrap.log.XXXXXX`
BOOTSTRAP_ANDROID=0
BOOTSTRAP_AUTOTOOLS=1
SOURCE_DIR=$(cd `dirname $0` && pwd)
AUTOANDR=${AUTOANDR-${SOURCE_DIR}/etc/autoandr/autoandr}
AUTOMAKE="automake --foreign"
die() {
local errcode=$?
local prog=$1
shift
echo " ***************************** "
[[ $prog == "autoreconf" ]] && cat "$LOGFILE"
echo ""
if [[ $# -ge 1 ]]
then echo " *** $prog failed: \"$*\""
else echo " *** $prog failed with error code $errcode"
fi
exit 1
}
while [ "$#" -ge 1 ]
do
case $1 in
--all)
BOOTSTRAP_ANDROID=1
BOOTSTRAP_AUTOTOOLS=1
;;
--android)
BOOTSTRAP_ANDROID=1
BOOTSTRAP_AUTOTOOLS=0
;;
--verbose)
LOGFILE=/dev/stderr
export V=1
;;
*)
die bootstrap "Unknown argument: $1"
;;
esac
shift
done
if [ "$BOOTSTRAP_AUTOTOOLS" = 1 ]
then
cd "${SOURCE_DIR}"
which autoreconf 1>/dev/null 2>&1 || {
echo " *** error: The 'autoreconf' command was not found."
echo "Use the appropriate command for your platform to install the package:"
echo ""
echo "Homebrew(OS X) ....... brew install libtool autoconf autoconf-archive"
echo "Debian/Ubuntu ........ apt-get install libtool autoconf autoconf-archive"
exit 1
}
autoreconf --verbose --force --install 2>"$LOGFILE" || die autoreconf
grep -q AX_CHECK_ configure && {
echo " *** error: The 'autoconf-archive' package is not installed."
echo "Use the appropriate command for your platform to install the package:"
echo ""
echo "Homebrew(OS X) ....... brew install autoconf-archive"
echo "Debian/Ubuntu ........ apt-get install autoconf-archive"
exit 1
}
fi
if [ "$BOOTSTRAP_ANDROID" = 1 ]
then
cd "${SOURCE_DIR}"
AUTOANDR_STDOUT="$LOGFILE" \
AUTOANDR_MODULE_TAGS=optional \
$AUTOANDR start \
--disable-option-checking \
--enable-static-link-ncp-plugin \
--disable-shared \
--prefix=/system \
--localstatedir=/data/misc \
--bindir=/system/bin \
--sbindir=/system/bin \
--libexecdir=/system/bin \
--libdir=/system/lib \
--includedir=/system/include \
--oldincludedir=/system/include \
--enable-debug=verbose \
CXXFLAGS="-fexceptions -Wno-non-virtual-dtor -frtti -Wno-c++11-narrowing" \
CPPFLAGS="-Wno-date-time -Wno-unused-parameter -Wno-missing-field-initializers -Wno-sign-compare" \
DBUS_CFLAGS="-Iexternal/dbus" \
DBUS_LIBS="-ldbus" \
TUNNEL_TUNTAP_DEVICE="/dev/tun" \
SOCKET_UTILS_DEFAULT_SHELL="/system/bin/sh" \
ac_cv_func_getdtablesize=no \
ac_cv_func_fgetln=no \
ac_cv_header_util_h=no \
--with-boost=internal \
|| die autoandr
fi
echo
echo Success. Logs in '"'$LOGFILE'"'