Makefile: dpkg-architecture -c to set env and exec in one shot
Some checks failed
Forgejo Release postit-deb / release (push) Failing after 2m5s
Some checks failed
Forgejo Release postit-deb / release (push) Failing after 2m5s
dpkg-architecture -aarm64 sets DEB_HOST_ARCH=arm64 but does not propagate the env to the calling shell. The 'eval $(dpkg-architecture $DPKG_ARCH_ARGS)' pattern tried to bridge that but failed: the command substitution was parsed by make before bash ever ran, with $DPKG_ARCH_ARGS still empty at make parse time. dpkg-architecture's -c flag runs a command with the proper env set up: 'dpkg-architecture -aarm64 -c "..."' exports all the DEB_* vars and then execs the command, all in one process. The 'CC system type mismatch' warning on stderr is informational (it complains that the C compiler isn't cross, but we don't compile C — we only cross-publish .NET binaries). Verified locally: 'dpkg-architecture -aarm64 -c "echo \$DEB_HOST_ARCH"' prints 'arm64'.
This commit is contained in:
parent
99bdf0923f
commit
9898edeb30
1 changed files with 6 additions and 1 deletions
7
Makefile
7
Makefile
|
|
@ -54,7 +54,12 @@ deb:
|
||||||
# vars set by dpkg-architecture are visible to dpkg-buildpackage.
|
# vars set by dpkg-architecture are visible to dpkg-buildpackage.
|
||||||
# make runs each recipe line in its own shell, so we use
|
# make runs each recipe line in its own shell, so we use
|
||||||
# backslash continuation to glue everything together.
|
# 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-architecture -c <cmd> sets up DEB_* vars and runs <cmd>
|
||||||
|
# in the same shell, so the env is visible to dpkg-buildpackage.
|
||||||
|
# Use -a (host arch) for cross-builds — it tells dpkg-architecture
|
||||||
|
# to export DEB_HOST_ARCH=arm64 (and friends) even though we're
|
||||||
|
# running on amd64. -c avoids the need for a separate eval.
|
||||||
|
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 $$DPKG_ARCH_ARGS -c "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
|
# dpkg-buildpackage already writes the produced .deb to
|
||||||
# /src/_src/../ = $POSTIT_OUT_DIR (its default — there's no
|
# /src/_src/../ = $POSTIT_OUT_DIR (its default — there's no
|
||||||
# flag to change it). So no 'mv' is needed. The old 'mv'
|
# flag to change it). So no 'mv' is needed. The old 'mv'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue