mirror of
https://github.com/kvazar-network/keva-stratum.git
synced 2025-01-26 23:04:42 +00:00
Add new build system
This commit is contained in:
parent
0c71aab407
commit
36364a5e1e
4
.gitignore
vendored
4
.gitignore
vendored
@ -17,4 +17,6 @@ Makefile
|
||||
config.json
|
||||
testnet.json
|
||||
mainnet.json
|
||||
pool
|
||||
|
||||
/build/_workspace/
|
||||
/build/bin/
|
||||
|
@ -1,5 +1,5 @@
|
||||
cmake_minimum_required (VERSION 2.8.11)
|
||||
project (pool)
|
||||
project(pool)
|
||||
|
||||
if (DEFINED ENV{MONERO_DIR})
|
||||
get_filename_component(MONERO_DIR $ENV{MONERO_DIR} ABSOLUTE)
|
||||
@ -11,3 +11,10 @@ endif()
|
||||
|
||||
add_subdirectory(hashing)
|
||||
add_subdirectory(cnutil)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT build/bin
|
||||
COMMAND build/env.sh go get -v ./...
|
||||
)
|
||||
|
||||
add_custom_target(build ALL DEPENDS hashing cnutil ${CMAKE_CURRENT_BINARY_DIR}/build/bin)
|
||||
|
14
README.md
14
README.md
@ -38,10 +38,6 @@ Compile Monero source (with shared libraries option):
|
||||
Install Golang and required packages:
|
||||
|
||||
sudo apt-get install golang
|
||||
export GOPATH=~/go
|
||||
go get github.com/goji/httpauth
|
||||
go get github.com/yvasiyarov/gorelic
|
||||
go get github.com/gorilla/mux
|
||||
|
||||
Clone stratum:
|
||||
|
||||
@ -52,7 +48,6 @@ Build stratum:
|
||||
|
||||
MONERO_DIR=/path/to/monero cmake .
|
||||
make
|
||||
go build -o pool main.go
|
||||
|
||||
`MONERO_DIR=/path/to/monero` is optional, not needed if both `monero` and `monero-stratum` is in the same directory like `/opt/src/`. By default make will search for monero libraries in `../monero`. You can just run `cmake .`.
|
||||
|
||||
@ -69,10 +64,6 @@ Compile Monero source:
|
||||
Install Golang and required packages:
|
||||
|
||||
brew update && brew install go
|
||||
export GOPATH=~/go
|
||||
go get github.com/goji/httpauth
|
||||
go get github.com/yvasiyarov/gorelic
|
||||
go get github.com/gorilla/mux
|
||||
|
||||
Clone stratum:
|
||||
|
||||
@ -83,16 +74,15 @@ Build stratum:
|
||||
|
||||
MONERO_DIR=/path/to/monero cmake .
|
||||
make
|
||||
go build -o pool main.go
|
||||
|
||||
### Running Stratum
|
||||
|
||||
./pool config.json
|
||||
./build/bin/monero-stratum config.json
|
||||
|
||||
If you need to bind to privileged ports and don't want to run from `root`:
|
||||
|
||||
sudo apt-get install libcap2-bin
|
||||
sudo setcap 'cap_net_bind_service=+ep' pool
|
||||
sudo setcap 'cap_net_bind_service=+ep' /path/to/monero-stratum
|
||||
|
||||
## Configuration
|
||||
|
||||
|
32
build/env.sh
Executable file
32
build/env.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ ! -f "build/env.sh" ]; then
|
||||
echo "$0 must be run from the root of the repository."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Create fake Go workspace if it doesn't exist yet.
|
||||
workspace="$PWD/build/_workspace"
|
||||
root="$PWD"
|
||||
ethdir="$workspace/src/github.com/sammy007"
|
||||
if [ ! -L "$ethdir/monero-stratum" ]; then
|
||||
mkdir -p "$ethdir"
|
||||
cd "$ethdir"
|
||||
ln -s ../../../../../. monero-stratum
|
||||
cd "$root"
|
||||
fi
|
||||
|
||||
# Set up the environment to use the workspace.
|
||||
# Also add Godeps workspace so we build using canned dependencies.
|
||||
GOPATH="$workspace"
|
||||
GOBIN="$PWD/build/bin"
|
||||
export GOPATH GOBIN
|
||||
|
||||
# Run the command inside the workspace.
|
||||
cd "$ethdir/monero-stratum"
|
||||
PWD="$ethdir/monero-stratum"
|
||||
|
||||
# Launch the arguments with the configured environment.
|
||||
exec "$@"
|
4
main.go
4
main.go
@ -10,8 +10,8 @@ import (
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"./go-pool/pool"
|
||||
"./go-pool/stratum"
|
||||
"github.com/sammy007/monero-stratum/pool"
|
||||
"github.com/sammy007/monero-stratum/stratum"
|
||||
|
||||
"github.com/goji/httpauth"
|
||||
"github.com/gorilla/mux"
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"../pool"
|
||||
"github.com/sammy007/monero-stratum/pool"
|
||||
)
|
||||
|
||||
type RPCClient struct {
|
@ -6,8 +6,8 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"../rpc"
|
||||
"../util"
|
||||
"github.com/sammy007/monero-stratum/rpc"
|
||||
"github.com/sammy007/monero-stratum/util"
|
||||
)
|
||||
|
||||
func (s *StratumServer) StatsIndex(w http.ResponseWriter, r *http.Request) {
|
@ -6,7 +6,7 @@ import (
|
||||
"encoding/hex"
|
||||
"log"
|
||||
|
||||
"../../cnutil"
|
||||
"github.com/sammy007/monero-stratum/cnutil"
|
||||
)
|
||||
|
||||
type BlockTemplate struct {
|
@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
|
||||
"../util"
|
||||
"github.com/sammy007/monero-stratum/util"
|
||||
)
|
||||
|
||||
var noncePattern *regexp.Regexp
|
@ -10,9 +10,9 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"../../cnutil"
|
||||
"../../hashing"
|
||||
"../util"
|
||||
"github.com/sammy007/monero-stratum/cnutil"
|
||||
"github.com/sammy007/monero-stratum/hashing"
|
||||
"github.com/sammy007/monero-stratum/util"
|
||||
)
|
||||
|
||||
type Job struct {
|
@ -12,9 +12,9 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"../pool"
|
||||
"../rpc"
|
||||
"../util"
|
||||
"github.com/sammy007/monero-stratum/pool"
|
||||
"github.com/sammy007/monero-stratum/rpc"
|
||||
"github.com/sammy007/monero-stratum/util"
|
||||
)
|
||||
|
||||
type StratumServer struct {
|
@ -6,7 +6,7 @@ import (
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"../../cnutil"
|
||||
"github.com/sammy007/monero-stratum/cnutil"
|
||||
)
|
||||
|
||||
var Diff1 = StringToBig("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")
|
Loading…
x
Reference in New Issue
Block a user