From 15d288d2e44aa4b243bdcf2bc78d8353a260693c Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Fri, 19 Jun 2020 15:06:43 +0300 Subject: [PATCH] Move to redo build system --- .gitignore | 1 + Makefile | 16 ---------------- all.do | 1 + bench.do | 3 +++ clean.do | 1 + default.do | 3 +++ install.texi | 27 ++++++++++++++++++--------- makedist.sh | 11 ++++++++--- module-name.do | 2 ++ www.do | 11 +++++++++++ www.mk | 18 ------------------ 11 files changed, 48 insertions(+), 46 deletions(-) create mode 100644 .gitignore delete mode 100644 Makefile create mode 100644 all.do create mode 100644 bench.do create mode 100644 clean.do create mode 100644 default.do create mode 100644 module-name.do create mode 100644 www.do delete mode 100644 www.mk diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7418c4c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +module-name diff --git a/Makefile b/Makefile deleted file mode 100644 index 9dba5f7..0000000 --- a/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -GOPATH != pwd -VERSION != cat VERSION - -MOD = go.cypherpunks.ru/gogost/v4 -LDFLAGS = -X $(MOD).Version=$(VERSION) - -all: streebog256 streebog512 - -streebog256: - GOPATH=$(GOPATH) go build -ldflags "$(LDFLAGS)" $(MOD)/cmd/streebog256 - -streebog512: - GOPATH=$(GOPATH) go build -ldflags "$(LDFLAGS)" $(MOD)/cmd/streebog512 - -bench: - GOPATH=$(GOPATH) go test -benchmem -bench . $(MOD)/... diff --git a/all.do b/all.do new file mode 100644 index 0000000..8e4f885 --- /dev/null +++ b/all.do @@ -0,0 +1 @@ +redo-ifchange streebog256 streebog512 diff --git a/bench.do b/bench.do new file mode 100644 index 0000000..a08e351 --- /dev/null +++ b/bench.do @@ -0,0 +1,3 @@ +redo-ifchange module-name +exec >&2 +go test -benchmem -bench . `cat module-name`/... diff --git a/clean.do b/clean.do new file mode 100644 index 0000000..615710c --- /dev/null +++ b/clean.do @@ -0,0 +1 @@ +rm -f module-name streebog256 streebog512 diff --git a/default.do b/default.do new file mode 100644 index 0000000..85bd5f1 --- /dev/null +++ b/default.do @@ -0,0 +1,3 @@ +redo-ifchange module-name +MOD=`cat module-name` +go build -o $3 -ldflags "-X ${MOD}.Version=`cat VERSION`" ${MOD}/cmd/$1 diff --git a/install.texi b/install.texi index 7cf962c..441c9a1 100644 --- a/install.texi +++ b/install.texi @@ -11,11 +11,22 @@ $ [fetch|wget] http://gogost.cypherpunks.ru/gogost-@value{VERSION}.tar.xz $ [fetch|wget] http://gogost.cypherpunks.ru/gogost-@value{VERSION}.tar.xz.sig $ gpg --verify gogost-@value{VERSION}.tar.xz.sig gogost-@value{VERSION}.tar.xz $ xz --decompress --stdout gogost-@value{VERSION}.tar.xz | tar xf - -$ make -C gogost-@value{VERSION} all bench -$ echo hello world | gogost-@value{VERSION}/streebog256 +$ cd gogost-@value{VERSION} +$ redo bench +$ redo all +$ echo hello world | ./streebog256 f72018189a5cfb803dbe1f2149cf554c40093d8e7f81c21e08ac5bcd09d9934d @end example +It uses @url{http://cr.yp.to/redo.html, redo} build system for that +examples. You can use either dozen of various implementations, or at +least minimalistic POSIX shell @code{apenwarr/do}: + +@example +$ [fetch|wget] https://github.com/apenwarr/redo/raw/master/minimal/do +$ mv do redo ; chmod +x redo +@end example + @include download.texi And then you can include its source code in your project for example @@ -83,13 +94,11 @@ GoGOST is also @command{go get}-able. For example to use $ go get go.cypherpunks.ru/gogost/cmd/streebog256 @end example -@code{go.cypherpunks.ru} uses @url{https://www.cacert.org/, CACert.org} -certificate authority, that is not included by default in some operating -system distributions and probably you have to install it in your system, -because @command{go get} uses HTTPS connections. If you have issues -using either @code{sum.golang.org} or @code{proxy.golang.org}, then you -can disable their usage with @env{GOPRIVATE=go.cypherpunks.ru/gogost} -environment variable. +@code{go.cypherpunks.ru} uses @url{http://ca.cypherpunks.ru/, ca.cypherpunks.ru} +certificate authority. If you have issues using either +@code{sum.golang.org} or @code{proxy.golang.org}, then you can disable +their usage with @env{GOPRIVATE=go.cypherpunks.ru/gogost} environment +variable. Also you can use @code{replace} feature inside your @file{go.mod}, like: diff --git a/makedist.sh b/makedist.sh index c0bda20..5ca9e86 100755 --- a/makedist.sh +++ b/makedist.sh @@ -5,11 +5,12 @@ tmp=$(mktemp -d) release=$1 [ -n "$release" ] +redo-ifchange module-name streebog256 +mod_name=`cat module-name` git clone . $tmp/gogost-$release cd $tmp/gogost-$release git checkout v$release -mod_name=$(sed -n 's/^module //p' go.mod) crypto_mod_path=$(sed -n 's#^require \(golang.org/x/crypto\) \(.*\)$#\1@\2#p' go.mod) mkdir -p src/$mod_name mv \ @@ -25,6 +26,10 @@ mv \ prfplus \ cmd internal gogost.go go.mod go.sum src/$mod_name +rm module-name.do clean.do +echo $mod_name > module-name +find . -name "*.do" -exec perl -i -npe "s/^go/GOPATH=\`pwd\` go/" {} \; + mkdir -p src/golang.org/x/crypto ( cd $GOPATH/pkg/mod/$crypto_mod_path ; \ tar cf - AUTHORS CONTRIBUTORS LICENSE PATENTS README.md pbkdf2 hkdf ) | @@ -32,7 +37,7 @@ mkdir -p src/golang.org/x/crypto cat > download.texi <