@@ -116,31 +116,29 @@ dist/func-e_$(VERSION)_%.zip: build/func-e_%/func-e.exe.signed
116116 @printf " $( ansi_format_bright) " zip " ok"
117117
118118# Default to a dummy version, which is always lower than a real release
119- nfpm_version= v$(VERSION:dev =0.0.1)
119+ pkg_version := v$(VERSION:dev=0.0.1 )
120120
121- # It is not precise to put the func-e binary here, but it is easier because the arch pattern matches
122- # whereas in RPM it won't.
123- # Note: we are only generating this because the file isn't parameterized.
124- # See https://github.com/goreleaser/nfpm/issues/362
125- build/func-e_linux_% /nfpm.yaml : packaging/nfpm/nfpm.yaml build/func-e_linux_% /func-e
126- @mkdir -p $(@D )
127- @sed -e ' s/amd64/$(*)/g' -e ' s/v0.0.1/$(nfpm_version)/g' $< > $@
121+ pkg_config := packaging/nfpm/nfpm.yaml
128122
129123# We can't use a pattern (%) rule because in RPM amd64 -> x86_64, arm64 -> aarch64
130124rpm_x86_64 := dist/func-e_$(VERSION ) _linux_x86_64.rpm
131125rpm_aarch64 := dist/func-e_$(VERSION ) _linux_aarch64.rpm
132126rpms := $(rpm_x86_64 ) $(rpm_aarch64 )
133127
134128man_page := packaging/nfpm/func-e.8
129+ pkg_inputs := $(pkg_config ) $(man_page )
130+
131+ pkg_binary = build/func-e_linux_$1/func-e
132+ pkg_arch = $(patsubst build/func-e_linux_% /func-e,% ,$1)
135133
136- $(rpm_x86_64 ) : build/func-e_linux_amd64/nfpm.yaml $( man_page )
134+ $(rpm_x86_64 ) : $( call pkg_binary,amd64) $( pkg_inputs )
137135 $(call nfpm-pkg,$< ,"rpm",$@ )
138136
139- $(rpm_aarch64 ) : build/func-e_linux_arm64/nfpm.yaml $( man_page )
137+ $(rpm_aarch64 ) : $( call pkg_binary,arm64) $( pkg_inputs )
140138 $(call nfpm-pkg,$< ,"rpm",$@ )
141139
142140# Debian architectures map goarch for amd64 and arm64
143- dist/func-e_$(VERSION ) _linux_% .deb : build/func-e_linux_ % /nfpm.yaml $(man_page )
141+ dist/func-e_$(VERSION ) _linux_% .deb : $( call pkg_binary, % ) $(pkg_inputs )
144142 $(call nfpm-pkg,$< ,"deb",$@ )
145143
146144# msi-arch is a macro so we can detect it based on the file naming convention
@@ -226,6 +224,6 @@ endef
226224define nfpm-pkg
227225 @printf "$(ansi_format_dark ) " nfpm "packaging $3"
228226 @mkdir -p $(dir $3)
229- @$( gotool ) nfpm pkg -f $1 --packager $2 --target $3
227+ @PKG_ARCH= $( call pkg_arch,$1) PKG_VERSION= $( pkg_version ) $( gotool ) nfpm pkg -f $( pkg_config ) --packager $2 --target $3
230228 @printf "$(ansi_format_bright ) " nfpm "ok"
231229endef
0 commit comments