Skip to content

Commit ae36fea

Browse files
committed
unix: globally add some CFLAGS on macOS
This will suppress some very chatty compiler warnings we see with LLVM 10. Doing this globally is much simpler than handling it in every build script.
1 parent 7d9ef94 commit ae36fea

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

cpython-unix/build-cpython.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,14 @@ mv tmp Modules/readline-libedit.c
205205

206206
# Most bits look at CFLAGS. But setup.py only looks at CPPFLAGS.
207207
# So we need to set both.
208-
CFLAGS="-fPIC -I${TOOLS_PATH}/deps/include -I${TOOLS_PATH}/deps/include/ncursesw"
208+
CFLAGS="${EXTRA_TARGET_CFLAGS} -fPIC -I${TOOLS_PATH}/deps/include -I${TOOLS_PATH}/deps/include/ncursesw"
209209

210210
if [ "${PYBUILD_PLATFORM}" = "macos" ]; then
211211
CFLAGS="${CFLAGS} -I${TOOLS_PATH}/deps/lib/libffi-3.2.1/include -I${TOOLS_PATH}/deps/include/uuid"
212212
CFLAGS="${CFLAGS} -F${MACOS_SDK_PATH}/System/Library/Frameworks"
213213

214214
# Prevent using symbols not supported by current macOS SDK target.
215215
CFLAGS="${CFLAGS} -Werror=unguarded-availability-new"
216-
217-
# Suppress extremely frequent warnings we see in macOS SDK headers
218-
# with LLVM 10.
219-
CFLAGS="${CFLAGS} -Wno-nullability-completeness -Wno-expansion-to-defined"
220216
fi
221217

222218
CPPFLAGS=$CFLAGS

cpython-unix/build-tcl.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ rm -rf pkgs/sqlite* pkgs/tdbc*
3333

3434
pushd unix
3535

36-
CFLAGS="-fPIC -I${TOOLS_PATH}/deps/include"
36+
CFLAGS="${EXTRA_TARGET_CFLAGS} -fPIC -I${TOOLS_PATH}/deps/include"
3737

3838
if [ "${PYBUILD_PLATFORM}" = "macos" ]; then
39-
CFLAGS="${CFLAGS} -Wno-nullability-completeness -Wno-expansion-to-defined"
4039
CFLAGS="${CFLAGS} -I${MACOS_SDK_PATH}/System/Library/Frameworks -F${MACOS_SDK_PATH}/System/Library/Frameworks"
4140
fi
4241

cpython-unix/build-tix.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ cd cpython-source-deps-tix-${TIX_VERSION}
2121
# Yes, really.
2222
chmod +x configure
2323

24-
CFLAGS="-fPIC -DUSE_INTERP_RESULT"
24+
CFLAGS="${EXTRA_TARGET_CFLAGS} -fPIC -DUSE_INTERP_RESULT"
2525

2626
if [ "${PYBUILD_PLATFORM}" = "macos" ]; then
27-
CFLAGS="${CFLAGS} -I${TOOLS_PATH}/deps/include -Wno-nullability-completeness -Wno-expansion-to-defined"
27+
CFLAGS="${CFLAGS} -I${TOOLS_PATH}/deps/include"
2828
CFLAGS="${CFLAGS} -I${MACOS_SDK_PATH}/System/Library/Frameworks -F${MACOS_SDK_PATH}/System/Library/Frameworks"
2929
EXTRA_CONFIGURE_FLAGS="--without-x"
3030
else

cpython-unix/build-tk.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ export PKG_CONFIG_PATH=${TOOLS_PATH}/deps/share/pkgconfig:${TOOLS_PATH}/deps/lib
1313
tar -xf tk${TK_VERSION}-src.tar.gz
1414
pushd tk${TK_VERSION}/unix
1515

16-
CFLAGS="-fPIC"
16+
CFLAGS="${EXTRA_TARGET_CFLAGS} -fPIC"
1717
LDFLAGS=""
1818

1919
if [ "${PYBUILD_PLATFORM}" = "macos" ]; then
20-
CFLAGS="${CFLAGS} -I${TOOLS_PATH}/deps/include -Wno-nullability-completeness -Wno-expansion-to-defined -Wno-availability"
20+
CFLAGS="${CFLAGS} -I${TOOLS_PATH}/deps/include -Wno-availability"
2121
CFLAGS="${CFLAGS} -Wno-deprecated-declarations -Wno-unknown-attributes -Wno-typedef-redefinition"
2222
CFLAGS="${CFLAGS} -I${MACOS_SDK_PATH}/System/Library/Frameworks -F ${MACOS_SDK_PATH}/System/Library/Frameworks"
2323
LDFLAGS="-L${TOOLS_PATH}/deps/lib"

cpython-unix/build.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ def add_target_env(env, platform, build_env):
5252
env["BUILD_TRIPLE"] = "x86_64-apple-darwin18.7.0"
5353
env["TARGET_TRIPLE"] = "x86_64-apple-darwin18.7.0"
5454
env["PATH"] = "/usr/bin:/bin"
55+
env["EXTRA_TARGET_CFLAGS"] = " ".join(
56+
[
57+
# Suppress extremely verbose warnings we see with LLVM 10.
58+
"-Wno-nullability-completeness",
59+
"-Wno-expansion-to-defined",
60+
]
61+
)
5562

5663
# macOS SDK has historically been in /usr courtesy of an
5764
# installer provided by Xcode. But with Catalina, the files

0 commit comments

Comments
 (0)