Closed johnsonjh closed 4 years ago
woah markdown parsing on github is insane and I'm not going to fix that! :+1:
OK, I lied and fixed the markdown.
Closing since over at #73, we've decided this won't be imported, and we'll move to mage
instead.
Not as much as issue as a HOWTO, but here are some EASY steps you can use to get a PKT suite built with newDo - in case you can't build "pure go" versions on your distro for some reason, need to avoid linking against glibc (as even static glibc binaries are not actually staticly linked) or you require the types of builds newDo can produce.
FYI - some reason, the Golang provided by Google (1.15.3) no longer works correctly on Alpine, nor via the Docker image 'frolvlad/alpine-gcc', but you can workaround this quite easily (you actually get better results with the pre-1.6 Golang toolchainas of this writing, but Go 1.15.3+ is OK too.)
The version I'm building here is essentially develop with PR#70 + 71 applied as of this writing (10-21-2020), using Alpine via the 'frolvlad/alpine-gcc' Docker image (has some of it's own issues, but none of which will affect the build):
$ docker run -it frolvlad/alpine-gcc /bin/sh
and when inside:1)
apk update
2)apk upgrade
3)apk add git
4)apk add go
(You need their old Go to compile your newer Go) 5)apk add bash
(Sadly, the Go build system is written in Bash - no Bash required by any part of PKT suite or newDo.) 6)wget
and extract the Go sources from golang.org orgit clone https://go.googlesource.com/go
7)cd go/src
8)bash ./all.bash
(and wait awhile) 9)export PATH=/root/go/bin:$PATH
Then from outside:
1)
docker ps
to get the ID, then:2)
docker cp your-pktd-source-tree.tar [IDHERE]:/root/pktd-src.tar
Back on the "inside", three steps:
1)
cd /root ; tar xvf your-pktd-source-tree.tar && cd pktd
2)export PKT_BUILD_PUREGO=1 ; export PKT_BUILD_REPROD=1 ; export PKT_FAIL_DIRTY=0 ; export PKT_OWN_GOPATH=1 ; export PKT_OWN_GOPATH_DIR=/gopath ; export PKT_SKIP_TESTS=0 ; export PKT_FROM_SCRATCH=0
3)GOPATH=/gopath ./contrib/newDo/newDo
Here is the "reproducible" "Pure Go" build - (yes -
newDo
does work just fine with BusyBoxash
.)and yer off to the races.....
[FYI
apk add tmux
helps here]now the
pktwallet
example:These binaries will run anywhere - no libc linkage required - note that on Linux glibc "static" binaries are not actually static anymore, because they will dynamically dlload/dlopen stuff, etc. Linux is terrible.
newDo is a "hermetic" build system for building for redistribution, intended to on at least Linux (as far back as 1.2 kernels!), Mac OS X, MINGW 32/64, Win WSL, Free/Net/Open/DragonFlyBSD, Solaris, and even others, and is tested with with zsh, bash, ksh93, dash, ash, mksh, lksh, and OpenKSH [and is 100% sub-POSIX shell] - thousands and thousands of eye-cancer-causing lines of it, full of crazyness and insanity and stuff to ensure you get a working build - and tries it's best to not let you use incompatible flags.
newDo supports the following options, as of this writing:
I have a newer alpha version that can do cross-compiling successfully as well as producing automated opmsg and/or gnupg signed releases. Again, this is most going to be ported to Go and hopefully would be able to quality for inclusion in a release.
I'll put a copy of it here in a PR, in case it might help someone build redist binaries or what not - but I recommend NOT using it unless have the specific NEED for it, such as produce a ABI/API agnostic distributable releases, etc.