Merge pull request #2239 from nspcc-dev/win

*: allow to build NeoGo binaries on Windows
This commit is contained in:
Roman Khimov 2021-11-08 10:21:57 +03:00 committed by GitHub
commit 5e08ef79fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 5 deletions

View file

@ -1,7 +1,12 @@
BRANCH = "master" BRANCH = "master"
REPONAME = "neo-go" REPONAME = "neo-go"
NETMODE ?= "privnet" NETMODE ?= "privnet"
BINARY = "./bin/neo-go" GOOS ?= $(shell go env GOOS)
EXTENSION=
ifeq ($(GOOS),windows)
EXTENSION=".exe"
endif
BINARY=./bin/neo-go$(EXTENSION)
DESTDIR = "" DESTDIR = ""
SYSCONFIGDIR = "/etc" SYSCONFIGDIR = "/etc"
BINDIR = "/usr/bin" BINDIR = "/usr/bin"

View file

@ -56,6 +56,19 @@ make build
The resulting binary is `bin/neo-go`. The resulting binary is `bin/neo-go`.
#### Building on Windows
To build NeoGo on Windows platform we recommend you to install `make` from [MinGW
package](https://osdn.net/projects/mingw/). Then you can build NeoGo with:
```
make build
```
The resulting binary is `bin/neo-go.exe`.
We also recommend you to switch the Windows Firewall off for further NeoGo node run.
## Running a node ## Running a node
A node needs to connect to some network, either local one (usually referred to A node needs to connect to some network, either local one (usually referred to

View file

@ -25,11 +25,11 @@ type ReadWriter struct {
func ReadLine(prompt string) (string, error) { func ReadLine(prompt string) (string, error) {
trm := Terminal trm := Terminal
if trm == nil { if trm == nil {
s, err := term.MakeRaw(syscall.Stdin) s, err := term.MakeRaw(int(syscall.Stdin))
if err != nil { if err != nil {
return "", err return "", err
} }
defer func() { _ = term.Restore(syscall.Stdin, s) }() defer func() { _ = term.Restore(int(syscall.Stdin), s) }()
trm = term.NewTerminal(ReadWriter{ trm = term.NewTerminal(ReadWriter{
Reader: os.Stdin, Reader: os.Stdin,
Writer: os.Stdout, Writer: os.Stdout,
@ -50,11 +50,11 @@ func readLine(trm *term.Terminal, prompt string) (string, error) {
func ReadPassword(prompt string) (string, error) { func ReadPassword(prompt string) (string, error) {
trm := Terminal trm := Terminal
if trm == nil { if trm == nil {
s, err := term.MakeRaw(syscall.Stdin) s, err := term.MakeRaw(int(syscall.Stdin))
if err != nil { if err != nil {
return "", err return "", err
} }
defer func() { _ = term.Restore(syscall.Stdin, s) }() defer func() { _ = term.Restore(int(syscall.Stdin), s) }()
trm = term.NewTerminal(ReadWriter{os.Stdin, os.Stdout}, prompt) trm = term.NewTerminal(ReadWriter{os.Stdin, os.Stdout}, prompt)
} }
return trm.ReadPassword(prompt) return trm.ReadPassword(prompt)