From d2052a9e57f26da697ab67a0fd664d95e0d85286 Mon Sep 17 00:00:00 2001 From: Jimmi Dyson Date: Wed, 15 Dec 2021 12:02:35 +0000 Subject: [PATCH] build: Add skopeo static builds as git lfs objects --- .gitattributes | 6 ++++++ .gitignore | 1 - make/skopeo.mk | 7 +++++-- make/upx.mk | 12 ++++-------- skopeo/static/skopeo-darwin-amd64 | 3 +++ skopeo/static/skopeo-darwin-arm64 | 3 +++ skopeo/static/skopeo-linux-amd64 | 3 +++ skopeo/static/skopeo-linux-arm64 | 3 +++ skopeo/static/skopeo-windows-amd64.exe | 3 +++ skopeo/static/skopeo-windows-arm64.exe | 3 +++ 10 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 .gitattributes create mode 100755 skopeo/static/skopeo-darwin-amd64 create mode 100755 skopeo/static/skopeo-darwin-arm64 create mode 100755 skopeo/static/skopeo-linux-amd64 create mode 100755 skopeo/static/skopeo-linux-arm64 create mode 100755 skopeo/static/skopeo-windows-amd64.exe create mode 100755 skopeo/static/skopeo-windows-arm64.exe diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..9d3c3927 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +skopeo/static/skopeo-windows-amd64.exe filter=lfs diff=lfs merge=lfs -text +skopeo/static/skopeo-windows-arm64.exe filter=lfs diff=lfs merge=lfs -text +skopeo/static/skopeo-darwin-amd64 filter=lfs diff=lfs merge=lfs -text +skopeo/static/skopeo-darwin-arm64 filter=lfs diff=lfs merge=lfs -text +skopeo/static/skopeo-linux-amd64 filter=lfs diff=lfs merge=lfs -text +skopeo/static/skopeo-linux-arm64 filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore index 9fd277fb..49fabddd 100644 --- a/.gitignore +++ b/.gitignore @@ -21,5 +21,4 @@ openapi_violations.report dist/ .local/ -skopeo/static .image-bundle-* diff --git a/make/skopeo.mk b/make/skopeo.mk index 67e60ca0..8ce6b756 100644 --- a/make/skopeo.mk +++ b/make/skopeo.mk @@ -1,6 +1,7 @@ .PHONY: skopeo.build skopeo.build: ## Builds the skopeo static binary skopeo.build: skopeo/static/skopeo-$(GOOS)-$(GOARCH)$(if $(filter $(GOOS),windows),.exe) + $(MAKE) upx UPX_TARGET=skopeo/static/skopeo-$(GOOS)-$(GOARCH)$(if $(filter $(GOOS),windows),.exe) .PHONY: skopeo.build.all skopeo.build.all: @@ -11,7 +12,6 @@ skopeo.build.all: $(MAKE) --no-print-directory GOOS=windows GOARCH=amd64 skopeo.build $(MAKE) --no-print-directory GOOS=windows GOARCH=arm64 skopeo.build - ifeq ($(IS_SNAPSHOT),false) .PHONY: skopeo/static/skopeo-$(GOOS)-$(GOARCH)$(if $(filter $(GOOS),windows),.exe) endif @@ -19,4 +19,7 @@ skopeo/static/skopeo-$(GOOS)-$(GOARCH)$(if $(filter $(GOOS),windows),.exe): ; $( mkdir -p $(dir $@) rm -f $(REPO_ROOT)/$@ cd skopeo-static && \ - CGO_ENABLED=0 go build -o $(REPO_ROOT)/$@ -tags containers_image_openpgp github.com/containers/skopeo/cmd/skopeo + CGO_ENABLED=0 go build -o $(REPO_ROOT)/$@ \ + -trimpath -ldflags='-s -w' \ + -tags containers_image_openpgp \ + github.com/containers/skopeo/cmd/skopeo diff --git a/make/upx.mk b/make/upx.mk index d629a25f..dbcc437d 100644 --- a/make/upx.mk +++ b/make/upx.mk @@ -1,14 +1,10 @@ .PHONY: upx -ifeq ($(IS_SNAPSHOT),false) -ifneq ($(GOOS)/$(GOARCH),windows/arm64) -upx: install-tool.upx -endif -endif upx: UPX_REAL_TARGET := $(addsuffix $(if $(filter $(GOOS),windows),.exe),$(basename $(UPX_TARGET))) +ifeq ($(GOOS)/$(GOARCH),windows/arm64) +upx: ; $(info $(M) skipping packing $(UPX_REAL_TARGET) - $(GOOS)/$(GOARCH) is not yet supported by upx) +else +upx: install-tool.upx upx: ## Pack executable using upx upx: ; $(info $(M) packing $(UPX_REAL_TARGET)) -ifeq ($(IS_SNAPSHOT),false) -ifneq ($(GOOS)/$(GOARCH),windows/arm64) (upx -l $(UPX_REAL_TARGET) &>/dev/null && echo $(UPX_REAL_TARGET) is already packed) || upx -9 $(UPX_REAL_TARGET) endif -endif diff --git a/skopeo/static/skopeo-darwin-amd64 b/skopeo/static/skopeo-darwin-amd64 new file mode 100755 index 00000000..efb9892a --- /dev/null +++ b/skopeo/static/skopeo-darwin-amd64 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2097c0f56355683a413810c46d071fd3317b122638a16db2df8af7c3172da35 +size 6209552 diff --git a/skopeo/static/skopeo-darwin-arm64 b/skopeo/static/skopeo-darwin-arm64 new file mode 100755 index 00000000..e9a9fb8f --- /dev/null +++ b/skopeo/static/skopeo-darwin-arm64 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:14f8689570410e32f365ac44fad2fd8630deafa6c99b7b9010c4c3cfa659ae5f +size 8204304 diff --git a/skopeo/static/skopeo-linux-amd64 b/skopeo/static/skopeo-linux-amd64 new file mode 100755 index 00000000..39749734 --- /dev/null +++ b/skopeo/static/skopeo-linux-amd64 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d44b3c7caf63fd00681fd7d5c9d9568480382539a7fcd9f1fcf3ed64514a4c7c +size 6107732 diff --git a/skopeo/static/skopeo-linux-arm64 b/skopeo/static/skopeo-linux-arm64 new file mode 100755 index 00000000..4ec821d7 --- /dev/null +++ b/skopeo/static/skopeo-linux-arm64 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a213fc1bc2260181d394cb26cd5ff720e58e0ba818e203d55c5ed5b304733b14 +size 5341580 diff --git a/skopeo/static/skopeo-windows-amd64.exe b/skopeo/static/skopeo-windows-amd64.exe new file mode 100755 index 00000000..88c6cd8a --- /dev/null +++ b/skopeo/static/skopeo-windows-amd64.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c6f29cd1d11943769a60730cb71cf52396a47ec3e7881523ee0efeae7090e891 +size 6236672 diff --git a/skopeo/static/skopeo-windows-arm64.exe b/skopeo/static/skopeo-windows-arm64.exe new file mode 100755 index 00000000..6ba06de9 --- /dev/null +++ b/skopeo/static/skopeo-windows-arm64.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ba2bece48338e909a4fbbd27048345af55970f65a94c983089e5e2c1a1f038c6 +size 19753984