From 543f68c7b9e54248bea74c6a2d8d2f47eec0065c Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Mon, 17 Aug 2026 18:12:09 +0100 Subject: [PATCH] Makefile: glue DPKG_ARCH_ARGS, eval, dpkg-buildpackage on one line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous version put DPKG_ARCH_ARGS on its own logical line and 'eval ... && dpkg-buildpackage' on the next, but each make recipe line runs in its own shell. So when 'eval' ran, the $DPKG_ARCH_ARGS variable from the previous shell was already gone — 'eval' saw an empty argument and produced no DEB_HOST_ARCH override, which made dpkg-buildpackage default to amd64. Collapse everything onto one logical line (one shell invocation), joining with '&&' so a failure in 'case' or 'dpkg-architecture' short-circuits before dpkg-buildpackage runs. --- Makefile | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 8217d8e..a40f959 100644 --- a/Makefile +++ b/Makefile @@ -49,18 +49,12 @@ deb: # For linux-x64, it sets the host arch to amd64 explicitly # (which matches the runner — no-op, but keeps the call site # uniform). Other RIDs are rejected. - DPKG_ARCH_ARGS=$$(case "$(POSTIT_RUNTIME)" in linux-arm64) echo "-aarm64" ;; linux-x64) echo "-aamd64" ;; *) echo "unsupported POSTIT_RUNTIME=$(POSTIT_RUNTIME)" >&2; exit 1 ;; esac) - # dpkg-architecture with no -t/-a flags just prints the arch - # info; with -aarm64, it exports the variables needed for a - # cross-build targeting arm64. Use 'eval' to put those vars - # in the environment of the next command. - # Chain 'eval' and 'dpkg-buildpackage' on a single shell line - # so the exported vars from dpkg-architecture are visible - # to dpkg-buildpackage. Each recipe line runs in its own - # shell, so an 'eval' on one line wouldn't affect the next. - eval $(dpkg-architecture $$DPKG_ARCH_ARGS) && \ - POSTIT_GIT_URL=$(POSTIT_GIT_URL) POSTIT_GIT_TAG=$(POSTIT_GIT_TAG) POSTIT_RUNTIME=$(POSTIT_RUNTIME) \ - dpkg-buildpackage -us -uc -b + # Compute DPKG_ARCH_ARGS, eval dpkg-architecture, then call + # dpkg-buildpackage — all in ONE shell invocation so the + # vars set by dpkg-architecture are visible to dpkg-buildpackage. + # make runs each recipe line in its own shell, so we use + # backslash continuation to glue everything together. + DPKG_ARCH_ARGS=$$(case "$(POSTIT_RUNTIME)" in linux-arm64) echo "-aarm64" ;; linux-x64) echo "-aamd64" ;; *) echo "unsupported POSTIT_RUNTIME=$(POSTIT_RUNTIME)" >&2; exit 1 ;; esac) && eval $(dpkg-architecture $$DPKG_ARCH_ARGS) && POSTIT_GIT_URL=$(POSTIT_GIT_URL) POSTIT_GIT_TAG=$(POSTIT_GIT_TAG) POSTIT_RUNTIME=$(POSTIT_RUNTIME) dpkg-buildpackage -us -uc -b # dpkg-buildpackage already writes the produced .deb to # /src/_src/../ = $POSTIT_OUT_DIR (its default — there's no # flag to change it). So no 'mv' is needed. The old 'mv'