Fix a slight regression after ec3292: when 'make' is run without specifying
a target, it counter-intuitively runs fetch-tags instead of building micro.
* Makefile: Ensure we strip out embedded paths
To reproduce binaries undeterministic values needs to be removed. By
default Go embeds several module paths into the binaries, which prevents
people from reproducing said distributed binary.
The distributed binary from micro contains the full home path of the
current builder of the binary. -trimpath removes these paths from the
binary.
$ strings micro | grep "/home/zyedidia" | wc -l
868
This also helps other distributions providing reproducible versions of
micro down the line.
Signed-off-by: Morten Linderud <morten@linderud.pw>
* build-date: Ensure build time adheres to SOURCE_DATE_EPOCH
Embedding undeterministic values into binaries prevents reproduction of
the binaries. The reproducible builds projects defines
`SOURCE_DATE_EPOCH` to allow deterministic insertion of build times.
This patch ensures `build-date` checks the environment variable before
building with the local time.
$ SOURCE_DATE_EPOCH=123123 go run tools/build-date.go
January 02, 1970
$ go run tools/build-date.go
July 31, 2020
$ make build-quick && ./micro --version
[...]
Compiled on July 31, 2020
$ SOURCE_DATE_EPOCH=123123 make build-quick && ./micro --version
[...]
Compiled on January 02, 1970
https://reproducible-builds.org/specs/source-date-epoch/
Signed-off-by: Morten Linderud <morten@linderud.pw>
This change introduces header files for syntax files. The header
files only contain the filetype and detection info and can be
parsed much faster than parsing a full yaml file. To determine
which filetype a file is, only scanning the headers is necessary
and afterwards only one yaml file needs to be parsed. Use the
make_headers.go file to generate the header files. Micro expects
that all default syntax files will have header files and that
custom user syntax files may or may not have them. Resolving
includes within syntax has not yet been implemented. This
optimization improves startup time.
Ref #1427
Now you can use 'make update' which will update micro and all the
dependencies (but won't rebuild). The makefile also now supports
having a $GOBIN variable and having multiple directories in your
$GOPATH.