summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-10-17 13:52:29 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-10-17 13:52:29 +0200
commit6255220f5dd115619990f698044ffae36c3dfcf6 (patch)
tree4b2316fd09dabc9d35c6661fece448dc7230fa2b
parentb91f9fa7fe99aa9b0eed5a847baa67f1c678208a (diff)
Fixed windows build.
-rw-r--r--Makefile37
-rw-r--r--gdb-common_darwin.go4
-rw-r--r--gdb-common_linux.go4
-rw-r--r--gdb-common_windows.go19
-rw-r--r--gdb-native.go2
-rw-r--r--main.go4
6 files changed, 52 insertions, 18 deletions
diff --git a/Makefile b/Makefile
index 017cb29..ed58a29 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
# Application Version
VERSION := 0.1.0
-
+TARGET=xds-gdb
# Retrieve git tag/commit to set sub-version string
ifeq ($(origin SUB_VERSION), undefined)
@@ -22,7 +22,7 @@ endif
HOST_GOOS=$(shell go env GOOS)
HOST_GOARCH=$(shell go env GOARCH)
ARCH=$(HOST_GOOS)-$(HOST_GOARCH)
-REPOPATH=github.com/iotbzh/xds-gdb
+REPOPATH=github.com/iotbzh/$(TARGET)
EXT=
ifeq ($(HOST_GOOS), windows)
@@ -44,22 +44,31 @@ VERBOSE_2 := -v -x
# Release or Debug mode
ifeq ($(filter 1,$(RELEASE) $(REL)),)
- GORELEASE=
+ GO_LDFLAGS=
+ # disable compiler optimizations and inlining
+ GO_GCFLAGS=-N -l
BUILD_MODE="Debug mode"
else
# optimized code without debug info
- GORELEASE= -s -w
+ GO_LDFLAGS=-s -w
+ GO_GCFLAGS=
BUILD_MODE="Release mode"
endif
+ifeq ($(SUB_VERSION), )
+ PACKAGE_ZIPFILE := $(TARGET)_$(ARCH)-v$(VERSION).zip
+else
+ PACKAGE_ZIPFILE := $(TARGET)_$(ARCH)-v$(VERSION)_$(SUB_VERSION).zip
+endif
+
.PHONY: all
-all: build
+all: vendor build
.PHONY: build
-build: vendor
- @echo "### Build xds-gdb (version $(VERSION), subversion $(SUB_VERSION)) - $(BUILD_MODE)";
- @cd $(ROOT_SRCDIR); $(BUILD_ENV_FLAGS) go build $(VERBOSE_$(V)) -i -o $(BINDIR)/xds-gdb$(EXT) -ldflags "$(GORELEASE) -X main.AppVersion=$(VERSION) -X main.AppSubVersion=$(SUB_VERSION)" .
+build:
+ @echo "### Build $(TARGET) (version $(VERSION), subversion $(SUB_VERSION)) - $(BUILD_MODE)";
+ @cd $(ROOT_SRCDIR); $(BUILD_ENV_FLAGS) go build $(VERBOSE_$(V)) -i -o $(BINDIR)/$(TARGET)$(EXT) -ldflags "$(GO_LDFLAGS) -X main.AppVersion=$(VERSION) -X main.AppSubVersion=$(SUB_VERSION)" -gcflags "$(GO_GCFLAGS)" .
test: tools/glide
go test --race $(shell ./tools/glide novendor)
@@ -81,18 +90,18 @@ distclean: clean
release:
RELEASE=1 make -f $(ROOT_SRCDIR)/Makefile clean build
-package: clean build
- @mkdir -p $(PACKAGE_DIR)/xds-gdb
- @cp -a $(BINDIR)/*gdb$(EXT) $(PACKAGE_DIR)/xds-gdb
- @cd $(PACKAGE_DIR) && zip --symlinks -r $(ROOT_SRCDIR)/xds-gdb_$(ARCH)-v$(VERSION)_$(SUB_VERSION).zip ./xds-gdb
+package: clean vendor build
+ @mkdir -p $(PACKAGE_DIR)/$(TARGET)
+ @cp -a $(BINDIR)/*gdb$(EXT) $(PACKAGE_DIR)/$(TARGET)
+ @cp -r $(ROOT_SRCDIR)/conf.d $(ROOT_SRCDIR)/scripts $(PACKAGE_DIR)/$(TARGET)
+ cd $(PACKAGE_DIR) && zip -r $(ROOT_SRCDIR)/$(PACKAGE_ZIPFILE) ./$(TARGET)
.PHONY: package-all
package-all:
@echo "# Build linux amd64..."
GOOS=linux GOARCH=amd64 RELEASE=1 make -f $(ROOT_SRCDIR)/Makefile package
@echo "# Build windows amd64..."
-# GOOS=windows GOARCH=amd64 RELEASE=1 make -f $(ROOT_SRCDIR)/Makefile package
- @echo " WARNING: build on Windows not supported for now."
+ GOOS=windows GOARCH=amd64 RELEASE=1 make -f $(ROOT_SRCDIR)/Makefile package
@echo "# Build darwin amd64..."
GOOS=darwin GOARCH=amd64 RELEASE=1 make -f $(ROOT_SRCDIR)/Makefile package
make -f $(ROOT_SRCDIR)/Makefile clean
diff --git a/gdb-common_darwin.go b/gdb-common_darwin.go
index d167c5d..dff1c2b 100644
--- a/gdb-common_darwin.go
+++ b/gdb-common_darwin.go
@@ -40,3 +40,7 @@ func tcgetattr(fd uintptr, termios *syscall.Termios) error {
}
return nil
}
+
+func isIgnoredSignal(sig os.Signal) bool {
+ return (sig == syscall.SIGWINCH)
+}
diff --git a/gdb-common_linux.go b/gdb-common_linux.go
index a2f4bf6..ad64f96 100644
--- a/gdb-common_linux.go
+++ b/gdb-common_linux.go
@@ -35,3 +35,7 @@ func tcgetattr(fd uintptr, termios *syscall.Termios) error {
}
return nil
}
+
+func isIgnoredSignal(sig os.Signal) bool {
+ return (sig == syscall.SIGWINCH)
+}
diff --git a/gdb-common_windows.go b/gdb-common_windows.go
index b233943..b2ceb73 100644
--- a/gdb-common_windows.go
+++ b/gdb-common_windows.go
@@ -1,7 +1,24 @@
package main
-import "syscall"
+import (
+ "fmt"
+ "os"
+ "syscall"
+
+ "github.com/Sirupsen/logrus"
+)
const (
syscallEBADE = syscall.EBADE
)
+
+func NewGdbNative(log *logrus.Logger, args []string, env []string) *GdbXds {
+ fmt.Printf("Native gdb debug mode not supported on Windows !")
+ os.Exit(int(syscall.ENOSYS))
+
+ return nil
+}
+
+func isIgnoredSignal(sig os.Signal) bool {
+ return false
+}
diff --git a/gdb-native.go b/gdb-native.go
index 4bae3d3..e83f9ef 100644
--- a/gdb-native.go
+++ b/gdb-native.go
@@ -1,3 +1,5 @@
+// +build !windows
+
package main
import (
diff --git a/main.go b/main.go
index 87de43c..e7f14d6 100644
--- a/main.go
+++ b/main.go
@@ -461,9 +461,7 @@ endloop:
for {
sig := <-sigs
- // FIXME: skip Window Changed signal for now
- if sig == syscall.SIGWINCH {
- log.Debugf("SKIP signal Window Changed")
+ if isIgnoredSignal(sig) {
return
}