Makefile: fix gopath issues

This commit is contained in:
ryan-distrust.co 2023-06-08 21:46:25 -04:00
parent 0a444e205a
commit ae7166d7d3
Signed by untrusted user who does not match committer: ryan
GPG Key ID: 8E401478A3FBEF72
1 changed files with 11 additions and 14 deletions

View File

@ -7,6 +7,7 @@ REGION := sfo3
ROOT_DIR := $(shell pwd)
TERRAFORM := $(ROOT_DIR)/out/terraform
SOPS := $(ROOT_DIR)/out/sops
GO := cache/fetch/go/bin/go
KEYS := \
6B61ECD76088748C70590D55E90A401336C8AAA9 \
88823A75ECAA786B0FF38B148E401478A3FBEF72 \
@ -132,63 +133,59 @@ $(FETCH_DIR)/talosctl:
$(FETCH_DIR)/kubectl:
$(call git_clone,$@,$(KUBECTL_REPO),$(KUBECTL_REF))
$(OUT_DIR)/go: $(FETCH_DIR)/go
$(FETCH_DIR)/go/bin/go: $(FETCH_DIR)/go
$(call toolchain," \
cd $(FETCH_DIR)/go/src && \
mkdir -p /home/build/$@-root/pkg && \
GOROOT_FINAL=/home/build/$@-root/ \
./make.bash && \
cp /home/build/$(FETCH_DIR)/go/bin/go /home/build/$@ && \
cp -r /home/build/$(FETCH_DIR)/go/pkg/* /home/build/$@-root/pkg \
./make.bash \
")
$(OUT_DIR)/terraform: $(FETCH_DIR)/terraform $(OUT_DIR)/go
$(OUT_DIR)/terraform: $(FETCH_DIR)/terraform $(GO)
$(call toolchain," \
cd $(FETCH_DIR)/terraform && \
export SSL_CERT_DIR=/etc/ssl/certs && \
export CGO_ENABLED=0 && \
export GOCACHE=/home/build/$(CACHE_DIR) && \
export GOPATH=/home/build/$(CACHE_DIR) && \
/home/build/$(OUT_DIR)/go build \
/home/build/$(GO) build \
-v \
-trimpath \
-ldflags='-w -extldflags=-static' \
-o /home/build/$@ \
")
$(OUT_DIR)/sops: $(FETCH_DIR)/sops $(OUT_DIR)/go
$(OUT_DIR)/sops: $(FETCH_DIR)/sops $(GO)
$(call toolchain," \
cd $(FETCH_DIR)/sops && \
export CGO_ENABLED=0 && \
export GOCACHE=/home/build/$(CACHE_DIR) && \
export GOPATH=/home/build/$(CACHE_DIR) && \
/home/build/$(OUT_DIR)/go build \
/home/build/$(GO) build \
-v \
-trimpath \
-ldflags='-w -extldflags=-static' \
-o /home/build/$@ $(SOPS_PKG) \
")
$(OUT_DIR)/talosctl: $(FETCH_DIR)/talosctl $(OUT_DIR)/go
$(OUT_DIR)/talosctl: $(FETCH_DIR)/talosctl $(GO)
$(call toolchain," \
cd $(FETCH_DIR)/talosctl && \
export CGO_ENABLED=0 && \
export GOCACHE=/home/build/$(CACHE_DIR) && \
export GOPATH=/home/build/$(CACHE_DIR) && \
/home/build/$(OUT_DIR)/go build \
/home/build/$(GO) build \
-v \
-trimpath \
-ldflags='-w -extldflags=-static' \
-o /home/build/$@ $(TALOSCTL_PKG) \
")
$(OUT_DIR)/kubectl: $(FETCH_DIR)/kubectl $(OUT_DIR)/go
$(OUT_DIR)/kubectl: $(FETCH_DIR)/kubectl $(GO)
$(call toolchain," \
cd $(FETCH_DIR)/kubectl && \
export CGO_ENABLED=0 && \
export GOCACHE=/home/build/$(CACHE_DIR) && \
export GOPATH=/home/build/$(CACHE_DIR) && \
/home/build/$(OUT_DIR)/go build \
/home/build/$(GO) build \
-v \
-trimpath \
-ldflags='-w -extldflags=-static' \