From 325b05db8ca17c6385ff50065c165e62e6cb224f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Strandenes?= Date: Thu, 14 Jan 2021 08:52:31 +0100 Subject: [PATCH] Linking Python 3.8 against editline instead of readline --- README.rst | 6 ++++-- cpython-unix/Makefile | 2 +- cpython-unix/build-cpython.sh | 15 ++++++++------- cpython-unix/build.py | 3 ++- cpython-unix/static-modules.3.8.linux64 | 2 +- requirements.txt | 10 ++++++---- 6 files changed, 22 insertions(+), 16 deletions(-) diff --git a/README.rst b/README.rst index f956d1b3..f86d98df 100644 --- a/README.rst +++ b/README.rst @@ -2,5 +2,7 @@ Python Standalone Builds ======================== -See the docs in ``docs/`` or online at -https://python-build-standalone.readthedocs.io/. +This is a fork of indygreg/python-build-standalone to do the necessary +modifications to allow linking Python against libedit instead of readline. + +This repo is not regularly maintained. diff --git a/cpython-unix/Makefile b/cpython-unix/Makefile index 9b907902..b062ef46 100644 --- a/cpython-unix/Makefile +++ b/cpython-unix/Makefile @@ -47,7 +47,7 @@ ifeq ($(HOST_PLATFORM),linux64) NEED_GDBM := 1 NEED_GETTEXT := NEED_X11 := 1 - NEED_READLINE := 1 + NEED_READLINE := NEED_TIX := 1 endif diff --git a/cpython-unix/build-cpython.sh b/cpython-unix/build-cpython.sh index dd6c9c6f..92762a91 100755 --- a/cpython-unix/build-cpython.sh +++ b/cpython-unix/build-cpython.sh @@ -51,7 +51,7 @@ diff --git a/Modules/makesetup b/Modules/makesetup - echo "$rule" >>$rulesf - done done - + + # Deduplicate OBJS. + OBJS=$(echo $OBJS | tr ' ' '\n' | sort -u | xargs) + @@ -68,12 +68,12 @@ diff --git a/Makefile.pre.in b/Makefile.pre.in +++ b/Makefile.pre.in @@ -628,7 +628,7 @@ libpython3.so: libpython$(LDVERSION).so $(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^ - + libpython$(LDVERSION).dylib: $(LIBRARY_OBJS) - $(CC) -dynamiclib -Wl,-single_module $(PY_CORE_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(DTRACE_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \ + $(CC) -dynamiclib -Wl,-single_module $(PY_CORE_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(DTRACE_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM); \ - - + + libpython$(VERSION).sl: $(LIBRARY_OBJS) EOF @@ -88,12 +88,12 @@ diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -563,7 +563,7 @@ clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c - + # Build the interpreter $(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) - $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) + $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(SYSLIBS) - + platform: $(BUILDPYTHON) pybuilddir.txt $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform EOF @@ -468,7 +468,8 @@ done # Also copy extension variant metadata files. if [ "${PYBUILD_PLATFORM}" != "macos" ]; then - cp -av Modules/VARIANT-*.data ${ROOT}/out/python/build/Modules/ + #cp -av Modules/VARIANT-*.data ${ROOT}/out/python/build/Modules/ + : fi # The object files need to be linked against library dependencies. So copy diff --git a/cpython-unix/build.py b/cpython-unix/build.py index 1a1e566b..fc909940 100755 --- a/cpython-unix/build.py +++ b/cpython-unix/build.py @@ -731,7 +731,8 @@ def build_cpython( readline = host_platform != "macos" if readline: - packages.add("readline") + # packages.add("readline") + pass if host_platform == "linux64": packages |= {"libX11", "libXau", "libxcb", "xorgproto"} diff --git a/cpython-unix/static-modules.3.8.linux64 b/cpython-unix/static-modules.3.8.linux64 index a7616153..9a36294e 100644 --- a/cpython-unix/static-modules.3.8.linux64 +++ b/cpython-unix/static-modules.3.8.linux64 @@ -33,5 +33,5 @@ pyexpat pyexpat.c expat/xmlparse.c expat/xmlrole.c expat/xmltok.c -DHAVE_EXPAT_C # picked up by build. We /could/ make libedit first. But since we employ a hack to # coerce use of libedit on Linux, it seems prudent for the build system to pick # up readline. -readline VARIANT=readline readline.c -I/tools/deps/include -I/tools/deps/include/ncursesw -L/tools/deps/lib -lreadline -lncursesw +# readline VARIANT=readline readline.c -I/tools/deps/include -I/tools/deps/include/ncursesw -L/tools/deps/lib -lreadline -lncursesw readline VARIANT=libedit readline-libedit.c -DUSE_LIBEDIT=1 -I/tools/deps/libedit/include -I/tools/deps/libedit/include/ncursesw -L/tools/deps/libedit/lib -ledit -lncursesw diff --git a/requirements.txt b/requirements.txt index abb4ebcb..a0d225f2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ # This file is autogenerated by pip-compile # To update, run: # -# pip-compile --generate-hashes --output-file=requirements.txt requirements.txt.in +# pip-compile --allow-unsafe --generate-hashes --output-file=requirements.txt requirements.txt.in # certifi==2020.12.5 \ --hash=sha256:1a4995114262bffbc2413b159f2a1a480c969de6e6eb13ee966d470af86af59c \ @@ -134,6 +134,8 @@ zstandard==0.15.1 \ --hash=sha256:ff7642a936734781708ece0721c58b238759be4c473f1855d50515a0fa10a5a2 # via -r requirements.txt.in -# WARNING: The following packages were not pinned, but pip requires them to be -# pinned when the requirements file includes hashes. Consider using the --allow-unsafe flag. -# pip +# The following packages are considered to be unsafe in a requirements file: +pip==20.3.3 \ + --hash=sha256:79c1ac8a9dccbec8752761cb5a2df833224263ca661477a2a9ed03ddf4e0e3ba \ + --hash=sha256:fab098c8a1758295dd9f57413c199f23571e8fde6cc39c22c78c961b4ac6286d + # via pip-tools