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 +