[openwrt/openwrt] build: add HOST_OS_LINUX and HOST_OS_MACOS config symbols

LEDE Commits lede-commits at lists.infradead.org
Mon Nov 1 08:40:15 PDT 2021


nbd pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/2d5b83197a2035b95efdd954f086f099b67ae139

commit 2d5b83197a2035b95efdd954f086f099b67ae139
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Wed Oct 27 11:47:52 2021 +0200

    build: add HOST_OS_LINUX and HOST_OS_MACOS config symbols
    
    This can be used to simplify host os tests in various places
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 Config.in             | 8 ++++++++
 config/check-uname.sh | 1 +
 2 files changed, 9 insertions(+)

diff --git a/Config.in b/Config.in
index 546e8249cc..65b6dd86aa 100644
--- a/Config.in
+++ b/Config.in
@@ -13,6 +13,14 @@ config HAVE_DOT_CONFIG
 	bool
 	default y
 
+HOST_OS := $(shell, uname)
+
+config HOST_OS_LINUX
+	def_bool $(shell, ./config/check-uname.sh Linux)
+
+config HOST_OS_MACOS
+	def_bool $(shell, ./config/check-uname.sh Darwin)
+
 source "target/Config.in"
 
 source "config/Config-images.in"
diff --git a/config/check-uname.sh b/config/check-uname.sh
new file mode 100755
index 0000000000..1f1bf9ee07
--- /dev/null
+++ b/config/check-uname.sh
@@ -0,0 +1 @@
+[ "$(uname)" = "$1" ] && echo y || echo n



More information about the lede-commits mailing list