From 3b8fee642b984656e94a622f9b30c7dbad59005b Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Thu, 1 Oct 2020 21:58:50 -0400 Subject: [PATCH] clarify build requirements and add a check script for common errors --- Makefile | 5 ++++- README | 2 +- docs/honk.8 | 2 +- go.mod | 2 +- preflight.sh | 30 ++++++++++++++++++++++++++++++ 5 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 preflight.sh diff --git a/Makefile b/Makefile index 510bc8c..33b0061 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,12 @@ all: honk schema.go: schema.sql sh ./genschemago.sh -honk: schema.go *.go go.mod +honk: .preflightcheck schema.go *.go go.mod go build -mod=`ls -d vendor 2> /dev/null` -o honk +.preflightcheck: preflight.sh + @sh ./preflight.sh + clean: rm -f honk diff --git a/README b/README index a30daa9..926d089 100644 --- a/README +++ b/README @@ -20,7 +20,7 @@ This does not imply the goal is to be what you want. -- build It should be sufficient to type make after unpacking a release. -You'll need a go compiler version 1.11 or later. +You'll need a go compiler version 1.13 or later. And libsqlite3. Even on a fast machine, building from source can take several seconds. diff --git a/docs/honk.8 b/docs/honk.8 index 4e23cdb..81aeeab 100644 --- a/docs/honk.8 +++ b/docs/honk.8 @@ -41,7 +41,7 @@ proxy_set_header Host $http_host; .Ss Build Building .Nm -requires a go compiler and libsqlite. +requires a go compiler 1.13 and libsqlite. On .Ox this is the go and sqlite3 packages. diff --git a/go.mod b/go.mod index da6db73..fd8992c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module humungus.tedunangst.com/r/honk -go 1.11 +go 1.13 require ( github.com/andybalholm/cascadia v1.1.0 diff --git a/preflight.sh b/preflight.sh new file mode 100644 index 0000000..a0714aa --- /dev/null +++ b/preflight.sh @@ -0,0 +1,30 @@ +set -e + +go version > /dev/null 2>&1 || (echo go 1.13+ is required && false) + +v=`go version | egrep -o 'go1[^ ]+'` +case $v in + go1.10*|go1.11*|go1.12*) + echo go version is too old: $v + echo go 1.13+ is required + false + ;; + go1.1*) + # just pretend nobody is still using go 1.1 or 1.2 + ;; + go1.2*) + ;; + *) + echo unknown go version: $v + false + ;; +esac + +if [ \! \( -e /usr/include/sqlite3.h -o -e /usr/local/include/sqlite3.h \) ] ; then + echo unable to find sqlite3.h header + echo please install libsqlite3 dev package + false +fi + +touch .preflightcheck +