Skip to content

Commit

Permalink
build: Add skopeo static builds as git lfs objects
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmidyson committed Dec 15, 2021
1 parent 51aab63 commit d2052a9
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 11 deletions.
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ openapi_violations.report
dist/
.local/

skopeo/static
.image-bundle-*
7 changes: 5 additions & 2 deletions make/skopeo.mk
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -11,12 +12,14 @@ 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
skopeo/static/skopeo-$(GOOS)-$(GOARCH)$(if $(filter $(GOOS),windows),.exe): ; $(info $(M) Building skopeo for $(GOOS)/$(GOARCH))
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
12 changes: 4 additions & 8 deletions make/upx.mk
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions skopeo/static/skopeo-darwin-amd64
Git LFS file not shown
3 changes: 3 additions & 0 deletions skopeo/static/skopeo-darwin-arm64
Git LFS file not shown
3 changes: 3 additions & 0 deletions skopeo/static/skopeo-linux-amd64
Git LFS file not shown
3 changes: 3 additions & 0 deletions skopeo/static/skopeo-linux-arm64
Git LFS file not shown
3 changes: 3 additions & 0 deletions skopeo/static/skopeo-windows-amd64.exe
Git LFS file not shown
3 changes: 3 additions & 0 deletions skopeo/static/skopeo-windows-arm64.exe
Git LFS file not shown

0 comments on commit d2052a9

Please sign in to comment.