Merge pull request #30

3abee20 build: get_platform function reused (Ilya Kitaev)
af30cfd build: added "libunwind_off" config option so it can be built on other distros than Ubuntu (Ilya Kitaev)
This commit is contained in:
Riccardo Spagni 2016-10-04 12:25:57 +02:00
commit d865103a73
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
4 changed files with 70 additions and 11 deletions

View file

@ -1,5 +1,6 @@
#!/bin/bash #!/bin/bash
source ./utils.sh
pushd $(pwd) pushd $(pwd)
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
MONERO_DIR=monero MONERO_DIR=monero
@ -9,9 +10,19 @@ if [ ! -d $MONERO_DIR ]; then
fi fi
if [ ! -d build ]; then mkdir build; fi if [ ! -d build ]; then mkdir build; fi
cd build
qmake ../monero-core.pro "CONFIG+=release" CONFIG="CONFIG+=release"
platform=$(get_platform)
if [ "$platform" == "linux" ]; then
distro=$(lsb_release -is)
if [ "$distro" == "Ubuntu" ]; then
CONFIG="$CONFIG libunwind_off"
fi
fi
cd build
qmake ../monero-core.pro "$CONFIG"
make make
make deploy make deploy
popd popd

View file

@ -8,6 +8,8 @@ CPU_CORE_COUNT=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.nc
pushd $(pwd) pushd $(pwd)
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $ROOT_DIR/utils.sh
INSTALL_DIR=$ROOT_DIR/wallet INSTALL_DIR=$ROOT_DIR/wallet
MONERO_DIR=$ROOT_DIR/monero MONERO_DIR=$ROOT_DIR/monero
@ -29,19 +31,29 @@ rm -fr $MONERO_DIR/include
mkdir -p $MONERO_DIR/build/release mkdir -p $MONERO_DIR/build/release
pushd $MONERO_DIR/build/release pushd $MONERO_DIR/build/release
if [ "$(uname)" == "Darwin" ]; then # reusing function from "utils.sh"
platform=$(get_platform)
if [ "$platform" == "darwin" ]; then
# Do something under Mac OS X platform # Do something under Mac OS X platform
echo "Configuring build for MacOS.."
cmake -D CMAKE_BUILD_TYPE=Release -D STATIC=ON -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../.. cmake -D CMAKE_BUILD_TYPE=Release -D STATIC=ON -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then elif [ "$platform" == "linux" ]; then
# Do something under GNU/Linux platform # Do something under GNU/Linux platform
PLATFORM="Linux" echo "Configuring build for Linux.."
cmake -D CMAKE_BUILD_TYPE=Release -D STATIC=ON -D BUILD_GUI_DEPS=ON -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../.. cmake -D CMAKE_BUILD_TYPE=Release -D STATIC=ON -D BUILD_GUI_DEPS=ON -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../..
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]; then elif [ "$platform" == "mingw64" ]; then
# Do something under Windows NT platform # Do something under Windows NT platform
echo "Configuring build for MINGW64.."
cmake -D CMAKE_BUILD_TYPE=Release -D STATIC=ON -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" -G "MSYS Makefiles" ../.. cmake -D CMAKE_BUILD_TYPE=Release -D STATIC=ON -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" -G "MSYS Makefiles" ../..
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then elif [ "$platform" == "mingw32" ]; then
# Do something under Windows NT platform # Do something under Windows NT platform
echo "Configuring build for MINGW32.."
cmake -D CMAKE_BUILD_TYPE=Release -D STATIC=ON -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" -G "MSYS Makefiles" ../.. cmake -D CMAKE_BUILD_TYPE=Release -D STATIC=ON -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" -G "MSYS Makefiles" ../..
else
echo "Unsupported platform: $platform"
popd
exit 1
fi fi
@ -54,10 +66,11 @@ popd
# since filename conflict (random.c.obj) # since filename conflict (random.c.obj)
# for Linux, we use libunbound shipped with the system, so we don't need to build it # for Linux, we use libunbound shipped with the system, so we don't need to build it
if [ "$PLATFORM" != "Linux" ]; then if [ "$platform" != "linux" ]; then
echo "Building libunbound..." echo "Building libunbound..."
pushd $MONERO_DIR/build/release/external/unbound pushd $MONERO_DIR/build/release/external/unbound
make -j$CPU_CORE_COUNT # no need to make, it was already built as dependency for libwallet
# make -j$CPU_CORE_COUNT
make install -j$CPU_CORE_COUNT make install -j$CPU_CORE_COUNT
popd popd
fi fi

View file

@ -86,9 +86,15 @@ linux {
-lssl \ -lssl \
-lcrypto \ -lcrypto \
-Wl,-Bdynamic \ -Wl,-Bdynamic \
# currently monero has an issue with "static" build and linunwind-dev
# -lunwind \
-ldl -ldl
# currently monero has an issue with "static" build and linunwind-dev,
# so we link libunwind-dev only for non-Ubuntu distros
CONFIG(libunwind_off) {
message(Building without libunwind)
} else {
message(Building with libunwind)
LIBS += -Wl,-Bdynamic -lunwind
}
} }
macx { macx {

29
utils.sh Executable file
View file

@ -0,0 +1,29 @@
#!/bin/bash
function get_platform {
local platform="unknown"
if [ "$(uname)" == "Darwin" ]; then
platform="darwin"
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
platform="linux"
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]; then
platform="mingw64"
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then
platform="mingw32"
fi
echo "$platform"
}