build: fix default flags for Apple clang

Change-Id: I5168e4b56e6ce0a6dde8672a8e9cd47c16905184
diff --git a/.jenkins b/.jenkins
index 92b9dae..1fa2f02 100755
--- a/.jenkins
+++ b/.jenkins
@@ -10,13 +10,17 @@
         fi
         export ID VERSION_ID
         export ID_LIKE="${ID} ${ID_LIKE} linux"
-        export PATH="${HOME}/.local/bin${PATH:+:}${PATH}"
+        if [[ -z $GITHUB_ACTIONS ]]; then
+            export PATH="${HOME}/.local/bin${PATH:+:}${PATH}"
+        fi
         ;;
     Darwin)
         # Emulate a subset of os-release(5)
         export ID=macos
         export VERSION_ID=$(sw_vers -productVersion)
-        export PATH="/usr/local/bin${PATH:+:}${PATH}"
+        if [[ -z $GITHUB_ACTIONS ]]; then
+            export PATH="/usr/local/bin${PATH:+:}${PATH}"
+        fi
         if [[ -x /opt/homebrew/bin/brew ]]; then
             eval "$(/opt/homebrew/bin/brew shellenv)"
         elif [[ -x /usr/local/bin/brew ]]; then
@@ -27,9 +31,9 @@
 
 export CACHE_DIR=${CACHE_DIR:-/tmp}
 
-if [[ $JOB_NAME == *"code-coverage" ]]; then
-    export DISABLE_ASAN=yes
-    export DISABLE_HEADERS_CHECK=yes
+if [[ $JOB_NAME == *code-coverage ]]; then
+    export DISABLE_ASAN=1
+    export DISABLE_HEADERS_CHECK=1
 fi
 
 # https://reproducible-builds.org/docs/source-date-epoch/
diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh
index 7ed8a10..6f1f81d 100755
--- a/.jenkins.d/00-deps.sh
+++ b/.jenkins.d/00-deps.sh
@@ -32,6 +32,7 @@
 set -x
 
 if [[ $ID == macos ]]; then
+    export HOMEBREW_COLOR=1
     export HOMEBREW_NO_ENV_HINTS=1
     if [[ -n $GITHUB_ACTIONS ]]; then
         export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index 48a8874..ac5cdfd 100644
--- a/.waf-tools/default-compiler-flags.py
+++ b/.waf-tools/default-compiler-flags.py
@@ -224,12 +224,13 @@
                 ['-isystem', f'{brewdir}/include'], # for Homebrew
                 ['-isystem', '/opt/local/include'], # for MacPorts
             ]
-        elif Utils.unversioned_sys_platform() == 'freebsd':
-            # Bug #4790
-            flags['CXXFLAGS'] += [['-isystem', '/usr/local/include']]
-        if get_compiler_ver(conf) >= (18, 0, 0) and get_compiler_ver(conf) < (20, 1, 0):
-            # Bug #5300
-            flags['CXXFLAGS'] += ['-Wno-enum-constexpr-conversion']
+        else:
+            if Utils.unversioned_sys_platform() == 'freebsd':
+                # Bug #4790
+                flags['CXXFLAGS'] += [['-isystem', '/usr/local/include']]
+            if get_compiler_ver(conf) >= (18, 0, 0) and get_compiler_ver(conf) < (20, 1, 0):
+                # Bug #5300
+                flags['CXXFLAGS'] += ['-Wno-enum-constexpr-conversion']
         return flags
 
     __cxxFlags = [
@@ -240,11 +241,13 @@
     def getDebugFlags(self, conf):
         flags = super().getDebugFlags(conf)
         flags['CXXFLAGS'] += self.__cxxFlags
+        ccver = get_compiler_ver(conf)
+        darwin = Utils.unversioned_sys_platform() == 'darwin'
         # Enable assertions in libc++
-        if get_compiler_ver(conf) >= (18, 0, 0):
+        if (darwin and ccver >= (17, 0, 0)) or (not darwin and ccver >= (18, 0, 0)):
             # https://libcxx.llvm.org/Hardening.html
             flags['DEFINES'] += ['_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE']
-        elif get_compiler_ver(conf) >= (15, 0, 0):
+        elif ccver >= (15, 0, 0):
             # https://releases.llvm.org/15.0.0/projects/libcxx/docs/UsingLibcxx.html#enabling-the-safe-libc-mode
             flags['DEFINES'] += ['_LIBCPP_ENABLE_ASSERTIONS=1']
         # Tell libc++ to avoid including transitive headers