prereq-build: add check for true and false
authorMichael Pratt <mcpratt@pm.me>
Thu, 20 Apr 2023 16:31:16 +0000 (12:31 -0400)
committerChristian Marangi <ansuelsmth@gmail.com>
Thu, 4 May 2023 04:07:23 +0000 (06:07 +0200)
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 <mcpratt@pm.me>
include/prereq-build.mk
rules.mk

index 8fae92ab977087f38f9bac051d57e49c8bc1163b..14a221088050f53dd11127d1101a485d148bfe09 100644 (file)
@@ -8,6 +8,13 @@ include $(INCLUDE_DIR)/prereq.mk
 SHELL:=sh
 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
 $(eval $(call TestHostCommand,working-make, \
index 57d7995d4fa8feecba752b92b32cf00091486e12..cc7904ac728f5fd400004848cf6cbc56da3c6448 100644 (file)
--- a/rules.mk
+++ b/rules.mk
@@ -268,6 +268,14 @@ FIND:=find
 PATCH:=patch
 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_SUID:=install -m4755
 INSTALL_DIR:=install -d -m0755