Merge pull request #2002 from karalabe/ios-cross-builds

Makefile: add support for iOS cross compilation
pull/1912/merge
Jeffrey Wilcke 9 years ago
commit ffe58bf5ab
  1. 2
      Godeps/Godeps.json
  2. 2
      Godeps/_workspace/src/github.com/nsf/termbox-go/README.md
  3. 24
      Godeps/_workspace/src/github.com/nsf/termbox-go/api.go
  4. 4
      Godeps/_workspace/src/github.com/nsf/termbox-go/api_windows.go
  5. 2
      Godeps/_workspace/src/github.com/nsf/termbox-go/syscalls_darwin.go
  6. 14
      Godeps/_workspace/src/github.com/nsf/termbox-go/termbox.go
  7. 4
      Godeps/_workspace/src/github.com/nsf/termbox-go/termbox_windows.go
  8. 36
      Makefile

2
Godeps/Godeps.json generated vendored

@ -55,7 +55,7 @@
}, },
{ {
"ImportPath": "github.com/nsf/termbox-go", "ImportPath": "github.com/nsf/termbox-go",
"Rev": "675ffd907b7401b8a709a5ef2249978af5616bb2" "Rev": "ca2931516914070bb7f934c83e408689cea8dfb7"
}, },
{ {
"ImportPath": "github.com/pborman/uuid", "ImportPath": "github.com/pborman/uuid",

@ -16,6 +16,8 @@ There are also some interesting projects using termbox-go:
- [httopd](https://github.com/verdverm/httopd) is top for httpd logs. - [httopd](https://github.com/verdverm/httopd) is top for httpd logs.
- [mop](https://github.com/michaeldv/mop) is stock market tracker for hackers. - [mop](https://github.com/michaeldv/mop) is stock market tracker for hackers.
- [termui](https://github.com/gizak/termui) is a terminal dashboard. - [termui](https://github.com/gizak/termui) is a terminal dashboard.
- [termloop](https://github.com/JoelOtter/termloop) is a terminal game engine.
- [xterm-color-chart](https://github.com/kutuluk/xterm-color-chart) is a XTerm 256 color chart.
### API reference ### API reference
[godoc.org/github.com/nsf/termbox-go](http://godoc.org/github.com/nsf/termbox-go) [godoc.org/github.com/nsf/termbox-go](http://godoc.org/github.com/nsf/termbox-go)

@ -351,7 +351,7 @@ func PollEvent() Event {
// terminal's window size in characters). But it doesn't always match the size // terminal's window size in characters). But it doesn't always match the size
// of the terminal window, after the terminal size has changed, the internal // of the terminal window, after the terminal size has changed, the internal
// back buffer will get in sync only after Clear or Flush function calls. // back buffer will get in sync only after Clear or Flush function calls.
func Size() (int, int) { func Size() (width int, height int) {
return termw, termh return termw, termh
} }
@ -380,6 +380,12 @@ func SetInputMode(mode InputMode) InputMode {
if mode == InputCurrent { if mode == InputCurrent {
return input_mode return input_mode
} }
if mode&(InputEsc|InputAlt) == 0 {
mode |= InputEsc
}
if mode&(InputEsc|InputAlt) == InputEsc|InputAlt {
mode &^= InputAlt
}
if mode&InputMouse != 0 { if mode&InputMouse != 0 {
out.WriteString(funcs[t_enter_mouse]) out.WriteString(funcs[t_enter_mouse])
} else { } else {
@ -391,6 +397,7 @@ func SetInputMode(mode InputMode) InputMode {
} }
// Sets the termbox output mode. Termbox has four output options: // Sets the termbox output mode. Termbox has four output options:
//
// 1. OutputNormal => [1..8] // 1. OutputNormal => [1..8]
// This mode provides 8 different colors: // This mode provides 8 different colors:
// black, red, green, yellow, blue, magenta, cyan, white // black, red, green, yellow, blue, magenta, cyan, white
@ -402,10 +409,10 @@ func SetInputMode(mode InputMode) InputMode {
// //
// 2. Output256 => [1..256] // 2. Output256 => [1..256]
// In this mode you can leverage the 256 terminal mode: // In this mode you can leverage the 256 terminal mode:
// 0x00 - 0x07: the 8 colors as in OutputNormal // 0x01 - 0x08: the 8 colors as in OutputNormal
// 0x08 - 0x0f: Color* | AttrBold // 0x09 - 0x10: Color* | AttrBold
// 0x10 - 0xe7: 216 different colors // 0x11 - 0xe8: 216 different colors
// 0xe8 - 0xff: 24 different shades of grey // 0xe9 - 0x1ff: 24 different shades of grey
// //
// Example usage: // Example usage:
// SetCell(x, y, '@', 184, 240); // SetCell(x, y, '@', 184, 240);
@ -415,11 +422,12 @@ func SetInputMode(mode InputMode) InputMode {
// This mode supports the 3rd range of the 256 mode only. // This mode supports the 3rd range of the 256 mode only.
// But you dont need to provide an offset. // But you dont need to provide an offset.
// //
// 4. OutputGrayscale => [1..24] // 4. OutputGrayscale => [1..26]
// This mode supports the 4th range of the 256 mode only. // This mode supports the 4th range of the 256 mode
// and black and white colors from 3th range of the 256 mode
// But you dont need to provide an offset. // But you dont need to provide an offset.
// //
// In all modes, 0 represents the default color. // In all modes, 0x00 represents the default color.
// //
// `go run _demos/output.go` to see its impact on your terminal. // `go run _demos/output.go` to see its impact on your terminal.
// //

@ -80,6 +80,10 @@ func Close() {
// stop event producer // stop event producer
cancel_comm <- true cancel_comm <- true
set_event(interrupt) set_event(interrupt)
select {
case <-input_comm:
default:
}
<-cancel_done_comm <-cancel_done_comm
set_console_cursor_info(out, &orig_cursor_info) set_console_cursor_info(out, &orig_cursor_info)

@ -1,6 +1,8 @@
// Created by cgo -godefs - DO NOT EDIT // Created by cgo -godefs - DO NOT EDIT
// cgo -godefs syscalls.go // cgo -godefs syscalls.go
// +build !amd64
package termbox package termbox
type syscall_Termios struct { type syscall_Termios struct {

@ -72,6 +72,12 @@ var (
input_comm = make(chan input_event) input_comm = make(chan input_event)
interrupt_comm = make(chan struct{}) interrupt_comm = make(chan struct{})
intbuf = make([]byte, 0, 16) intbuf = make([]byte, 0, 16)
// grayscale indexes
grayscale = []Attribute{
0, 17, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244,
245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 232,
}
) )
func write_cursor(x, y int) { func write_cursor(x, y int) {
@ -171,17 +177,17 @@ func send_attr(fg, bg Attribute) {
case OutputGrayscale: case OutputGrayscale:
fgcol = fg & 0x1F fgcol = fg & 0x1F
bgcol = bg & 0x1F bgcol = bg & 0x1F
if fgcol > 24 { if fgcol > 26 {
fgcol = ColorDefault fgcol = ColorDefault
} }
if bgcol > 24 { if bgcol > 26 {
bgcol = ColorDefault bgcol = ColorDefault
} }
if fgcol != ColorDefault { if fgcol != ColorDefault {
fgcol += 0xe8 fgcol = grayscale[fgcol]
} }
if bgcol != ColorDefault { if bgcol != ColorDefault {
bgcol += 0xe8 bgcol = grayscale[bgcol]
} }
default: default:
fgcol = fg & 0x0F fgcol = fg & 0x0F

@ -129,7 +129,7 @@ func create_console_screen_buffer() (h syscall.Handle, err error) {
err = syscall.EINVAL err = syscall.EINVAL
} }
} }
return syscall.Handle(r0), nil return syscall.Handle(r0), err
} }
func get_console_screen_buffer_info(h syscall.Handle, info *console_screen_buffer_info) (err error) { func get_console_screen_buffer_info(h syscall.Handle, info *console_screen_buffer_info) (err error) {
@ -305,7 +305,7 @@ func create_event() (out syscall.Handle, err error) {
err = syscall.EINVAL err = syscall.EINVAL
} }
} }
return syscall.Handle(r0), nil return syscall.Handle(r0), err
} }
func wait_for_multiple_objects(objects []syscall.Handle) (err error) { func wait_for_multiple_objects(objects []syscall.Handle) (err error) {

@ -7,10 +7,12 @@
.PHONY: geth-darwin geth-darwin-386 geth-darwin-amd64 .PHONY: geth-darwin geth-darwin-386 geth-darwin-amd64
.PHONY: geth-windows geth-windows-386 geth-windows-amd64 .PHONY: geth-windows geth-windows-386 geth-windows-amd64
.PHONY: geth-android geth-android-16 geth-android-21 .PHONY: geth-android geth-android-16 geth-android-21
.PHONY: geth-ios geth-ios-5.0 geth-ios-8.1
GOBIN = build/bin GOBIN = build/bin
CROSSDEPS = https://gmplib.org/download/gmp/gmp-6.0.0a.tar.bz2 CROSSDEPS = https://gmplib.org/download/gmp/gmp-6.1.0.tar.bz2
MODE ?= default
GO ?= latest GO ?= latest
geth: geth:
@ -27,17 +29,17 @@ geth-linux: xgo geth-linux-arm geth-linux-386 geth-linux-amd64
@ls -l $(GOBIN)/geth-linux-* @ls -l $(GOBIN)/geth-linux-*
geth-linux-arm: xgo geth-linux-arm: xgo
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=linux/arm -v $(shell build/flags.sh) ./cmd/geth build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=linux/arm -v $(shell build/flags.sh) ./cmd/geth
@echo "Linux ARM cross compilation done:" @echo "Linux ARM cross compilation done:"
@ls -l $(GOBIN)/geth-linux-* | grep arm @ls -l $(GOBIN)/geth-linux-* | grep arm
geth-linux-386: xgo geth-linux-386: xgo
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=linux/386 -v $(shell build/flags.sh) ./cmd/geth build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=linux/386 -v $(shell build/flags.sh) ./cmd/geth
@echo "Linux 386 cross compilation done:" @echo "Linux 386 cross compilation done:"
@ls -l $(GOBIN)/geth-linux-* | grep 386 @ls -l $(GOBIN)/geth-linux-* | grep 386
geth-linux-amd64: xgo geth-linux-amd64: xgo
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=linux/amd64 -v $(shell build/flags.sh) ./cmd/geth build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=linux/amd64 -v $(shell build/flags.sh) ./cmd/geth
@echo "Linux amd64 cross compilation done:" @echo "Linux amd64 cross compilation done:"
@ls -l $(GOBIN)/geth-linux-* | grep amd64 @ls -l $(GOBIN)/geth-linux-* | grep amd64
@ -46,12 +48,12 @@ geth-darwin: xgo geth-darwin-386 geth-darwin-amd64
@ls -l $(GOBIN)/geth-darwin-* @ls -l $(GOBIN)/geth-darwin-*
geth-darwin-386: xgo geth-darwin-386: xgo
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=darwin/386 -v $(shell build/flags.sh) ./cmd/geth build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=darwin/386 -v $(shell build/flags.sh) ./cmd/geth
@echo "Darwin 386 cross compilation done:" @echo "Darwin 386 cross compilation done:"
@ls -l $(GOBIN)/geth-darwin-* | grep 386 @ls -l $(GOBIN)/geth-darwin-* | grep 386
geth-darwin-amd64: xgo geth-darwin-amd64: xgo
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=darwin/amd64 -v $(shell build/flags.sh) ./cmd/geth build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=darwin/amd64 -v $(shell build/flags.sh) ./cmd/geth
@echo "Darwin amd64 cross compilation done:" @echo "Darwin amd64 cross compilation done:"
@ls -l $(GOBIN)/geth-darwin-* | grep amd64 @ls -l $(GOBIN)/geth-darwin-* | grep amd64
@ -60,12 +62,12 @@ geth-windows: xgo geth-windows-386 geth-windows-amd64
@ls -l $(GOBIN)/geth-windows-* @ls -l $(GOBIN)/geth-windows-*
geth-windows-386: xgo geth-windows-386: xgo
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=windows/386 -v $(shell build/flags.sh) ./cmd/geth build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=windows/386 -v $(shell build/flags.sh) ./cmd/geth
@echo "Windows 386 cross compilation done:" @echo "Windows 386 cross compilation done:"
@ls -l $(GOBIN)/geth-windows-* | grep 386 @ls -l $(GOBIN)/geth-windows-* | grep 386
geth-windows-amd64: xgo geth-windows-amd64: xgo
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=windows/amd64 -v $(shell build/flags.sh) ./cmd/geth build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=windows/amd64 -v $(shell build/flags.sh) ./cmd/geth
@echo "Windows amd64 cross compilation done:" @echo "Windows amd64 cross compilation done:"
@ls -l $(GOBIN)/geth-windows-* | grep amd64 @ls -l $(GOBIN)/geth-windows-* | grep amd64
@ -74,15 +76,29 @@ geth-android: xgo geth-android-16 geth-android-21
@ls -l $(GOBIN)/geth-android-* @ls -l $(GOBIN)/geth-android-*
geth-android-16: xgo geth-android-16: xgo
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=android-16/* -v $(shell build/flags.sh) ./cmd/geth build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=android-16/* -v $(shell build/flags.sh) ./cmd/geth
@echo "Android 16 cross compilation done:" @echo "Android 16 cross compilation done:"
@ls -l $(GOBIN)/geth-android-16-* @ls -l $(GOBIN)/geth-android-16-*
geth-android-21: xgo geth-android-21: xgo
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=android-21/* -v $(shell build/flags.sh) ./cmd/geth build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=android-21/* -v $(shell build/flags.sh) ./cmd/geth
@echo "Android 21 cross compilation done:" @echo "Android 21 cross compilation done:"
@ls -l $(GOBIN)/geth-android-21-* @ls -l $(GOBIN)/geth-android-21-*
geth-ios: xgo geth-ios-5.0 geth-ios-8.1
@echo "iOS cross compilation done:"
@ls -l $(GOBIN)/geth-ios-*
geth-ios-5.0:
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --deps=$(CROSSDEPS) --depsargs=--disable-assembly --targets=ios-5.0/* -v $(shell build/flags.sh) ./cmd/geth
@echo "iOS 5.0 cross compilation done:"
@ls -l $(GOBIN)/geth-ios-5.0-*
geth-ios-8.1:
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --deps=$(CROSSDEPS) --depsargs=--disable-assembly --targets=ios-8.1/* -v $(shell build/flags.sh) ./cmd/geth
@echo "iOS 8.1 cross compilation done:"
@ls -l $(GOBIN)/geth-ios-8.1-*
evm: evm:
build/env.sh $(GOROOT)/bin/go install -v $(shell build/flags.sh) ./cmd/evm build/env.sh $(GOROOT)/bin/go install -v $(shell build/flags.sh) ./cmd/evm
@echo "Done building." @echo "Done building."

Loading…
Cancel
Save