Skip to content

Commit 0429b00

Browse files
author
Damian Rouson
committed
Updated buildcmake to work properly on OS X.
Signed-off-by: Damian Rouson <[email protected]>
1 parent 7a8b2f0 commit 0429b00

File tree

1 file changed

+35
-7
lines changed

1 file changed

+35
-7
lines changed

install_prerequisites/buildcmake

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,42 @@ fi
8585

8686
check_prerequisites()
8787
{
88+
unamestr=`uname`
89+
if [[ "$unamestr" == 'Darwin' ]]; then
90+
if [ -f /usr/bin/gcc ]; then
91+
CC=/usr/bin/gcc
92+
else
93+
echo "Missing /usr/bin/gcc, which must exist and be an Apple LLVM version."
94+
exit 1
95+
fi
96+
if [ -f /usr/bin/g++ ]; then
97+
CXX=/usr/bin/g++
98+
else
99+
echo "Missing /usr/bin/g++, which must exist and be an Apple LLVM version."
100+
exit 1
101+
fi
102+
else
103+
# If this is not OS X, default to the user-specified compiler.
104+
# If there is no user-specified compiler, use whatever the
105+
# GNU compilers are in the path.
106+
if [ -z $CC ]; then
107+
CC=gcc
108+
fi
109+
if [ -z $CXX ]; then
110+
CXX=g++
111+
fi
112+
fi
113+
114+
# Verify that 'wget' is is in the path.
88115
if ! type wget > /dev/null; then
89116
echo
90-
echo "$cmd requires 'wget'. Please install it. Aborting."
91-
exit 1;
92-
elif ! type make > /dev/null; then
117+
echo "$cmd requires 'wget'. Please ensure that it is installed and in your path. Aborting."
118+
exit 1
119+
fi
120+
if ! type make > /dev/null; then
93121
echo
94-
echo "$cmd requires 'make'. Please install it. Aborting."
95-
exit 1;
122+
echo "$cmd requires 'make'. Please ensure that it is installed and in your path. Aborting."
123+
exit 1
96124
fi
97125
}
98126

@@ -118,7 +146,7 @@ unpack()
118146
build()
119147
{
120148
cd cmake-$version &&
121-
./bootstrap --prefix=$install_path &&
149+
CC=$CC CXX=$CXX ./bootstrap --prefix=$install_path &&
122150
make -j $num_threads
123151
}
124152

@@ -147,7 +175,7 @@ else
147175
check_prerequisites &&
148176
download &&
149177
unpack &&
150-
build $version $install_path $num_threads
178+
CC=$CC CXX=$CXX build $version $install_path $num_threads
151179
} >&1 | tee build.log
152180
echo ""
153181
echo "Check build.log for results. If the build was successful, type"

0 commit comments

Comments
 (0)