Skip to content

Commit fef0d3b

Browse files
committed
unix: remove makefile rules for building shared extension modules
We want to teach the build to produce a shared library. But we want to statically link extension modules in libpython. We need to patch makesetup so it doesn't produce rules to build shared extension modules, as these would complicate the linking story.
1 parent f642c6f commit fef0d3b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

cpython-unix/build-cpython.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,31 @@ cat Makefile.extra
3030

3131
pushd Python-${PYTHON_VERSION}
3232

33+
# We build all extensions statically. So remove the auto-generated make
34+
# rules that produce shared libraries for them.
35+
patch -p1 << "EOF"
36+
diff --git a/Modules/makesetup b/Modules/makesetup
37+
--- a/Modules/makesetup
38+
+++ b/Modules/makesetup
39+
@@ -241,16 +241,6 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
40+
case $doconfig in
41+
yes) OBJS="$OBJS $objs";;
42+
esac
43+
- for mod in $mods
44+
- do
45+
- file="$srcdir/$mod\$(EXT_SUFFIX)"
46+
- case $doconfig in
47+
- no) SHAREDMODS="$SHAREDMODS $file";;
48+
- esac
49+
- rule="$file: $objs"
50+
- rule="$rule; \$(BLDSHARED) $objs $libs $ExtraLibs -o $file"
51+
- echo "$rule" >>$rulesf
52+
- done
53+
done
54+
55+
case $SHAREDMODS in
56+
EOF
57+
3358
# Code that runs at ctypes module import time does not work with
3459
# non-dynamic binaries. Patch Python to work around this.
3560
# See https://bugs.python.org/issue37060.

0 commit comments

Comments
 (0)