@@ -9,7 +9,8 @@ export SCRIPT_DIR=$(dirname "$0")
9
9
config ()
10
10
{
11
11
# A whitespace-separated list of executables that must be present and locatable.
12
- : ${REQUIRED_TOOLS=" xctool cmake" }
12
+ # These will each be installed through Homebrew if not found.
13
+ : ${REQUIRED_TOOLS=" xctool cmake libssh2 libtool autoconf automake pkg-config" }
13
14
14
15
export REQUIRED_TOOLS
15
16
}
@@ -22,12 +23,6 @@ main ()
22
23
{
23
24
config
24
25
25
- if [ -n " $REQUIRED_TOOLS " ]
26
- then
27
- echo " *** Checking dependencies..."
28
- check_deps
29
- fi
30
-
31
26
local submodules=$( git submodule status)
32
27
local result=$?
33
28
@@ -41,28 +36,38 @@ main ()
41
36
echo " *** Updating submodules..."
42
37
update_submodules
43
38
fi
39
+
40
+ if [ -n " $REQUIRED_TOOLS " ]
41
+ then
42
+ echo " *** Checking dependencies..."
43
+ check_deps
44
+ fi
44
45
}
45
46
46
47
check_deps ()
47
48
{
48
- for tool in $REQUIRED_TOOLS
49
- do
50
- which -s " $tool "
51
- if [ " $? " -ne " 0" ]
52
- then
53
- echo " *** Error: $tool not found. Please install it and bootstrap again."
54
- exit 1
55
- fi
56
- done
49
+ # Check if Homebrew is installed
50
+ which -s brew
51
+ local result=$?
52
+
53
+ if [ " $result " -ne " 0" ]
54
+ then
55
+ echo
56
+ echo " Homebrew is not installed (http://brew.sh). You will need to manually ensure the following tools are installed:"
57
+ echo " $REQUIRED_TOOLS "
58
+ echo
59
+ echo " Additionally, the following libssh2 files must be symlinked under /usr/local:"
60
+ echo " lib/libssh2.a include/libssh2.h include/libssh2_sftp.h include/libssh2_publickey.h"
61
+ exit $result
62
+ fi
57
63
58
64
# Ensure that we have libgit2's dependencies installed.
59
65
installed=` brew list`
60
- libs=" libssh2 libtool autoconf automake pkg-config"
61
66
62
- for lib in $libs
67
+ for tool in $REQUIRED_TOOLS
63
68
do
64
69
# Skip packages that are already installed.
65
- echo " $installed " | grep -q " $lib " && code=$? || code=$?
70
+ echo " $installed " | grep -q " $tool " && code=$? || code=$?
66
71
67
72
if [ " $code " -eq " 0" ]
68
73
then
@@ -72,8 +77,8 @@ check_deps ()
72
77
exit $code
73
78
fi
74
79
75
- echo " *** Installing $lib with Homebrew..."
76
- brew install " $lib "
80
+ echo " *** Installing $tool with Homebrew..."
81
+ brew install " $tool "
77
82
done
78
83
79
84
brew_prefix=` brew --prefix`
@@ -114,7 +119,9 @@ bootstrap_submodule ()
114
119
115
120
update_submodules ()
116
121
{
117
- git submodule sync --quiet && git submodule update --init && git submodule foreach --quiet bootstrap_submodule
122
+ git submodule sync --quiet && \
123
+ git submodule update --init && \
124
+ git submodule foreach --quiet bootstrap_submodule
118
125
}
119
126
120
127
export -f bootstrap_submodule
0 commit comments