Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setup.sh and build.sh #4

Merged
merged 2 commits into from
Feb 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ if $gccBuild; then
# variable for build output
build_dir=build_gcc_debug
# gcc tools
gcc_ver=$(gcc -dumpfullversion)
gcc_path=$(which cmake)
if [[ "$gcc_path" == "" ]] ; then
if ! which gcc; then
echo "ERROR: run setup.sh to install a good version of gcc."
exit 1
else
gcc_ver=$(gcc -dumpfullversion)
fi

if version_less_than_equal_to $gcc_ver $MIN_GCC_VERSION; then
export CC="gcc-6"
export CXX="g++-6"
Expand Down
60 changes: 32 additions & 28 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ done

if $gccBuild; then
# gcc tools
gcc_ver=$(gcc -dumpfullversion)
gcc_path=$(which cmake)
if [[ "$gcc_path" == "" ]] ; then
if ! which gcc; then
# GCC not installed
gcc_ver=0
else
gcc_ver=$(gcc -dumpfullversion)
fi

if version_less_than_equal_to $gcc_ver $MIN_GCC_VERSION; then
if [ "$(uname)" == "Darwin" ]; then # osx
brew update
Expand Down Expand Up @@ -102,37 +104,39 @@ else #linux
#install additional tools
sudo apt-get install -y build-essential
sudo apt-get install -y unzip
fi

if ! which cmake; then
# CMake not installed
cmake_ver=0
else
cmake_ver=$(cmake --version 2>&1 | head -n1 | cut -d ' ' -f3 | awk '{print $NF}')
cmake_path=$(which cmake)
if [[ "$cmake_path" == "" ]] ; then
cmake_ver=0
fi

#download cmake - v3.10.2 is not out of box in Ubuntu 16.04
if version_less_than_equal_to $cmake_ver $MIN_CMAKE_VERSION; then
if [[ ! -d "cmake_build/bin" ]]; then
echo "Downloading cmake..."
wget https://cmake.org/files/v3.10/cmake-3.10.2.tar.gz \
-O cmake.tar.gz
tar -xzf cmake.tar.gz
rm cmake.tar.gz
rm -rf ./cmake_build
mv ./cmake-3.10.2 ./cmake_build
pushd cmake_build
./bootstrap
make
popd
fi

#download cmake - v3.10.2 is not out of box in Ubuntu 16.04
if version_less_than_equal_to $gcc_ver $MIN_GCC_VERSION; then
if [[ ! -d "cmake_build/bin" ]]; then
echo "Downloading cmake..."
wget https://cmake.org/files/v3.10/cmake-3.10.2.tar.gz \
-O cmake.tar.gz
tar -xzf cmake.tar.gz
rm cmake.tar.gz
rm -rf ./cmake_build
mv ./cmake-3.10.2 ./cmake_build
pushd cmake_build
./bootstrap
make
popd
fi
if [ "$(uname)" == "Darwin" ]; then
CMAKE="$(greadlink -f cmake_build/bin/cmake)"
else
CMAKE="$(readlink -f cmake_build/bin/cmake)"
fi
if [ "$(uname)" == "Darwin" ]; then
CMAKE="$(greadlink -f cmake_build/bin/cmake)"
else
echo "Already have good version of cmake: $cmake_ver"
CMAKE=$(which cmake)
CMAKE="$(readlink -f cmake_build/bin/cmake)"
fi
else
echo "Already have good version of cmake: $cmake_ver"
CMAKE=$(which cmake)
fi

# Download rpclib
Expand Down