Skip to content

Commit

Permalink
Linking Python 3.8 against editline instead of readline
Browse files Browse the repository at this point in the history
  • Loading branch information
hakostra committed Jan 14, 2021
1 parent e40c9c7 commit 325b05d
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 16 deletions.
6 changes: 4 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion cpython-unix/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 8 additions & 7 deletions cpython-unix/build-cpython.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
+
Expand All @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion cpython-unix/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
2 changes: 1 addition & 1 deletion cpython-unix/static-modules.3.8.linux64
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 6 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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

0 comments on commit 325b05d

Please sign in to comment.