瀏覽代碼

prereq-build: add check for true and false

Some uses cases, like with autotools, need a path for 'true'
if we use them to force something to skip.

This will work by default on Linux hosts,
and require MacOS hosts to get coreutils,
which is currently installed in the CI
for 'macos-latest' host.

In the future, prereq stage can be reworked
to search for the actual binary
instead of relying on env.

Signed-off-by: Michael Pratt <[email protected]>
Michael Pratt 2 年之前
父節點
當前提交
ffd7c05aa7
共有 2 個文件被更改,包括 15 次插入0 次删除
  1. 7 0
      include/prereq-build.mk
  2. 8 0
      rules.mk

+ 7 - 0
include/prereq-build.mk

@@ -8,6 +8,13 @@ include $(INCLUDE_DIR)/prereq.mk
 SHELL:=sh
 SHELL:=sh
 PKG_NAME:=Build dependency
 PKG_NAME:=Build dependency
 
 
+$(eval $(call TestHostCommand,true, \
+	Please install GNU 'coreutils', \
+	$(TRUE)))
+
+$(eval $(call TestHostCommand,false, \
+	Please install GNU 'coreutils', \
+	$(FALSE); [ $$$$$$$$? = 1 ] && $(TRUE)))
 
 
 # Required for the toolchain
 # Required for the toolchain
 $(eval $(call TestHostCommand,working-make, \
 $(eval $(call TestHostCommand,working-make, \

+ 8 - 0
rules.mk

@@ -268,6 +268,14 @@ FIND:=find
 PATCH:=patch
 PATCH:=patch
 PYTHON:=python3
 PYTHON:=python3
 
 
+ifeq ($(HOST_OS),Darwin)
+  TRUE:=/usr/bin/env gtrue
+  FALSE:=/usr/bin/env gfalse
+else
+  TRUE:=/usr/bin/env true
+  FALSE:=/usr/bin/env false
+endif
+
 INSTALL_BIN:=install -m0755
 INSTALL_BIN:=install -m0755
 INSTALL_SUID:=install -m4755
 INSTALL_SUID:=install -m4755
 INSTALL_DIR:=install -d -m0755
 INSTALL_DIR:=install -d -m0755