@@ -29,11 +29,6 @@ ifndef goroot
2929$(error could not determine GOROOT)
3030endif
3131
32- # Ensure POSIX-style GOROOT even in Windows, to support PATH updates in bash.
33- ifdef COMSPEC
34- goroot := $(shell cygpath $(goroot ) )
35- endif
36-
3732# We must ensure `go` executes with GOROOT and PATH variables exported:
3833# * GOROOT ensures versions don't conflict with /usr/local/go or c:\Go
3934# * PATH ensures tools like golint can fork and execute the correct go binary.
@@ -94,9 +89,7 @@ e2e: $(E2E_FUNC_E_PATH)/func-e$(goexe) ## Run all end-to-end tests
9489 @printf " $( ansi_format_bright) " e2e " ok"
9590
9691linux_platforms := linux_amd64 linux_arm64
97- non_windows_platforms := darwin_amd64 darwin_arm64 $(linux_platforms )
98- # TODO: arm64 on Windows https://github.com/envoyproxy/envoy/issues/17572
99- windows_platforms := windows_amd64
92+ all_platforms := darwin_amd64 darwin_arm64 $(linux_platforms )
10093
10194# Make 3.81 doesn't support '**' globbing: Set explicitly instead of recursion.
10295all_sources := $(wildcard * .go * /* .go * /* /* .go * /* /* /* .go * /* /* /* .go * /* /* /* /* .go)
@@ -117,11 +110,6 @@ dist/func-e_$(VERSION)_%.tar.gz: build/func-e_%/func-e
117110 @tar -C $(<D ) -cpzf $@ $(<F )
118111 @printf " $( ansi_format_bright) " tar.gz " ok"
119112
120- build/func-e_% /func-e.exe : $(main_sources )
121- ifeq ($(OS ) ,Windows_NT)
122- $(call go-build,$@,$<)
123- endif
124-
125113dist/func-e_$(VERSION ) _% .zip : build/func-e_% /func-e.exe.signed
126114 @printf " $( ansi_format_dark) " zip " zipping $@ "
127115 @mkdir -p $(@D )
@@ -161,34 +149,21 @@ msi-arch = $(if $(findstring amd64,$1),x64,arm64)
161149# Default to a dummy version, which is always lower than a real release
162150msi_version := $(VERSION:dev=0.0.1 )
163151
164- # This builds the Windows installer (MSI) using platform-dependent WIX commands.
165- dist/func-e_$(VERSION ) _% .msi : build/func-e_% /func-e.exe.signed
166- ifeq ($(OS ) ,Windows_NT) # Windows 10 etc use https ://wixtoolset.org
167- @printf " $( ansi_format_dark) " msi " building $@ "
168- @mkdir -p $(@D )
169- @candle -nologo -arch $(call msi-arch,$@ ) -dVersion=$(msi_version ) -dBin=$(<:.signed= ) packaging/msi/func-e.wxs
170- @light -nologo func-e.wixobj -o $@ -spdb
171- @rm func-e.wixobj
172- $(call codesign,$@ )
173- @printf " $( ansi_format_bright) " msi " ok"
174- endif
175-
176- # Archives are tar.gz, except in the case of Windows, which uses zip.
177- non_windows_archives := $(non_windows_platforms:%=dist/func-e_$(VERSION ) _%.tar.gz )
178- windows_archives := $(windows_platforms:%=dist/func-e_$(VERSION ) _%.zip ) $(windows_platforms:%=dist/func-e_$(VERSION ) _%.msi )
179- archives := $(non_windows_platforms:%=dist/func-e_$(VERSION ) _%.tar.gz ) $(windows_platforms:%=dist/func-e_$(VERSION ) _%.zip )
152+ # Archives are tar.gz,
153+ all_archives := $(all_platforms:%=dist/func-e_$(VERSION ) _%.tar.gz )
154+ archives := $(all_platforms:%=dist/func-e_$(VERSION ) _%.tar.gz )
180155checksums := dist/func-e_$(VERSION ) _checksums.txt
181156
182157# Darwin doesn't have sha256sum. See https://github.com/actions/virtual-environments/issues/90
183158sha256sum := $(if $(findstring darwin,$(goos ) ) ,shasum -a 256,sha256sum)
184- $(checksums ) : $(non_windows_archives ) $( if $( findstring Windows_NT, $( OS ) ) , $( windows_archives ) , )
159+ $(checksums ) : $(all_archives )
185160 @printf " $( ansi_format_dark) " sha256sum " generating $@ "
186161 @$(sha256sum ) $^ > $@
187162 @printf " $( ansi_format_bright) " sha256sum " ok"
188163
189164# dist generates the assets that attach to a release
190165# Ex. https://github.com/tetratelabs/func-e/releases/tag/v$(VERSION)
191- dist : $(non_windows_archives ) $( if $( findstring Windows_NT, $( OS ) ) , $( windows_archives ) , ) $(checksums ) # # Generate release assets
166+ dist : $(all_archives ) $(checksums ) # # Generate release assets
192167
193168clean : # # Ensure a clean build
194169 @printf " $( ansi_format_dark) " clean " deleting temporary files"
@@ -241,14 +216,9 @@ site: ## Serve website content
241216 @git submodule update
242217 @cd site && $(go ) run $(hugo ) server --minify --disableFastRender --baseURL localhost:1313 --cleanDestinationDir -D
243218
244- # this makes a marker file ending in .signed to avoid repeatedly calling codesign
245- % .signed : %
246- $(call codesign,$< )
247- @touch $@
248-
249219# define macros for multi-platform builds. these parse the filename being built
250220go-arch = $(if $(findstring amd64,$1) ,amd64,arm64)
251- go-os = $(if $(findstring .exe,$1) ,windows, $( if $( findstring linux,$1) ,linux,darwin) )
221+ go-os = $(if $(findstring linux,$1) ,linux,darwin)
252222define go-build
253223 @printf "$(ansi_format_dark ) " build "building $1"
254224 @# $(go:go=) removes the trailing 'go', so we can insert cross-build variables
@@ -264,23 +234,3 @@ define nfpm-pkg
264234 @$(go ) run $(nfpm ) pkg -f $1 --packager $2 --target $3
265235 @printf "$(ansi_format_bright ) " nfpm "ok"
266236endef
267-
268- # This requires osslsigncode package (apt or brew) or latest windows release from mtrojnar/osslsigncode
269- #
270- # Default is self-signed while production should be a Digicert signing key
271- #
272- # Ex.
273- # ```bash
274- # keytool -genkey -alias func-e -storetype PKCS12 -keyalg RSA -keysize 2048 -storepass func-e-bunch \
275- # -keystore func-e.p12 -dname "O=func-e,CN=func-e.io" -validity 3650
276- # ```
277- WINDOWS_CODESIGN_P12 ?= packaging/msi/func-e.p12
278- WINDOWS_CODESIGN_PASSWORD ?= func-e-bunch
279- define codesign
280- @printf "$(ansi_format_dark ) " codesign "signing $1"
281- @osslsigncode sign -h sha256 -pkcs12 ${WINDOWS_CODESIGN_P12} -pass "${WINDOWS_CODESIGN_PASSWORD}" \
282- -n "func-e makes running Envoy® easy" -i https://func-e.io -t http://timestamp.digicert.com \
283- $(if $(findstring msi,$(1 ) ) ,-add-msi-dse) -in $1 -out $1-signed
284- @mv $1-signed $1
285- @printf "$(ansi_format_bright ) " codesign "ok"
286- endef
0 commit comments