diff --git a/.gitignore b/.gitignore index 365cc915..4628199b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,2 @@ websocketd -*.swp -*.swo -go -go-v* +go-* diff --git a/CHANGES b/CHANGES index 758041d3..21aa9ee2 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ +Version 0.3.1 (Jan 28, 2019) + +* Minor improvements to websocketd itself +* Use of go modules, gorilla websockets set to 1.4.0 +* Binaries build code switched to 1.11.5 (improving underlying protocol handlers) + Version 0.3.0 (??, 2017) * Migration of underlying websocket server to Gorilla Websocket lib. diff --git a/Makefile b/Makefile index b720d61d..9871b7dd 100644 --- a/Makefile +++ b/Makefile @@ -15,19 +15,21 @@ SYSTEM_NAME:=$(shell uname -s | tr '[:upper:]' '[:lower:]') SYSTEM_ARCH:=$(shell uname -m) GO_ARCH:=$(if $(filter x86_64, $(SYSTEM_ARCH)),amd64,386) GO_VERSION:=$(GO_VER).$(SYSTEM_NAME)-$(GO_ARCH) -GO_DOWNLOAD_URL:=http://golang.org/dl/go$(GO_VERSION).tar.gz -GO_WORKDIR:=go-v$(GO_VERSION) +GO_DOWNLOAD_URL:=https://dl.google.com/go/go$(GO_VERSION).tar.gz +GO_DIR:=go-$(GO_VER) # Build websocketd binary -websocketd: $(GO_WORKDIR)/bin/go $(wildcard *.go) $(wildcard libwebsocketd/*.go) - $(GO_WORKDIR)/bin/go build +websocketd: $(GO_DIR)/bin/go $(wildcard *.go) $(wildcard libwebsocketd/*.go) + $(GO_DIR)/bin/go build + +localgo: $(GO_DIR)/bin/go # Download and unpack Go distribution. -$(GO_WORKDIR)/bin/go: - mkdir -p $(GO_WORKDIR) +$(GO_DIR)/bin/go: + mkdir -p $(GO_DIR) rm -f $@ - @echo Downloading and unpacking Go $(GO_VERSION) to $(GO_WORKDIR) - wget -q -O - $(GO_DOWNLOAD_URL) | tar xzf - --strip-components=1 -C $(GO_WORKDIR) + @echo Downloading and unpacking Go $(GO_VERSION) to $(GO_DIR) + curl -s $(GO_DOWNLOAD_URL) | tar xf - --strip-components=1 -C $(GO_DIR) # Clean up binary clean: diff --git a/release/Makefile b/release/Makefile index f094629b..a35a0bd3 100644 --- a/release/Makefile +++ b/release/Makefile @@ -1,4 +1,4 @@ -# Copyright 2013 Joe Walnes and the websocketd team. +# Copyright 2013-2019 Joe Walnes and the websocketd team. # All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. @@ -16,10 +16,12 @@ LAST_PATCH_VERSION:=$(shell git ls-remote git@github.com:joewalnes/websocketd.gi | sort -n \ | tail -n 1) -VERSION_PATCH:=$(if $(LAST_PATCH_VERSION),$(shell expr $(LAST_PATCH_VERSION)),0) + + +VERSION_PATCH:=$(shell expr $$(( $(or $(LAST_PATCH_VERSION),-1) + 1 ))) RELEASE_VERSION=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) -GO_VERSION=1.9.2 +GO_VERSION=1.11.5 PLATFORMS=linux_amd64 linux_386 linux_arm linux_arm64 darwin_amd64 freebsd_amd64 freebsd_386 windows_386 windows_amd64 openbsd_386 openbsd_amd64 solaris_amd64 @@ -41,73 +43,47 @@ endif -GO_SRC_URL=https://storage.googleapis.com/golang/go$(GO_VERSION).$(UNAME_SYS)-$(UNAME_ARCH).tar.gz -GO_DOWNLOAD=go-local/$(GO_VERSION).tgz -GO_DIR=go-local/$(GO_VERSION) -GO_UNPACKED=$(GO_DIR)/.unpacked +GO_SRC_URL=https://dl.google.com/go/go$(GO_VERSION).$(UNAME_SYS)-$(UNAME_ARCH).tar.gz +GO_DIR=../go-$(GO_VERSION) # Prevent any global environment polluting the builds -GOROOT=$(shell readlink -f $(GO_DIR))/go -GOPATH=$(shell readlink -f go-path) - -FLAGS_all = GOROOT=$(GOROOT) GOPATH=$(GOPATH) -FLAGS_linux_amd64 = $(FLAGS_all) GOOS=linux GOARCH=amd64 -FLAGS_linux_386 = $(FLAGS_all) GOOS=linux GOARCH=386 -FLAGS_linux_arm = $(FLAGS_all) GOOS=linux GOARCH=arm GOARM=5 # ARM5 support for Raspberry Pi -FLAGS_linux_arm64 = $(FLAGS_all) GOOS=linux GOARCH=arm64 # no need for GOARM= (which is technically 8) -FLAGS_darwin_amd64 = $(FLAGS_all) GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 -FLAGS_darwin_386 = $(FLAGS_all) GOOS=darwin GOARCH=386 CGO_ENABLED=0 -FLAGS_freebsd_amd64 = $(FLAGS_all) GOOS=freebsd GOARCH=amd64 CGO_ENABLED=0 -FLAGS_freebsd_386 = $(FLAGS_all) GOOS=freebsd GOARCH=386 CGO_ENABLED=0 -FLAGS_windows_386 = $(FLAGS_all) GOOS=windows GOARCH=386 CGO_ENABLED=0 -FLAGS_windows_amd64 = $(FLAGS_all) GOOS=windows GOARCH=amd64 CGO_ENABLED=0 -FLAGS_openbsd_386 = $(FLAGS_all) GOOS=openbsd GOARCH=386 CGO_ENABLED=0 -FLAGS_openbsd_amd64 = $(FLAGS_all) GOOS=openbsd GOARCH=amd64 CGO_ENABLED=0 -FLAGS_solaris_amd64 = $(FLAGS_all) GOOS=solaris GOARCH=amd64 CGO_ENABLED=0 - -EXTENSION_windows_386=.exe -EXTENSION_windows_amd64=.exe +FLAGS_linux_amd64 = GOOS=linux GOARCH=amd64 +FLAGS_linux_386 = GOOS=linux GOARCH=386 +FLAGS_linux_arm = GOOS=linux GOARCH=arm GOARM=5 # ARM5 support for Raspberry Pi +FLAGS_linux_arm64 = GOOS=linux GOARCH=arm64 # no need for GOARM= (which is technically 8) +FLAGS_darwin_amd64 = GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 +FLAGS_darwin_386 = GOOS=darwin GOARCH=386 CGO_ENABLED=0 +FLAGS_freebsd_amd64 = GOOS=freebsd GOARCH=amd64 CGO_ENABLED=0 +FLAGS_freebsd_386 = GOOS=freebsd GOARCH=386 CGO_ENABLED=0 +FLAGS_windows_386 = GOOS=windows GOARCH=386 CGO_ENABLED=0 +FLAGS_windows_amd64 = GOOS=windows GOARCH=amd64 CGO_ENABLED=0 +FLAGS_openbsd_386 = GOOS=openbsd GOARCH=386 CGO_ENABLED=0 +FLAGS_openbsd_amd64 = GOOS=openbsd GOARCH=amd64 CGO_ENABLED=0 +FLAGS_solaris_amd64 = GOOS=solaris GOARCH=amd64 CGO_ENABLED=0 all: build -.PHONY: all - -go-path/src/github.com/joewalnes/websocketd: ../*.go ../libwebsocketd/*.go - rm -f $@ - mkdir -p go-path/src/github.com/joewalnes - cd go-path/src/github.com/joewalnes && ln -s ../../../../../ websocketd - - -# Download Go source code -$(GO_DOWNLOAD): - $(call msg,"Dowloading Go $(GO_VERSION)") - mkdir -p $(dir $@) - curl --silent --fail --output $@ $(GO_SRC_URL) -go-download: $(GO_DOWNLOAD) -.PHONY: go-download +localgo: $(GO_DIR)/bin/go -# Unpack Go source code -$(GO_UNPACKED): $(GO_DOWNLOAD) - $(call msg,"Unpacking Go $(GO_VERSION)") - rm -f $(GO_UNPACKED) +$(GO_DIR)/bin/go: mkdir -p $(GO_DIR) - tar xzf $(GO_DOWNLOAD) -C $(GO_DIR) - touch $(GO_UNPACKED) - -go-unpack: $(GO_UNPACKED) -.PHONY: go-unpack + rm -f $@ + @echo Downloading and unpacking Go $(GO_VERSION) to $(GO_DIR) + curl $(GO_DOWNLOAD_URL) | tar xzf - --strip-components=1 -C $(GO_DIR) # Cross-compile final applications -out/$(RELEASE_VERSION)/%/websocketd out/$(RELEASE_VERSION)/%/websocketd.exe: $(GO_UNPACKED) $(wildcard ../*.go) go-path/src/github.com/joewalnes/websocketd - $(call msg,"Compiling release for $*") +out/$(RELEASE_VERSION)/%/websocketd: ../*.go ../libwebsocketd/*.go $(GO_DIR)/bin/go + rm -f $@ + mkdir -p $(dir $@) + $(FLAGS_$*) $(GO_DIR)/bin/go build -ldflags "-X main.version=$(RELEASE_VERSION)" -o out/$(RELEASE_VERSION)/$*/websocketd .. + +out/$(RELEASE_VERSION)/%/websocketd.exe: ../*.go ../libwebsocketd/*.go $(GO_DIR)/bin/go rm -f $@ mkdir -p $(dir $@) - $(FLAGS_$*) $(GO_DIR)/go/bin/go get github.com/gorilla/websocket - $(FLAGS_$*) $(GO_DIR)/go/bin/go build -ldflags "-X main.version=$(RELEASE_VERSION)" -o out/$(RELEASE_VERSION)/$*/websocketd$(EXTENSION_$*) $(wildcard ../*.go) - touch $@ + $(FLAGS_$*) $(GO_DIR)/bin/go build -ldflags "-X main.version=$(RELEASE_VERSION)" -o out/$(RELEASE_VERSION)/$*/websocketd.exe .. -out/$(RELEASE_VERSION)/websocketd-$(RELEASE_VERSION)-%.zip: out/$(RELEASE_VERSION)/%/websocketd $(wildcard ../*.go) go-path/src/github.com/joewalnes/websocketd +out/$(RELEASE_VERSION)/websocketd-$(RELEASE_VERSION)-%.zip: out/$(RELEASE_VERSION)/%/websocketd rm -f $@ zip -j $@ out/$(RELEASE_VERSION)/$*/* ../{README.md,LICENSE,CHANGES} @@ -118,10 +94,8 @@ DEBS = out/$(RELEASE_VERSION)/websocketd-$(RELEASE_VERSION)_i386.deb out/$(RELEA RPMS = out/$(RELEASE_VERSION)/websocketd.$(RELEASE_VERSION).i386.rpm out/$(RELEASE_VERSION)/websocketd.$(RELEASE_VERSION).x86_64.rpm binaries: $(BINARIES) -.PHONY: websocketd build: out/$(RELEASE_VERSION)/CHECKSUMS -.PHONY: build out/$(RELEASE_VERSION)/CHECKSUMS: $(BINARIES) $(ZIPS) $(DEBS) $(RPMS) sha256sum $^ | sed -e 's/out\/$(RELEASE_VERSION)\///' >$@ @@ -134,10 +108,8 @@ DEBFPM="" RPMFPM=--rpm-os linux deb: $(DEBS) -.PHONY: deb rpm: $(RPMS) -.PHONY: rpm out/$(RELEASE_VERSION)/websocketd-$(RELEASE_VERSION)_i386.deb: $(GO_UNPACKED) out/$(RELEASE_VERSION)/linux_386/websocketd @@ -175,17 +147,10 @@ out/$(RELEASE_VERSION)/websocketd.$(RELEASE_VERSION).i386.rpm: $(GO_UNPACKED) ou # Clean up clobber: clean -.PHONY: clobber - -clean: clean-go clean-out -.PHONY: clean + rm -rf $(GO_DIR) -clean-go: - rm -rf go-local - rm -rf go-path -.PHONY: clean-go -clean-out: +clean: rm -rf out -.PHONY: clean-out +.PHONY: all build deb rpm localgo clobber clean