From d69101924b6e6bde7e44c2452df7c671caaf21be Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Fri, 6 Oct 2023 12:53:25 +0200 Subject: [PATCH 1/4] Add build for macOS --- Makefile | 16 ++++++++++------ README.md | 8 +++++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 4fe3d975..154b24d1 100644 --- a/Makefile +++ b/Makefile @@ -12,15 +12,15 @@ SHELL = /bin/bash BUILD = go build MKDIR = mkdir -p -.PHONY: build build_linux build_win tag_checked_out mostlyclean +.PHONY: build build_linux build_win build_mac_amd64 build_mac_arm64 tag_checked_out mostlyclean all: - @echo choose a target from: build build_linux build_win mostlyclean + @echo choose a target from: build build_linux build_win build_mac_amd64 build_mac_arm64 mostlyclean @echo prepend \`make BUILDTAG=1\` to checkout the highest git tag before building @echo or set BUILDTAG to a specific tag # Build all binaries -build: build_linux build_win +build: build_linux build_win build_mac_amd64 build_mac_arm64 # if BUILDTAG == 1 set it to the highest git tag ifeq ($(strip $(BUILDTAG)),1) @@ -29,7 +29,7 @@ endif ifdef BUILDTAG # add the git tag checkout to the requirements of our build targets -build_linux build_win: tag_checked_out +build_linux build_win build_mac_amd64 build_mac_arm64: tag_checked_out endif tag_checked_out: @@ -67,15 +67,19 @@ LDFLAGS = -ldflags "-X github.com/csaf-poc/csaf_distribution/v3/util.SemVersion= GOARCH = amd64 build_linux: GOOS = linux build_win: GOOS = windows +build_mac_amd64: GOOS = darwin -build_linux build_win: +build_mac_arm64: GOARCH = arm64 +build_mac_arm64: GOOS = darwin + +build_linux build_win build_mac_amd64 build_mac_arm64: $(eval BINDIR = bin-$(GOOS)-$(GOARCH)/ ) $(MKDIR) $(BINDIR) env GOARCH=$(GOARCH) GOOS=$(GOOS) $(BUILD) -o $(BINDIR) $(LDFLAGS) -v ./cmd/... DISTDIR := csaf_distribution-$(SEMVER) -dist: build_linux build_win +dist: build_linux build_win build_mac_amd64 build_mac_arm64 mkdir -p dist mkdir -p dist/$(DISTDIR)-windows-amd64/bin-windows-amd64 cp README.md dist/$(DISTDIR)-windows-amd64 diff --git a/README.md b/README.md index 6003f702..5c1a8a73 100644 --- a/README.md +++ b/README.md @@ -47,9 +47,11 @@ Download the binaries from the most recent release assets on Github. - Build Go components Makefile supplies the following targets: - Build For GNU/Linux System: `make build_linux` - - Build For Windows System (cross build): `make build_win` - - Build For both linux and windows: `make build` - - Build from a specific github tag by passing the intended tag to the `BUILDTAG` variable. + - Build For Windows System (cross build): `make build_win` + - Build For macOS on Intel Processor (AMD64) (cross build): `make build_mac_amd64` + - Build For macOS on Apple Silicon (ARM64) (cross build): `make build_mac_arm64` + - Build For Linux, Mac and Windows: `make build` + - Build from a specific GitHub tag by passing the intended tag to the `BUILDTAG` variable. E.g. `make BUILDTAG=v1.0.0 build` or `make BUILDTAG=1 build_linux`. The special value `1` means checking out the highest github tag for the build. - Remove the generated binaries und their directories: `make mostlyclean` From e354e4b20102f2538c004fb6b31d8f305ff110ae Mon Sep 17 00:00:00 2001 From: Bernhard Reiter Date: Fri, 13 Oct 2023 17:21:25 +0200 Subject: [PATCH 2/4] docs: add note about support level of MacOS builds --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 5c1a8a73..63774887 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,12 @@ They are likely to run on similar systems when build from sources. The windows binary package only includes `csaf_downloader`, `csaf_validator`, `csaf_checker` and `csaf_uploader`. +The MacOS binary archives come with the same set of client tools +and are _community supported_. Which means: +while they are expected to run fine, +they are not at the same level of testing and maintenance +as the Windows and GNU/Linux binaries. + ### Prebuild binaries From 1e506d46cc7e03d61d499762e9154b2215a29fe3 Mon Sep 17 00:00:00 2001 From: Bernhard Reiter Date: Fri, 13 Oct 2023 17:52:14 +0200 Subject: [PATCH 3/4] feat: add macos binaries archive to Makefile --- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile b/Makefile index 154b24d1..19e31c7a 100644 --- a/Makefile +++ b/Makefile @@ -89,10 +89,19 @@ dist: build_linux build_win build_mac_amd64 build_mac_arm64 mkdir -p dist/$(DISTDIR)-windows-amd64/docs cp docs/csaf_uploader.md docs/csaf_validator.md docs/csaf_checker.md \ docs/csaf_downloader.md dist/$(DISTDIR)-windows-amd64/docs + mkdir -p dist/$(DISTDIR)-macos/bin-darwin-amd64 \ + dist/$(DISTDIR)-macos/bin-darwin-arm64 \ + dist/$(DISTDIR)-macos/docs + for f in csaf_downloader csaf_checker csaf_validator csaf_uploader ; do \ + cp bin-darwin-amd64/$$f dist/$(DISTDIR)-macos/bin-darwin-amd64 ; \ + cp bin-darwin-arm64/$$f dist/$(DISTDIR)-macos/bin-darwin-arm64 ; \ + cp docs/$${f}.md dist/$(DISTDIR)-macos/docs ; \ + done mkdir dist/$(DISTDIR)-gnulinux-amd64 cp -r README.md docs bin-linux-amd64 dist/$(DISTDIR)-gnulinux-amd64 cd dist/ ; zip -r $(DISTDIR)-windows-amd64.zip $(DISTDIR)-windows-amd64/ cd dist/ ; tar -cvmlzf $(DISTDIR)-gnulinux-amd64.tar.gz $(DISTDIR)-gnulinux-amd64/ + cd dist/ ; tar -cvmlzf $(DISTDIR)-macos.tar.gz $(DISTDIR)-macos # Remove bin-*-* and dist directories mostlyclean: From 1579065453c2838035e1a782c024f2884d7743ca Mon Sep 17 00:00:00 2001 From: Bernhard Reiter Date: Wed, 8 Nov 2023 09:39:02 +0100 Subject: [PATCH 4/4] docs: be more consistent with names --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 63774887..dcb5df65 100644 --- a/README.md +++ b/README.md @@ -52,14 +52,14 @@ Download the binaries from the most recent release assets on Github. - Clone the repository `git clone https://github.com/csaf-poc/csaf_distribution.git ` - Build Go components Makefile supplies the following targets: - - Build For GNU/Linux System: `make build_linux` - - Build For Windows System (cross build): `make build_win` - - Build For macOS on Intel Processor (AMD64) (cross build): `make build_mac_amd64` - - Build For macOS on Apple Silicon (ARM64) (cross build): `make build_mac_arm64` - - Build For Linux, Mac and Windows: `make build` - - Build from a specific GitHub tag by passing the intended tag to the `BUILDTAG` variable. + - Build for GNU/Linux system: `make build_linux` + - Build for Windows system (cross build): `make build_win` + - Build for macOS system on Intel Processor (AMD64) (cross build): `make build_mac_amd64` + - Build for macOS system on Apple Silicon (ARM64) (cross build): `make build_mac_arm64` + - Build For GNU/Linux, macOS and Windows: `make build` + - Build from a specific git tag by passing the intended tag to the `BUILDTAG` variable. E.g. `make BUILDTAG=v1.0.0 build` or `make BUILDTAG=1 build_linux`. - The special value `1` means checking out the highest github tag for the build. + The special value `1` means checking out the highest git tag for the build. - Remove the generated binaries und their directories: `make mostlyclean` Binaries will be placed in directories named like `bin-linux-amd64/` and `bin-windows-amd64/`.