mirror of
https://github.com/python/cpython
synced 2024-10-14 14:53:36 +00:00
bpo-43103: Add configure --without-static-libpython (GH-24418)
Add a new configure --without-static-libpython option to not build the libpythonMAJOR.MINOR.a static library and not install the python.o object file. Fix smelly.py and stable_abi.py tools when libpython3.10.a is missing.
This commit is contained in:
parent
6a4177516b
commit
801bb0b503
|
@ -820,6 +820,12 @@ Build Changes
|
||||||
|
|
||||||
(Contributed by Victor Stinner in :issue:`42856`.)
|
(Contributed by Victor Stinner in :issue:`42856`.)
|
||||||
|
|
||||||
|
* Add a new configure ``--without-static-libpython`` option to not build the
|
||||||
|
``libpythonMAJOR.MINOR.a`` static library and not install the ``python.o``
|
||||||
|
object file.
|
||||||
|
|
||||||
|
(Contributed by Victor Stinner in :issue:`43103`.)
|
||||||
|
|
||||||
|
|
||||||
C API Changes
|
C API Changes
|
||||||
=============
|
=============
|
||||||
|
|
|
@ -236,6 +236,9 @@ PY3LIBRARY= @PY3LIBRARY@
|
||||||
DLLLIBRARY= @DLLLIBRARY@
|
DLLLIBRARY= @DLLLIBRARY@
|
||||||
LDLIBRARYDIR= @LDLIBRARYDIR@
|
LDLIBRARYDIR= @LDLIBRARYDIR@
|
||||||
INSTSONAME= @INSTSONAME@
|
INSTSONAME= @INSTSONAME@
|
||||||
|
LIBRARY_DEPS= @LIBRARY_DEPS@
|
||||||
|
PY_ENABLE_SHARED= @PY_ENABLE_SHARED@
|
||||||
|
STATIC_LIBPYTHON= @STATIC_LIBPYTHON@
|
||||||
|
|
||||||
|
|
||||||
LIBS= @LIBS@
|
LIBS= @LIBS@
|
||||||
|
@ -578,7 +581,7 @@ clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c
|
||||||
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py --make --srcdir $(srcdir)
|
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py --make --srcdir $(srcdir)
|
||||||
|
|
||||||
# Build the interpreter
|
# Build the interpreter
|
||||||
$(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) $(EXPORTSYMS)
|
$(BUILDPYTHON): Programs/python.o $(LIBRARY_DEPS)
|
||||||
$(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS)
|
$(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS)
|
||||||
|
|
||||||
platform: $(BUILDPYTHON) pybuilddir.txt
|
platform: $(BUILDPYTHON) pybuilddir.txt
|
||||||
|
@ -713,7 +716,7 @@ Makefile Modules/config.c: Makefile.pre \
|
||||||
@echo "The Makefile was updated, you may need to re-run make."
|
@echo "The Makefile was updated, you may need to re-run make."
|
||||||
|
|
||||||
|
|
||||||
Programs/_testembed: Programs/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) $(EXPORTSYMS)
|
Programs/_testembed: Programs/_testembed.o $(LIBRARY_DEPS)
|
||||||
$(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS)
|
$(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS)
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
|
@ -1305,19 +1308,21 @@ altbininstall: $(BUILDPYTHON) @FRAMEWORKPYTHONW@
|
||||||
fi; \
|
fi; \
|
||||||
(cd $(DESTDIR)$(BINDIR); $(LN) python$(LDVERSION)$(EXE) python$(VERSION)$(EXE)); \
|
(cd $(DESTDIR)$(BINDIR); $(LN) python$(LDVERSION)$(EXE) python$(VERSION)$(EXE)); \
|
||||||
fi
|
fi
|
||||||
if test -f $(LDLIBRARY) && test "$(PYTHONFRAMEWORKDIR)" = "no-framework" ; then \
|
@if test "$(PY_ENABLE_SHARED)" = 1 -o "$(STATIC_LIBPYTHON)" = 1; then \
|
||||||
if test -n "$(DLLLIBRARY)" ; then \
|
if test -f $(LDLIBRARY) && test "$(PYTHONFRAMEWORKDIR)" = "no-framework" ; then \
|
||||||
$(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \
|
if test -n "$(DLLLIBRARY)" ; then \
|
||||||
else \
|
$(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \
|
||||||
$(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
|
else \
|
||||||
if test $(LDLIBRARY) != $(INSTSONAME); then \
|
$(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
|
||||||
(cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) $(LDLIBRARY)) \
|
if test $(LDLIBRARY) != $(INSTSONAME); then \
|
||||||
fi \
|
(cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) $(LDLIBRARY)) \
|
||||||
|
fi \
|
||||||
|
fi; \
|
||||||
|
if test -n "$(PY3LIBRARY)"; then \
|
||||||
|
$(INSTALL_SHARED) $(PY3LIBRARY) $(DESTDIR)$(LIBDIR)/$(PY3LIBRARY); \
|
||||||
|
fi; \
|
||||||
|
else true; \
|
||||||
fi; \
|
fi; \
|
||||||
if test -n "$(PY3LIBRARY)"; then \
|
|
||||||
$(INSTALL_SHARED) $(PY3LIBRARY) $(DESTDIR)$(LIBDIR)/$(PY3LIBRARY); \
|
|
||||||
fi; \
|
|
||||||
else true; \
|
|
||||||
fi
|
fi
|
||||||
if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \
|
if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \
|
||||||
rm -f $(DESTDIR)$(BINDIR)python$(VERSION)-32$(EXE); \
|
rm -f $(DESTDIR)$(BINDIR)python$(VERSION)-32$(EXE); \
|
||||||
|
@ -1661,19 +1666,21 @@ libainstall: @DEF_MAKE_RULE@ python-config
|
||||||
else true; \
|
else true; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
@if test -d $(LIBRARY); then :; else \
|
@if test "$(STATIC_LIBPYTHON)" = 1; then \
|
||||||
if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
|
if test -d $(LIBRARY); then :; else \
|
||||||
if test "$(SHLIB_SUFFIX)" = .dll; then \
|
if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
|
||||||
$(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
|
if test "$(SHLIB_SUFFIX)" = .dll; then \
|
||||||
|
$(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
|
||||||
|
else \
|
||||||
|
$(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
|
||||||
|
fi; \
|
||||||
else \
|
else \
|
||||||
$(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
|
echo Skip install of $(LIBRARY) - use make frameworkinstall; \
|
||||||
fi; \
|
fi; \
|
||||||
else \
|
|
||||||
echo Skip install of $(LIBRARY) - use make frameworkinstall; \
|
|
||||||
fi; \
|
fi; \
|
||||||
|
$(INSTALL_DATA) Programs/python.o $(DESTDIR)$(LIBPL)/python.o; \
|
||||||
fi
|
fi
|
||||||
$(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
|
$(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
|
||||||
$(INSTALL_DATA) Programs/python.o $(DESTDIR)$(LIBPL)/python.o
|
|
||||||
$(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
|
$(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
|
||||||
$(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
|
$(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
|
||||||
$(INSTALL_DATA) $(srcdir)/Modules/Setup $(DESTDIR)$(LIBPL)/Setup
|
$(INSTALL_DATA) $(srcdir)/Modules/Setup $(DESTDIR)$(LIBPL)/Setup
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
Add a new configure ``--without-static-libpython`` option to not build the
|
||||||
|
``libpythonMAJOR.MINOR.a`` static library and not install the ``python.o``
|
||||||
|
object file.
|
|
@ -136,11 +136,14 @@ def check_extensions():
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
nsymbol = 0
|
||||||
|
|
||||||
# static library
|
# static library
|
||||||
LIBRARY = sysconfig.get_config_var('LIBRARY')
|
LIBRARY = sysconfig.get_config_var('LIBRARY')
|
||||||
if not LIBRARY:
|
if not LIBRARY:
|
||||||
raise Exception("failed to get LIBRARY variable from sysconfig")
|
raise Exception("failed to get LIBRARY variable from sysconfig")
|
||||||
nsymbol = check_library(LIBRARY)
|
if os.path.exists(LIBRARY):
|
||||||
|
nsymbol += check_library(LIBRARY)
|
||||||
|
|
||||||
# dynamic library
|
# dynamic library
|
||||||
LDLIBRARY = sysconfig.get_config_var('LDLIBRARY')
|
LDLIBRARY = sysconfig.get_config_var('LDLIBRARY')
|
||||||
|
|
|
@ -2,8 +2,9 @@
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import glob
|
import glob
|
||||||
import re
|
import os.path
|
||||||
import pathlib
|
import pathlib
|
||||||
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import sysconfig
|
import sysconfig
|
||||||
|
@ -213,7 +214,8 @@ def check_symbols(parser_args):
|
||||||
LIBRARY = sysconfig.get_config_var("LIBRARY")
|
LIBRARY = sysconfig.get_config_var("LIBRARY")
|
||||||
if not LIBRARY:
|
if not LIBRARY:
|
||||||
raise Exception("failed to get LIBRARY variable from sysconfig")
|
raise Exception("failed to get LIBRARY variable from sysconfig")
|
||||||
check_library(parser_args.stable_abi_file, LIBRARY, abi_funcs)
|
if os.path.exists(LIBRARY):
|
||||||
|
check_library(parser_args.stable_abi_file, LIBRARY, abi_funcs)
|
||||||
|
|
||||||
# dynamic library
|
# dynamic library
|
||||||
LDLIBRARY = sysconfig.get_config_var("LDLIBRARY")
|
LDLIBRARY = sysconfig.get_config_var("LDLIBRARY")
|
||||||
|
|
40
configure
vendored
40
configure
vendored
|
@ -624,6 +624,8 @@ ac_includes_default="\
|
||||||
|
|
||||||
ac_subst_vars='LTLIBOBJS
|
ac_subst_vars='LTLIBOBJS
|
||||||
TEST_MODULES
|
TEST_MODULES
|
||||||
|
LIBRARY_DEPS
|
||||||
|
STATIC_LIBPYTHON
|
||||||
OPENSSL_LDFLAGS
|
OPENSSL_LDFLAGS
|
||||||
OPENSSL_LIBS
|
OPENSSL_LIBS
|
||||||
OPENSSL_INCLUDES
|
OPENSSL_INCLUDES
|
||||||
|
@ -856,6 +858,7 @@ with_openssl
|
||||||
with_ssl_default_suites
|
with_ssl_default_suites
|
||||||
with_builtin_hashlib_hashes
|
with_builtin_hashlib_hashes
|
||||||
with_experimental_isolated_subinterpreters
|
with_experimental_isolated_subinterpreters
|
||||||
|
with_static_libpython
|
||||||
enable_test_modules
|
enable_test_modules
|
||||||
'
|
'
|
||||||
ac_precious_vars='build_alias
|
ac_precious_vars='build_alias
|
||||||
|
@ -1602,6 +1605,9 @@ Optional Packages:
|
||||||
--with-experimental-isolated-subinterpreters
|
--with-experimental-isolated-subinterpreters
|
||||||
better isolate subinterpreters, experimental build
|
better isolate subinterpreters, experimental build
|
||||||
mode (default is no)
|
mode (default is no)
|
||||||
|
--without-static-libpython
|
||||||
|
do not build libpythonMAJOR.MINOR.a and do not
|
||||||
|
install python.o (default is yes)
|
||||||
|
|
||||||
Some influential environment variables:
|
Some influential environment variables:
|
||||||
MACHDEP name for machine-dependent library files
|
MACHDEP name for machine-dependent library files
|
||||||
|
@ -17776,6 +17782,40 @@ $as_echo "no" >&6; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# --with-static-libpython
|
||||||
|
STATIC_LIBPYTHON=1
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-static-libpython" >&5
|
||||||
|
$as_echo_n "checking for --with-static-libpython... " >&6; }
|
||||||
|
|
||||||
|
# Check whether --with-static-libpython was given.
|
||||||
|
if test "${with_static_libpython+set}" = set; then :
|
||||||
|
withval=$with_static_libpython;
|
||||||
|
if test "$withval" = no
|
||||||
|
then
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||||
|
$as_echo "no" >&6; };
|
||||||
|
STATIC_LIBPYTHON=0
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||||
|
$as_echo "yes" >&6; };
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||||
|
$as_echo "yes" >&6; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
LIBRARY_DEPS='$(PY3LIBRARY) $(EXPORTSYMS)'
|
||||||
|
if test "$PY_ENABLE_SHARED" = 1; then
|
||||||
|
LIBRARY_DEPS="\$(LDLIBRARY) $LIBRARY_DEPS"
|
||||||
|
if test "$STATIC_LIBPYTHON" = 1; then
|
||||||
|
LIBRARY_DEPS="\$(LIBRARY) $LIBRARY_DEPS"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
LIBRARY_DEPS="\$(LIBRARY) $LIBRARY_DEPS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Check whether to disable test modules. Once set, setup.py will not build
|
# Check whether to disable test modules. Once set, setup.py will not build
|
||||||
# test extension modules and "make install" will not install test suites.
|
# test extension modules and "make install" will not install test suites.
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --disable-test-modules" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --disable-test-modules" >&5
|
||||||
|
|
27
configure.ac
27
configure.ac
|
@ -5882,6 +5882,33 @@ else
|
||||||
fi],
|
fi],
|
||||||
[AC_MSG_RESULT(no)])
|
[AC_MSG_RESULT(no)])
|
||||||
|
|
||||||
|
# --with-static-libpython
|
||||||
|
STATIC_LIBPYTHON=1
|
||||||
|
AC_MSG_CHECKING(for --with-static-libpython)
|
||||||
|
AC_ARG_WITH(static-libpython,
|
||||||
|
AS_HELP_STRING([--without-static-libpython],
|
||||||
|
[do not build libpythonMAJOR.MINOR.a and do not install python.o (default is yes)]),
|
||||||
|
[
|
||||||
|
if test "$withval" = no
|
||||||
|
then
|
||||||
|
AC_MSG_RESULT(no);
|
||||||
|
STATIC_LIBPYTHON=0
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(yes);
|
||||||
|
fi],
|
||||||
|
[AC_MSG_RESULT(yes)])
|
||||||
|
LIBRARY_DEPS='$(PY3LIBRARY) $(EXPORTSYMS)'
|
||||||
|
if test "$PY_ENABLE_SHARED" = 1; then
|
||||||
|
LIBRARY_DEPS="\$(LDLIBRARY) $LIBRARY_DEPS"
|
||||||
|
if test "$STATIC_LIBPYTHON" = 1; then
|
||||||
|
LIBRARY_DEPS="\$(LIBRARY) $LIBRARY_DEPS"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
LIBRARY_DEPS="\$(LIBRARY) $LIBRARY_DEPS"
|
||||||
|
fi
|
||||||
|
AC_SUBST(STATIC_LIBPYTHON)
|
||||||
|
AC_SUBST(LIBRARY_DEPS)
|
||||||
|
|
||||||
# Check whether to disable test modules. Once set, setup.py will not build
|
# Check whether to disable test modules. Once set, setup.py will not build
|
||||||
# test extension modules and "make install" will not install test suites.
|
# test extension modules and "make install" will not install test suites.
|
||||||
AC_MSG_CHECKING(for --disable-test-modules)
|
AC_MSG_CHECKING(for --disable-test-modules)
|
||||||
|
|
Loading…
Reference in a new issue