Skip to content

Commit

Permalink
Sevabit GUI build for Super Nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
scilicet64 committed May 3, 2019
1 parent ecd9928 commit 7577f47
Show file tree
Hide file tree
Showing 20 changed files with 162 additions and 112 deletions.
46 changes: 46 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
variables:
GIT_STRATEGY: recursive
GIT_DEPTH: "3"

build:mac:
tags:
- osx
stage: build
script:
- echo "QMAKE_LFLAGS += -mmacosx-version-min=10.10 -isysroot /Developer/SDKs/MacOSX10.10.sdk" >> sevabit-wallet-gui.pro
- export MACOSX_DEPLOYMENT_TARGET=10.10
- rm -f sevabit/lib/libwallet_merged.a
- rm -rf build
- ./build.sh release-static
- cp sevabit/bin/sevabitd build/release/bin
artifacts:
paths:
- "build/release/bin"
build:linux:
image: registry.gitlab.com/sevabit/sevabit:latest
tags:
- ubuntu
stage: build
script:
- export USE_SINGLE_BUILDDIR=1
- export ZMQ_INCLUDE_PATH=/usr/local/include/
- export ZMQ_LIBRARY=/usr/local/libzmq/src/.libs/libzmq.a
- rm -f sevabit/lib/libwallet_merged.a
- rm -rf build
- ./build.sh release-static
- cd build && make deploy
artifacts:
paths:
- "build/release/bin"
build:windows:
tags:
- windows
stage: build
script:
- export USE_SINGLE_BUILDDIR=1
- source ./build.sh release-static
- mkdir deploy-artifacts
- ./windeploy_helper.sh build/release/bin Release
artifacts:
paths:
- "build/release/bin"
7 changes: 4 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "SevaBit"]
path = sevaBit
url = https://gitlab.com/Sevabit/SevaBit
[submodule "sevabit"]
path = sevabit
url = https://github.com/sevabit/sevabit
branch = master
14 changes: 7 additions & 7 deletions LeftPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Rectangle {
signal transferClicked()
signal receiveClicked()
signal txkeyClicked()
signal serviceNodeClicked()
signal superNodeClicked()
signal sharedringdbClicked()
signal settingsClicked()
signal addressBookClicked()
Expand All @@ -70,7 +70,7 @@ Rectangle {
else if(pos === "AddressBook") menuColumn.previousButton = addressBookButton
else if(pos === "Mining") menuColumn.previousButton = miningButton
else if(pos === "TxKey") menuColumn.previousButton = txkeyButton
else if(pos === "ServiceNode") menuColumn.previousButton = serviceNodeButton
else if(pos === "SuperNode") menuColumn.previousButton = superNodeButton
else if(pos === "SharedRingDB") menuColumn.previousButton = sharedringdbButton
else if(pos === "Sign") menuColumn.previousButton = signButton
else if(pos === "Settings") menuColumn.previousButton = settingsButton
Expand Down Expand Up @@ -475,19 +475,19 @@ Rectangle {
height: 1
}

// ------------- Service Node tab ----------------
// ------------- Super Node tab ----------------
MenuButton {
id: serviceNodeButton
id: superNodeButton
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Service Node") + translationManager.emptyString
text: qsTr("Super Node") + translationManager.emptyString
symbol: qsTr("K") + translationManager.emptyString
dotColor: "#FFD781"
under: advancedButton
onClicked: {
parent.previousButton.checked = false
parent.previousButton = serviceNodeButton
panel.serviceNodeClicked()
parent.previousButton = superNodeButton
panel.superNodeClicked()
}
}
Rectangle {
Expand Down
6 changes: 3 additions & 3 deletions MiddlePanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Rectangle {
property Receive receiveView: Receive { }
property TxKey txkeyView: TxKey { }
property SharedRingDB sharedringdbView: SharedRingDB { }
property ServiceNode serviceNodeView: ServiceNode { }
property SuperNode superNodeView: SuperNode { }
property History historyView: History { }
property Sign signView: Sign { }
property Settings settingsView: Settings { }
Expand Down Expand Up @@ -130,8 +130,8 @@ Rectangle {
PropertyChanges { target: root; currentView: txkeyView }
PropertyChanges { target: mainFlickable; contentHeight: 1200 * scaleRatio }
}, State {
name: "ServiceNode"
PropertyChanges { target: root; currentView: serviceNodeView }
name: "SuperNode"
PropertyChanges { target: root; currentView: superNodeView }
PropertyChanges { target: mainFlickable; contentHeight: 1200 * scaleRatio }
}, State {
name: "SharedRingDB"
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,12 @@ The SevaBit GUI on Windows is 64 bits only; 32-bit Windows GUI builds are not of

```
cd sevabit-gui
./build.sh release-static
./build.sh
source ./build.sh release-static
cd build
make deploy
```

**Note:** The use of `source` above is a dirty workaround for a suspected bug in the current QT version 5.11.2-3 available in the MSYS2 packaging system, see https://github.com/monero-project/monero-gui/issues/1559 for more info.

The executable can be found in the `.\release\bin` directory.
21 changes: 15 additions & 6 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -e

BUILD_TYPE=$1
source ./utils.sh
platform=$(get_platform)
Expand All @@ -24,6 +26,11 @@ find_command() {
return 1
}

if ! QMAKE=$(find_command qmake qmake-qt5); then
echo "Failed to find suitable qmake command."
exit 1
fi

if [ "$BUILD_TYPE" == "release" ]; then
echo "Building release"
CONFIG="CONFIG+=release";
Expand Down Expand Up @@ -97,27 +104,29 @@ elif [ "$platform" == "mingw64" ] || [ "$platform" == "mingw32" ]; then
fi

# force version update
git fetch --tags --force
get_tag
echo "var GUI_VERSION = \"$TAGNAME\"" > version.js

pushd "$SEVABIT_DIR"
get_tag
popd
echo "var GUI_SEVABIT_VERSION = \"$TAGNAME\"" >> version.js

cd build
if ! QMAKE=$(find_command qmake qmake-qt5); then
echo "Failed to find suitable qmake command."
exit 1
fi
$QMAKE ../sevabit-wallet-gui.pro "$CONFIG" || exit
$MAKE -j2 || exit
$MAKE || exit

# Copy sevabitd to bin folder
if [ "$platform" != "mingw32" ] && [ "$ANDROID" != true ]; then
cp ../$SEVABIT_DIR/bin/$SEVABITD_EXEC $BIN_PATH
fi

make -j2 deploy
make deploy
popd

cp sevabit_default_settings.ini build/$BIN_PATH/sevabit.ini

if [ "$platform" == "darwin" ]; then
otool -l build/$BIN_PATH/sevabit-wallet-gui | grep sdk
fi
10 changes: 5 additions & 5 deletions components/HistoryTable.qml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ ListView {
+ translationManager.emptyString;
}

function getColorFromRewardType(isServiceNodeReward, isMinerReward) {
if (isServiceNodeReward) {
function getColorFromRewardType(isSuperNodeReward, isMinerReward) {
if (isSuperNodeReward) {
return "#cccc00";
} else if (isMinerReward) {
return "#ff9900";
Expand Down Expand Up @@ -165,8 +165,8 @@ ListView {
text: {
let base = isOut ? qsTr("Sent") : qsTr("Received");

if (isServiceNodeReward) {
base += qsTr(" (service node reward)");
if (isSuperNodeReward) {
base += qsTr(" (super node reward)");
} else if (isMinerReward) {
base += qsTr(" (miner reward)");
}
Expand Down Expand Up @@ -196,7 +196,7 @@ ListView {

return _amount + " SEVABIT";
}
color: isOut ? "white" : getColorFromRewardType(isServiceNodeReward, isMinerReward)
color: isOut ? "white" : getColorFromRewardType(isSuperNodeReward, isMinerReward)
}

Rectangle {
Expand Down
67 changes: 21 additions & 46 deletions get_libwallet_api.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash
SEVABIT_URL=https://gitlab.com/Sevabit/SevaBit.git

set -e

SEVABIT_URL=https://github.com/sevabit/sevabit.git

pushd $(pwd)
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
Expand All @@ -10,42 +13,14 @@ INSTALL_DIR=$ROOT_DIR/wallet
SEVABIT_DIR=$ROOT_DIR/sevabit
BUILD_LIBWALLET=false

# init and update sevabit submodule
if [ ! -d $SEVABIT_DIR/src ]; then
git submodule init sevabit
fi
git submodule update --remote
# git -C $SEVABIT_DIR fetch
git -C $SEVABIT_DIR checkout master
git submodule update --init
git -C $SEVABIT_DIR submodule update --init

# get sevabit core tag
pushd $SEVABIT_DIR
git fetch --tags --force
get_tag
# create local sevabit branch
git -C $SEVABIT_DIR checkout -B $VERSIONTAG

git -C $SEVABIT_DIR submodule init
git -C $SEVABIT_DIR submodule update

# Merge sevabit PR dependencies

# Workaround for git username requirements
# Save current user settings and revert back when we are done with merging PR's
OLD_GIT_USER=$(git -C $SEVABIT_DIR config --local user.name)
OLD_GIT_EMAIL=$(git -C $SEVABIT_DIR config --local user.email)
git -C $SEVABIT_DIR config user.name "SevaBit GUI"
git -C $SEVABIT_DIR config user.email "gui@sevabit.local"
# check for PR requirements in most recent commit message (i.e requires #xxxx)
for PR in $(git log --format=%B -n 1 | grep -io "requires #[0-9]*" | sed 's/[^0-9]*//g'); do
echo "Merging sevabit push request #$PR"
# fetch pull request and merge
git -C $SEVABIT_DIR fetch origin pull/$PR/head:PR-$PR
git -C $SEVABIT_DIR merge --quiet PR-$PR -m "Merge sevabit PR #$PR"
BUILD_LIBWALLET=true
done

# revert back to old git config
$(git -C $SEVABIT_DIR config user.name "$OLD_GIT_USER")
$(git -C $SEVABIT_DIR config user.email "$OLD_GIT_EMAIL")
popd

# Build libwallet if it doesnt exist
if [ ! -f $SEVABIT_DIR/lib/libwallet_merged.a ]; then
Expand Down Expand Up @@ -75,7 +50,7 @@ fi

if [ "$BUILD_LIBWALLET" != true ]; then
# exit this script
return
exit
fi

echo "GUI_SEVABIT_VERSION=\"$VERSIONTAG\"" > $SEVABIT_DIR/version.sh
Expand Down Expand Up @@ -138,8 +113,7 @@ env | sort
if [ "$platform" == "darwin" ]; then
echo "Configuring build for MacOS.."
if [ "$STATIC" == true ]; then
# cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON -D CMAKE_INSTALL_PREFIX="$SEVABIT_DIR" ../..
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON -D CMAKE_PREFIX_PATH="$OPENSSL_ROOT_DIR" -D CMAKE_INSTALL_PREFIX="$SEVABIT_DIR" -D ZMQ_LIB=$ZMQ_LIBRARY -D Termcap_LIBRARY=$Termcap_LIBRARY -D Readline_ROOT_DIR=$Readline_ROOT_DIR -D ZMQ_INCLUDE_PATH=$ZMQ_INCLUDE_PATH ../.. -D PCSC_LIBRARY=$PCSC_LIBRARY -D PCSC_INCLUDE_DIR=$PCSC_INCLUDE_DIR
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON -D CMAKE_INSTALL_PREFIX="$SEVABIT_DIR" ../..
else
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON -D CMAKE_INSTALL_PREFIX="$SEVABIT_DIR" ../..
fi
Expand All @@ -151,7 +125,7 @@ elif [ "$platform" == "linux64" ]; then
echo "Configuring build for Android on Linux host"
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D ARCH="armv7-a" -D ANDROID=true -D BUILD_GUI_DEPS=ON -D USE_LTO=OFF -D INSTALL_VENDORED_LIBUNBOUND=ON -D CMAKE_INSTALL_PREFIX="$SEVABIT_DIR" ../..
elif [ "$STATIC" == true ]; then
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON -D CMAKE_INSTALL_PREFIX="$SEVABIT_DIR" -D CMAKE_PREFIX_PATH=$OPENSSL_ROOT_DIR -D PCSC_LIBRARY=$PCSC_LIBRARY -D PCSC_INCLUDE_DIR=$PCSC_INCLUDE_DIR -D Termcap_LIBRARY=$Termcap_LIBRARY -D Readline_ROOT_DIR=$Readline_ROOT_DIR -D ZMQ_LIB=$ZMQ_LIBRARY -D ZMQ_INCLUDE_PATH=$ZMQ_INCLUDE_PATH ../..
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D BUILD_GUI_DEPS=ON -D INSTALL_VENDORED_LIBUNBOUND=ON -D CMAKE_INSTALL_PREFIX="$SEVABIT_DIR" ../..
else
cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D BUILD_GUI_DEPS=ON -D CMAKE_INSTALL_PREFIX="$SEVABIT_DIR" ../..
fi
Expand Down Expand Up @@ -239,12 +213,13 @@ eval make -C $SEVABIT_DIR/build/$BUILD_TYPE/external/easylogging++ all install
eval make -C $SEVABIT_DIR/build/$BUILD_TYPE/external/db_drivers/liblmdb all install

# Install libunbound
echo "Installing libunbound..."
pushd $SEVABIT_DIR/build/$BUILD_TYPE/external/unbound
# no need to make, it was already built as dependency for libwallet
# make -j$CPU_CORE_COUNT
$make_exec install -j$CPU_CORE_COUNT
popd

if [ -d $SEVABIT_DIR/build/$BUILD_TYPE/external/unbound ]; then
echo "Installing libunbound..."
pushd $SEVABIT_DIR/build/$BUILD_TYPE/external/unbound
# no need to make, it was already built as dependency for libwallet
# make -j$CPU_CORE_COUNT
$make_exec install -j$CPU_CORE_COUNT
popd
fi

popd
popd
19 changes: 13 additions & 6 deletions main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ ApplicationWindow {
else if(middlePanel.state === "Receive") middlePanel.state = "History"
else if(middlePanel.state === "History") middlePanel.state = "Mining"
else if(middlePanel.state === "Mining") middlePanel.state = "TxKey"
else if(middlePanel.state === "TxKey") middlePanel.state = "ServiceNode"
else if(middlePanel.state === "ServiceNode") middlePanel.state = "SharedRingDB"
else if(middlePanel.state === "TxKey") middlePanel.state = "SuperNode"
else if(middlePanel.state === "SuperNode") middlePanel.state = "SharedRingDB"
else if(middlePanel.state === "SharedRingDB") middlePanel.state = "Sign"
else if(middlePanel.state === "Sign") middlePanel.state = "Settings"
} else if(seq === "Ctrl+Shift+Backtab" || seq === "Alt+Shift+Backtab") {
Expand All @@ -160,8 +160,8 @@ ApplicationWindow {
*/
if(middlePanel.state === "Settings") middlePanel.state = "Sign"
else if(middlePanel.state === "Sign") middlePanel.state = "SharedRingDB"
else if(middlePanel.state === "SharedRingDB") middlePanel.state = "ServiceNode"
else if(middlePanel.state === "ServiceNode") middlePanel.state = "TxKey"
else if(middlePanel.state === "SharedRingDB") middlePanel.state = "SuperNode"
else if(middlePanel.state === "SuperNode") middlePanel.state = "TxKey"
else if(middlePanel.state === "TxKey") middlePanel.state = "Mining"
else if(middlePanel.state === "Mining") middlePanel.state = "History"
else if(middlePanel.state === "History") middlePanel.state = "Receive"
Expand Down Expand Up @@ -331,6 +331,7 @@ ApplicationWindow {
currentWallet.unconfirmedMoneyReceived.connect(onWalletUnconfirmedMoneyReceived)
currentWallet.transactionCreated.connect(onTransactionCreated)
currentWallet.stakeTxCreated.connect(onStakeTxCreated)
currentWallet.stakeError.connect(onStakeError)
currentWallet.connectionStatusChanged.connect(onWalletConnectionStatusChanged)
middlePanel.paymentClicked.connect(handlePayment);
middlePanel.sweepUnmixableClicked.connect(handleSweepUnmixable);
Expand Down Expand Up @@ -689,7 +690,13 @@ ApplicationWindow {

}

function onStakeError(error) {
informationPopup.title = qsTr("Error") + translationManager.emptyString;
informationPopup.text = error;
informationPopup.open();
}


// called on "transfer"
function handlePayment(address, paymentId, amount, mixinCount, priority, description, createFile) {
console.log("Creating transaction: ")
Expand Down Expand Up @@ -1409,8 +1416,8 @@ ApplicationWindow {
updateBalance();
}

onServiceNodeClicked: {
middlePanel.state = "ServiceNode";
onSuperNodeClicked: {
middlePanel.state = "SuperNode";
middlePanel.flickable.contentY = 0;
if(isMobile) {
hideMenu();
Expand Down
Loading

0 comments on commit 7577f47

Please sign in to comment.