make: Fix for local builds outside of GOPATH

Go can be weird about tools having to run in a directory with
go.mod. This commit moves the linuxkit makefile to the same
directory as the code.

It also changes the semantics of the local-build target.
You can now use STATIC=0 for dynamic builds or PIE=1 to
use --buildmode=pie. The binaries we were producing in
local-static weren't actually static so I fixed that too

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
This commit is contained in:
Dave Tucker
2021-03-19 14:06:07 +00:00
parent a8797a5e0f
commit 93ada489f9
3 changed files with 105 additions and 45 deletions

View File

@@ -57,7 +57,7 @@ jobs:
- name: Build
run: |
make GOARCH=${{matrix.target.arch}} GOOS=${{matrix.target.os}} LOCAL_TARGET=bin/linuxkit-${{matrix.target.suffix}} local-build
make GOARCH=${{matrix.target.arch}} GOOS=${{matrix.target.os}} LOCAL_TARGET=$(pwd)/bin/linuxkit-${{matrix.target.suffix}} local-build
file bin/linuxkit-${{matrix.target.suffix}}
env:
GOPATH: ${{runner.workspace}}