summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-06-29 08:10:58 (GMT)
committerGitHub <noreply@github.com>2022-06-29 08:10:58 (GMT)
commitaaa85b55d9eab274606daef8bd1f8bb9672f1b1d (patch)
tree03ef43c59cfdc419d5217dea986105f917bc55bc
parent3b4f5ed1689e37ddeb2de4d817ed26a7477b442e (diff)
downloadcpython-aaa85b55d9eab274606daef8bd1f8bb9672f1b1d.zip
cpython-aaa85b55d9eab274606daef8bd1f8bb9672f1b1d.tar.gz
cpython-aaa85b55d9eab274606daef8bd1f8bb9672f1b1d.tar.bz2
gh-94404: makesetup: use correct CFLAGS and macOS workaround (GH-94405)
``makesetup`` now works around an issue with sed on macOS and uses correct CFLAGS for object files that end up in a shared extension. (cherry picked from commit 5150cbcd6821c0cf79b81cfc8780087bbc6985da) Co-authored-by: Christian Heimes <christian@python.org>
-rw-r--r--Misc/NEWS.d/next/Build/2022-06-29-08-58-31.gh-issue-94404.3MadM6.rst2
-rwxr-xr-xModules/makesetup16
2 files changed, 13 insertions, 5 deletions
diff --git a/Misc/NEWS.d/next/Build/2022-06-29-08-58-31.gh-issue-94404.3MadM6.rst b/Misc/NEWS.d/next/Build/2022-06-29-08-58-31.gh-issue-94404.3MadM6.rst
new file mode 100644
index 0000000..519a5ce
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2022-06-29-08-58-31.gh-issue-94404.3MadM6.rst
@@ -0,0 +1,2 @@
+``makesetup`` now works around an issue with sed on macOS and uses correct
+CFLAGS for object files that end up in a shared extension.
diff --git a/Modules/makesetup b/Modules/makesetup
index 9b20e3c..a45b7de 100755
--- a/Modules/makesetup
+++ b/Modules/makesetup
@@ -1,4 +1,5 @@
#! /bin/sh
+set -e
# Convert templates into Makefile and config.c, based on the module
# definitions found in the file Setup.
@@ -260,7 +261,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
*) src='$(srcdir)/'"$srcdir/$src";;
esac
case $doconfig in
- no) cc="$cc \$(CCSHARED) \$(PY_CFLAGS_NODIST) \$(PY_CPPFLAGS)";;
+ no) cc="$cc \$(PY_STDMODULE_CFLAGS) \$(CCSHARED)";;
*)
cc="$cc \$(PY_BUILTIN_MODULE_CFLAGS)";;
esac
@@ -322,8 +323,13 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
case $makepre in
-) ;;
- *) sedf="@sed.in.$$"
- trap 'rm -f $sedf' 0 1 2 3
+ *)
+ # macOS' sed has issues with 'a' command. Use 'r' command with an
+ # external replacement file instead.
+ sedf="@sed.in.$$"
+ sedr="@sed.replace.$$"
+ trap 'rm -f $sedf $sedr' 0 1 2 3
+ echo "$NL$NL$DEFS" | sed 's/\\$//' > $sedr
echo "1i\\" >$sedf
str="# Generated automatically from $makepre by makesetup."
echo "$str" >>$sedf
@@ -332,10 +338,10 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
echo "s%_MODDISABLED_NAMES_%$DISABLED%" >>$sedf
echo "s%_MODOBJS_%$OBJS%" >>$sedf
echo "s%_MODLIBS_%$LIBS%" >>$sedf
- echo "/Definitions added by makesetup/a$NL$NL$DEFS" >>$sedf
+ echo "/Definitions added by makesetup/r $sedr" >>$sedf
sed -f $sedf $makepre >Makefile
cat $rulesf >>Makefile
- rm -f $sedf
+ rm -f $sedf $sedr
;;
esac