@@ -9,7 +9,8 @@ export SCRIPT_DIR=$(dirname "$0")
99config ()
1010{
1111 # 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" }
1314
1415 export REQUIRED_TOOLS
1516}
@@ -22,12 +23,6 @@ main ()
2223{
2324 config
2425
25- if [ -n " $REQUIRED_TOOLS " ]
26- then
27- echo " *** Checking dependencies..."
28- check_deps
29- fi
30-
3126 local submodules=$( git submodule status)
3227 local result=$?
3328
@@ -41,28 +36,38 @@ main ()
4136 echo " *** Updating submodules..."
4237 update_submodules
4338 fi
39+
40+ if [ -n " $REQUIRED_TOOLS " ]
41+ then
42+ echo " *** Checking dependencies..."
43+ check_deps
44+ fi
4445}
4546
4647check_deps ()
4748{
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
5763
5864 # Ensure that we have libgit2's dependencies installed.
5965 installed=` brew list`
60- libs=" libssh2 libtool autoconf automake pkg-config"
6166
62- for lib in $libs
67+ for tool in $REQUIRED_TOOLS
6368 do
6469 # Skip packages that are already installed.
65- echo " $installed " | grep -q " $lib " && code=$? || code=$?
70+ echo " $installed " | grep -q " $tool " && code=$? || code=$?
6671
6772 if [ " $code " -eq " 0" ]
6873 then
@@ -72,8 +77,8 @@ check_deps ()
7277 exit $code
7378 fi
7479
75- echo " *** Installing $lib with Homebrew..."
76- brew install " $lib "
80+ echo " *** Installing $tool with Homebrew..."
81+ brew install " $tool "
7782 done
7883
7984 brew_prefix=` brew --prefix`
@@ -114,7 +119,9 @@ bootstrap_submodule ()
114119
115120update_submodules ()
116121{
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
118125}
119126
120127export -f bootstrap_submodule
0 commit comments