clarify build requirements and add a check script for common errors

This commit is contained in:
Ted Unangst 2020-10-01 21:58:50 -04:00
parent a81cf01844
commit 3b8fee642b
5 changed files with 37 additions and 4 deletions

View File

@ -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

2
README
View File

@ -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.

View File

@ -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.

2
go.mod
View File

@ -1,6 +1,6 @@
module humungus.tedunangst.com/r/honk
go 1.11
go 1.13
require (
github.com/andybalholm/cascadia v1.1.0

30
preflight.sh Normal file
View File

@ -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