Skip to content

gh-94404: Use module CFLAGS before PY_STDMODULE_CFLAGS #94413

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ python.worker.js: $(srcdir)/Tools/wasm/python.worker.js

##########################################################################
# Build static libmpdec.a
LIBMPDEC_CFLAGS=$(PY_STDMODULE_CFLAGS) $(CCSHARED) @LIBMPDEC_CFLAGS@
LIBMPDEC_CFLAGS=@LIBMPDEC_CFLAGS@ $(PY_STDMODULE_CFLAGS) $(CCSHARED)

# for setup.py
DECIMAL_CFLAGS=@LIBMPDEC_CFLAGS@
Expand Down Expand Up @@ -887,7 +887,7 @@ $(LIBMPDEC_A): $(LIBMPDEC_OBJS)

##########################################################################
# Build static libexpat.a
LIBEXPAT_CFLAGS=$(PY_STDMODULE_CFLAGS) $(CCSHARED) @LIBEXPAT_CFLAGS@
LIBEXPAT_CFLAGS=@LIBEXPAT_CFLAGS@ $(PY_STDMODULE_CFLAGS) $(CCSHARED)

# for setup.py
EXPAT_CFLAGS=@LIBEXPAT_CFLAGS@
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
``makesetup`` now works around an issue with sed on macOS and uses correct
CFLAGS for object files that end up in a shared extension.
CFLAGS for object files that end up in a shared extension. Module CFLAGS
are used before PY_STDMODULE_CFLAGS to avoid clashes with system headers.
7 changes: 4 additions & 3 deletions Modules/makesetup
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,14 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
\$*) ;;
*) src='$(srcdir)/'"$srcdir/$src";;
esac
# custom flags first, PY_STDMODULE_CFLAGS may contain -I with system libmpdec
case $doconfig in
no) cc="$cc \$(PY_STDMODULE_CFLAGS) \$(CCSHARED)";;
no) cc="$cc $cpps \$(PY_STDMODULE_CFLAGS) \$(CCSHARED)";;
*)
cc="$cc \$(PY_BUILTIN_MODULE_CFLAGS)";;
cc="$cc $cpps \$(PY_BUILTIN_MODULE_CFLAGS)";;
esac
# force rebuild when header file or module build flavor (static/shared) is changed
rule="$obj: $src \$(MODULE_${mods_upper}_DEPS) \$(PYTHON_HEADERS) Modules/config.c; $cc $cpps -c $src -o $obj"
rule="$obj: $src \$(MODULE_${mods_upper}_DEPS) \$(PYTHON_HEADERS) Modules/config.c; $cc -c $src -o $obj"
echo "$rule" >>$rulesf
done
case $doconfig in
Expand Down