fix: avoid shell variables in Build/Compile dwarves step

The package build expands Build/Compile twice, so shell variables
written as double-dollar did not survive: the CI log shows the
executed recipe with MAKE_BIN (from $$CMAKE_BIN), ATH (from
$$PATH) and an empty -j (from $$(nproc)) — 'MAKE_BIN: command
not found', Error 127.

Drop shell variables entirely: pick cmake with a make-time wildcard
test, expand PATH with $(PATH) and the job count with
$(shell nproc) — all resolve to literals on the first expansion,
so the second expansion cannot mangle them. Verified locally with a
double-expansion test on the real define block (output identical
after two expansions, cmake path and -j number intact).
This commit is contained in:
kenzok8 authored and 有種 committed 2026-11-07 04:43:56 +08:00
1 parent 0b6ade3e85
commit 7fa8cdbe30
1 file changed
+5 -6
+5 -6
View File
@@ -67,7 +67,8 @@ define Build/Compile
# 部分 SDK 镜像里没有 pahole(armv7 imx 等目标默认不开 BTF),这里直接从
# dwarves 源码现编一个装到 staging host 目录;版本与哈希同上游 tools/dwarves
# 保持一致,已装好就跳过。注意:SDK 的 tools/dwarves 编译目标在实测里不可用,
# 不要改回那条路。
# 不要改回那条路。另外这段 recipe 会被 make 展开两次,shell 变量写了也活不下来,
# 所以只用 make 变量写死路径与并行数,不要用双美元转义。
if [ -x "$(STAGING_DIR_HOST)/bin/pahole" ]; then \
echo "pahole already present, skipping dwarves build"; \
else \
@@ -78,12 +79,10 @@ define Build/Compile
rm -rf $(PKG_BUILD_DIR)/dwarves-build; \
mkdir -p $(PKG_BUILD_DIR)/dwarves-build; \
tar -xjf "$(DL_DIR)/dwarves-1.28.tar.bz2" -C $(PKG_BUILD_DIR)/dwarves-build --strip-components=1; \
CMAKE_BIN="$(STAGING_DIR_HOST)/bin/cmake"; \
[ -x "$$CMAKE_BIN" ] || CMAKE_BIN=cmake; \
cd $(PKG_BUILD_DIR)/dwarves-build && \
PATH="$(STAGING_DIR_HOST)/bin:$$PATH" \
PATH="$(STAGING_DIR_HOST)/bin:$(PATH)" \
PKG_CONFIG_PATH="$(STAGING_DIR_HOST)/lib/pkgconfig" \
"$$CMAKE_BIN" \
$(if $(wildcard $(STAGING_DIR_HOST)/bin/cmake),$(STAGING_DIR_HOST)/bin/cmake,cmake) \
-DCMAKE_INSTALL_PREFIX="$(STAGING_DIR_HOST)" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_FIND_ROOT_PATH="$(STAGING_DIR_HOST)" \
@@ -91,7 +90,7 @@ define Build/Compile
-D__LIB=lib \
-DCMAKE_INSTALL_RPATH="$(STAGING_DIR_HOST)/lib" \
-DCMAKE_SKIP_RPATH=FALSE . && \
$(MAKE) -j$$(nproc) && \
$(MAKE) -j$(shell nproc) && \
$(MAKE) install; \
fi