Skip to content

Commit f6cd5f8

Browse files
committed
build: fix default flags for Apple clang
Change-Id: I5168e4b56e6ce0a6dde8672a8e9cd47c16905184
1 parent ba13623 commit f6cd5f8

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

.jenkins

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ case $(uname) in
1010
fi
1111
export ID VERSION_ID
1212
export ID_LIKE="${ID} ${ID_LIKE} linux"
13-
export PATH="${HOME}/.local/bin${PATH:+:}${PATH}"
13+
if [[ -z $GITHUB_ACTIONS ]]; then
14+
export PATH="${HOME}/.local/bin${PATH:+:}${PATH}"
15+
fi
1416
;;
1517
Darwin)
1618
# Emulate a subset of os-release(5)
1719
export ID=macos
1820
export VERSION_ID=$(sw_vers -productVersion)
19-
export PATH="/usr/local/bin${PATH:+:}${PATH}"
21+
if [[ -z $GITHUB_ACTIONS ]]; then
22+
export PATH="/usr/local/bin${PATH:+:}${PATH}"
23+
fi
2024
if [[ -x /opt/homebrew/bin/brew ]]; then
2125
eval "$(/opt/homebrew/bin/brew shellenv)"
2226
elif [[ -x /usr/local/bin/brew ]]; then
@@ -27,9 +31,9 @@ esac
2731

2832
export CACHE_DIR=${CACHE_DIR:-/tmp}
2933

30-
if [[ $JOB_NAME == *"code-coverage" ]]; then
31-
export DISABLE_ASAN=yes
32-
export DISABLE_HEADERS_CHECK=yes
34+
if [[ $JOB_NAME == *code-coverage ]]; then
35+
export DISABLE_ASAN=1
36+
export DISABLE_HEADERS_CHECK=1
3337
fi
3438

3539
# https://reproducible-builds.org/docs/source-date-epoch/

.jenkins.d/00-deps.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ FORMULAE=(boost openssl pkgconf)
3232
set -x
3333

3434
if [[ $ID == macos ]]; then
35+
export HOMEBREW_COLOR=1
3536
export HOMEBREW_NO_ENV_HINTS=1
3637
if [[ -n $GITHUB_ACTIONS ]]; then
3738
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1

.waf-tools/default-compiler-flags.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,13 @@ def getGeneralFlags(self, conf):
224224
['-isystem', f'{brewdir}/include'], # for Homebrew
225225
['-isystem', '/opt/local/include'], # for MacPorts
226226
]
227-
elif Utils.unversioned_sys_platform() == 'freebsd':
228-
# Bug #4790
229-
flags['CXXFLAGS'] += [['-isystem', '/usr/local/include']]
230-
if get_compiler_ver(conf) >= (18, 0, 0) and get_compiler_ver(conf) < (20, 1, 0):
231-
# Bug #5300
232-
flags['CXXFLAGS'] += ['-Wno-enum-constexpr-conversion']
227+
else:
228+
if Utils.unversioned_sys_platform() == 'freebsd':
229+
# Bug #4790
230+
flags['CXXFLAGS'] += [['-isystem', '/usr/local/include']]
231+
if get_compiler_ver(conf) >= (18, 0, 0) and get_compiler_ver(conf) < (20, 1, 0):
232+
# Bug #5300
233+
flags['CXXFLAGS'] += ['-Wno-enum-constexpr-conversion']
233234
return flags
234235

235236
__cxxFlags = [
@@ -240,11 +241,13 @@ def getGeneralFlags(self, conf):
240241
def getDebugFlags(self, conf):
241242
flags = super().getDebugFlags(conf)
242243
flags['CXXFLAGS'] += self.__cxxFlags
244+
ccver = get_compiler_ver(conf)
245+
darwin = Utils.unversioned_sys_platform() == 'darwin'
243246
# Enable assertions in libc++
244-
if get_compiler_ver(conf) >= (18, 0, 0):
247+
if (darwin and ccver >= (17, 0, 0)) or (not darwin and ccver >= (18, 0, 0)):
245248
# https://libcxx.llvm.org/Hardening.html
246249
flags['DEFINES'] += ['_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE']
247-
elif get_compiler_ver(conf) >= (15, 0, 0):
250+
elif ccver >= (15, 0, 0):
248251
# https://releases.llvm.org/15.0.0/projects/libcxx/docs/UsingLibcxx.html#enabling-the-safe-libc-mode
249252
flags['DEFINES'] += ['_LIBCPP_ENABLE_ASSERTIONS=1']
250253
# Tell libc++ to avoid including transitive headers

0 commit comments

Comments
 (0)