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