2016-05-17 13:03:59 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
2016-10-09 18:49:56 +00:00
|
|
|
MONERO_URL=https://github.com/monero-project/monero.git
|
|
|
|
MONERO_BRANCH=master
|
|
|
|
# MONERO_URL=https://github.com/mbg033/monero.git
|
|
|
|
# MONERO_BRANCH=develop
|
2016-10-06 21:46:42 +00:00
|
|
|
# Buidling "debug" build optionally
|
|
|
|
BUILD_TYPE=$1
|
|
|
|
if [ -z $BUILD_TYPE ]; then
|
|
|
|
BUILD_TYPE=Release
|
|
|
|
fi
|
2016-07-06 13:24:14 +00:00
|
|
|
# thanks to SO: http://stackoverflow.com/a/20283965/4118915
|
2016-11-05 09:54:02 +00:00
|
|
|
if test -z "$CPU_CORE_COUNT"; then
|
|
|
|
CPU_CORE_COUNT=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu)
|
|
|
|
fi
|
2016-05-17 13:03:59 +00:00
|
|
|
pushd $(pwd)
|
|
|
|
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
|
2016-09-22 18:39:43 +00:00
|
|
|
source $ROOT_DIR/utils.sh
|
|
|
|
|
2016-05-17 13:03:59 +00:00
|
|
|
|
|
|
|
INSTALL_DIR=$ROOT_DIR/wallet
|
2016-09-19 13:45:34 +00:00
|
|
|
MONERO_DIR=$ROOT_DIR/monero
|
2016-05-17 13:03:59 +00:00
|
|
|
|
|
|
|
|
2016-09-19 13:45:34 +00:00
|
|
|
if [ ! -d $MONERO_DIR ]; then
|
|
|
|
git clone --depth=1 $MONERO_URL $MONERO_DIR --branch $MONERO_BRANCH --single-branch
|
2016-06-10 13:41:13 +00:00
|
|
|
else
|
2016-09-19 13:45:34 +00:00
|
|
|
cd $MONERO_DIR;
|
|
|
|
git checkout $MONERO_BRANCH
|
2016-06-10 13:41:13 +00:00
|
|
|
git pull;
|
2016-05-17 13:03:59 +00:00
|
|
|
fi
|
|
|
|
|
2016-09-19 13:45:34 +00:00
|
|
|
echo "cleaning up existing monero build dir, libs and includes"
|
|
|
|
rm -fr $MONERO_DIR/build
|
|
|
|
rm -fr $MONERO_DIR/lib
|
|
|
|
rm -fr $MONERO_DIR/include
|
2016-08-24 18:31:43 +00:00
|
|
|
|
2016-09-19 13:45:34 +00:00
|
|
|
mkdir -p $MONERO_DIR/build/release
|
|
|
|
pushd $MONERO_DIR/build/release
|
2016-05-17 13:03:59 +00:00
|
|
|
|
2016-09-22 18:39:43 +00:00
|
|
|
# reusing function from "utils.sh"
|
|
|
|
platform=$(get_platform)
|
|
|
|
|
|
|
|
if [ "$platform" == "darwin" ]; then
|
2016-07-01 12:02:19 +00:00
|
|
|
# Do something under Mac OS X platform
|
2016-09-22 18:39:43 +00:00
|
|
|
echo "Configuring build for MacOS.."
|
2016-10-06 21:46:42 +00:00
|
|
|
cmake -D CMAKE_BUILD_TYPE=$BUILD_TYPE -D STATIC=ON -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
2016-09-22 18:39:43 +00:00
|
|
|
elif [ "$platform" == "linux" ]; then
|
2016-07-01 12:02:19 +00:00
|
|
|
# Do something under GNU/Linux platform
|
2016-09-22 18:39:43 +00:00
|
|
|
echo "Configuring build for Linux.."
|
2016-10-06 21:46:42 +00:00
|
|
|
cmake -D CMAKE_BUILD_TYPE=$BUILD_TYPE -D STATIC=ON -D BUILD_GUI_DEPS=ON -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
|
2016-09-22 18:39:43 +00:00
|
|
|
elif [ "$platform" == "mingw64" ]; then
|
2016-07-01 12:02:19 +00:00
|
|
|
# Do something under Windows NT platform
|
2016-09-22 18:39:43 +00:00
|
|
|
echo "Configuring build for MINGW64.."
|
2016-10-06 21:46:42 +00:00
|
|
|
cmake -D CMAKE_BUILD_TYPE=$BUILD_TYPE -D STATIC=ON -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" -G "MSYS Makefiles" ../..
|
2016-09-22 18:39:43 +00:00
|
|
|
elif [ "$platform" == "mingw32" ]; then
|
2016-07-01 12:02:19 +00:00
|
|
|
# Do something under Windows NT platform
|
2016-09-22 18:39:43 +00:00
|
|
|
echo "Configuring build for MINGW32.."
|
2016-10-06 21:46:42 +00:00
|
|
|
cmake -D CMAKE_BUILD_TYPE=$BUILD_TYPE -D STATIC=ON -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" -G "MSYS Makefiles" ../..
|
2016-09-22 18:39:43 +00:00
|
|
|
else
|
|
|
|
echo "Unsupported platform: $platform"
|
|
|
|
popd
|
|
|
|
exit 1
|
2016-07-01 12:02:19 +00:00
|
|
|
fi
|
|
|
|
|
2016-05-17 13:03:59 +00:00
|
|
|
|
2016-09-19 13:45:34 +00:00
|
|
|
pushd $MONERO_DIR/build/release/src/wallet
|
2016-05-17 13:03:59 +00:00
|
|
|
make -j$CPU_CORE_COUNT
|
|
|
|
make install -j$CPU_CORE_COUNT
|
|
|
|
popd
|
2016-09-03 10:06:44 +00:00
|
|
|
|
|
|
|
# unbound is one more dependency. can't be merged to the wallet_merged
|
|
|
|
# since filename conflict (random.c.obj)
|
2016-09-19 14:55:34 +00:00
|
|
|
# for Linux, we use libunbound shipped with the system, so we don't need to build it
|
2016-09-19 14:47:44 +00:00
|
|
|
|
2016-09-22 18:39:43 +00:00
|
|
|
if [ "$platform" != "linux" ]; then
|
2016-09-19 13:56:47 +00:00
|
|
|
echo "Building libunbound..."
|
2016-09-19 13:45:34 +00:00
|
|
|
pushd $MONERO_DIR/build/release/external/unbound
|
2016-09-22 18:39:43 +00:00
|
|
|
# no need to make, it was already built as dependency for libwallet
|
|
|
|
# make -j$CPU_CORE_COUNT
|
2016-09-19 13:45:34 +00:00
|
|
|
make install -j$CPU_CORE_COUNT
|
|
|
|
popd
|
|
|
|
fi
|
2016-09-03 10:06:44 +00:00
|
|
|
|
2016-05-17 13:03:59 +00:00
|
|
|
popd
|
|
|
|
|