Skip to content

Commit ca24a9e

Browse files
committed
unix: support building CPython 3.9
I haven't yet thoroughly tested this and audited for build system changes. But this patch does produce a CPython 3.9 build on at least Linux.
1 parent bda875a commit ca24a9e

13 files changed

+111
-5
lines changed

LICENSE.cpython.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ libmpdec
685685
The :mod:`_decimal` module is built using an included copy of the libmpdec
686686
library unless the build is configured ``--with-system-libmpdec``::
687687

688-
Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
688+
Copyright (c) 2008-2020 Stefan Krah. All rights reserved.
689689

690690
Redistribution and use in source and binary forms, with or without
691691
modification, are permitted provided that the following conditions

cpython-unix/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,3 +302,6 @@ $(OUTDIR)/cpython-$(CPYTHON_3.7_VERSION)-$(PACKAGE_SUFFIX).tar: $(ALL_PYTHON_DEP
302302

303303
$(OUTDIR)/cpython-$(CPYTHON_3.8_VERSION)-$(PACKAGE_SUFFIX).tar: $(ALL_PYTHON_DEPENDS)
304304
$(RUN_BUILD) cpython-3.8
305+
306+
$(OUTDIR)/cpython-$(CPYTHON_3.9_VERSION)-$(PACKAGE_SUFFIX).tar: $(ALL_PYTHON_DEPENDS)
307+
$(RUN_BUILD) cpython-3.9

cpython-unix/build-main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def main():
5555
)
5656
parser.add_argument(
5757
"--python",
58-
choices={"cpython-3.7", "cpython-3.8"},
58+
choices={"cpython-3.7", "cpython-3.8", "cpython-3.9"},
5959
default="cpython-3.7",
6060
help="Python distribution to build",
6161
)

cpython-unix/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ def main():
10551055
extra_archives=extra_archives,
10561056
)
10571057

1058-
elif action in ("cpython-3.7", "cpython-3.8"):
1058+
elif action in ("cpython-3.7", "cpython-3.8", "cpython-3.9"):
10591059
build_cpython(
10601060
client,
10611061
get_image(client, ROOT, BUILD, "build"),

cpython-unix/disabled-static-modules.3.9.linux64

Whitespace-only changes.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# We don't support GDBM because it is GPL v3.
2+
_gdbm
3+
# Not available on macOS.
4+
nis
5+
# Not available on macOS.
6+
ossaudiodev
7+
# Not available on macOS.
8+
spwd
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
_codecs
2+
_io
3+
_signal
4+
_thread
5+
_tracemalloc
6+
_weakref
7+
faulthandler
8+
posix
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
_codecs
2+
_io
3+
_signal
4+
_thread
5+
_tracemalloc
6+
_weakref
7+
faulthandler
8+
posix
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Setup.dist doesn't have entries for all modules. This file defines
2+
# what's missing. The content here is reconstructed from logic in
3+
# setup.py and what was observed to execute in a normal build via setup.py.
4+
# We should audit this every time we upgrade CPython.
5+
6+
_bz2 _bz2module.c -lbz2
7+
_crypt _cryptmodule.c -lcrypt
8+
_curses _cursesmodule.c -DHAVE_NCURSESW=1 -I/tools/deps/include/ncursesw -L/tools/deps/lib -lncursesw
9+
_curses_panel _curses_panel.c -DHAVE_NCURSESW=1 -I/tools/deps/include/ncursesw -L/tools/deps/lib -lpanelw -lncursesw
10+
_ctypes _ctypes/_ctypes.c _ctypes/callbacks.c _ctypes/callproc.c _ctypes/stgdict.c _ctypes/cfield.c -I/tools/deps/lib/libffi-3.2.1/include -lffi -ldl
11+
_decimal _decimal/_decimal.c _decimal/libmpdec/basearith.c _decimal/libmpdec/constants.c _decimal/libmpdec/context.c _decimal/libmpdec/convolute.c _decimal/libmpdec/crt.c _decimal/libmpdec/difradix2.c _decimal/libmpdec/fnt.c _decimal/libmpdec/fourstep.c _decimal/libmpdec/io.c _decimal/libmpdec/mpalloc.c _decimal/libmpdec/mpdecimal.c _decimal/libmpdec/numbertheory.c _decimal/libmpdec/sixstep.c _decimal/libmpdec/transpose.c -DCONFIG_64=1 -DASM=1 -IModules/_decimal/libmpdec
12+
_dbm _dbmmodule.c -DHAVE_BERKDB_H -DDB_DBM_HSEARCH -I/tools/deps/include -L/tools/deps/lib -ldb
13+
_elementtree _elementtree.c -DHAVE_EXPAT_CONFIG_H=1 -DXML_POOR_ENTROPY=1 -DUSE_PYEXPAT_CAPI -IModules/expat
14+
# Cannot build _gdbm due to use of bdb.
15+
#_gdbm _gdbmmodule.c -DHAVE_NDBM_H -I/tools/deps/include -L/tools/deps/lib -lgdbm
16+
_hashlib _hashopenssl.c -I/tools/deps/include -L/tools/deps/lib -lssl -lcrypto
17+
_json _json.c
18+
_lsprof _lsprof.c rotatingtree.c
19+
_lzma _lzmamodule.c -I/tools/deps/include -L/tools/deps/lib -llzma
20+
# TODO check setup.py logic for semaphore.c and possibly fix missing
21+
# dependency.
22+
_multiprocessing _multiprocessing/multiprocessing.c _multiprocessing/semaphore.c
23+
_opcode _opcode.c
24+
_posixshmem _multiprocessing/posixshmem.c -IModules/_multiprocessing -lrt
25+
_queue _queuemodule.c
26+
_sqlite3 _sqlite/cache.c _sqlite/connection.c _sqlite/cursor.c _sqlite/microprotocols.c _sqlite/module.c _sqlite/prepare_protocol.c _sqlite/row.c _sqlite/statement.c _sqlite/util.c -I/tools/deps/include -IModules/_sqlite -DMODULE_NAME=\"sqlite3\" -DSQLITE_OMIT_LOAD_EXTENSION=1 -L/tools/deps/lib -lsqlite3
27+
_ssl _ssl.c -I/tools/deps/include -lssl -lcrypto
28+
_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT -I/tools/deps/include/X11 -L/tools/deps/lib -ltcl8.6 -ltk8.6 -lX11 -lxcb -lXau
29+
_uuid _uuidmodule.c -I/tools/deps/include/uuid -luuid
30+
ossaudiodev ossaudiodev.c
31+
pyexpat pyexpat.c expat/xmlparse.c expat/xmlrole.c expat/xmltok.c -DHAVE_EXPAT_CONFIG_H=1 -DXML_POOR_ENTROPY=1 -DUSE_PYEXPAT_CAPI -IModules/expat
32+
# readline variant needs to come first because libreadline is in /tools/deps and is
33+
# picked up by build. We /could/ make libedit first. But since we employ a hack to
34+
# coerce use of libedit on Linux, it seems prudent for the build system to pick
35+
# up readline.
36+
readline VARIANT=readline readline.c -I/tools/deps/include -I/tools/deps/include/ncursesw -L/tools/deps/lib -lreadline -lncursesw
37+
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

cpython-unix/static-modules.3.9.macos

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Setup.dist doesn't have entries for all modules. This file defines
2+
# what's missing. The content here is reconstructed from logic in
3+
# setup.py and what was observed to execute in a normal build via setup.py.
4+
# We should audit this every time we upgrade CPython.
5+
6+
_bz2 _bz2module.c -lbz2
7+
_crypt _cryptmodule.c
8+
# We link against the system ncurses on macOS for simplicity. There is no ncursesw
9+
# but it is Unicode aware.
10+
_curses _cursesmodule.c -DHAVE_NCURSESW=1 -D_XOPEN_SOURCE_EXTENDED=1 -lncurses
11+
_curses_panel _curses_panel.c -DHAVE_NCURSESW=1 -D_XOPEN_SOURCE_EXTENDED=1 -lpanel -lncurses
12+
_ctypes _ctypes/_ctypes.c _ctypes/callbacks.c _ctypes/callproc.c _ctypes/darwin/dlfcn_simple.c _ctypes/malloc_closure.c _ctypes/stgdict.c _ctypes/cfield.c -DMACOSX -I_ctypes/darwin -lffi -ldl
13+
_decimal _decimal/_decimal.c _decimal/libmpdec/basearith.c _decimal/libmpdec/constants.c _decimal/libmpdec/context.c _decimal/libmpdec/convolute.c _decimal/libmpdec/crt.c _decimal/libmpdec/difradix2.c _decimal/libmpdec/fnt.c _decimal/libmpdec/fourstep.c _decimal/libmpdec/io.c _decimal/libmpdec/mpalloc.c _decimal/libmpdec/mpdecimal.c _decimal/libmpdec/numbertheory.c _decimal/libmpdec/sixstep.c _decimal/libmpdec/transpose.c -DUNIVERSAL=1 -IModules/_decimal/libmpdec
14+
_dbm _dbmmodule.c -DHAVE_BERKDB_H -DDB_DBM_HSEARCH -ldb
15+
_elementtree _elementtree.c -DHAVE_EXPAT_CONFIG_H=1 -DXML_POOR_ENTROPY=1 -DUSE_PYEXPAT_CAPI -IModules/expat
16+
_hashlib _hashopenssl.c -lssl -lcrypto
17+
_json _json.c
18+
_lsprof _lsprof.c rotatingtree.c
19+
_lzma _lzmamodule.c -llzma
20+
# TODO check setup.py logic for semaphore.c and possibly fix missing
21+
# dependency.
22+
_multiprocessing _multiprocessing/multiprocessing.c _multiprocessing/semaphore.c
23+
_opcode _opcode.c
24+
_posixshmem _multiprocessing/posixshmem.c -IModules/_multiprocessing
25+
_queue _queuemodule.c
26+
_scproxy _scproxy.c -framework SystemConfiguration -framework CoreFoundation
27+
_sqlite3 _sqlite/cache.c _sqlite/connection.c _sqlite/cursor.c _sqlite/microprotocols.c _sqlite/module.c _sqlite/prepare_protocol.c _sqlite/row.c _sqlite/statement.c _sqlite/util.c -IModules/_sqlite -DMODULE_NAME=\"sqlite3\" -DSQLITE_OMIT_LOAD_EXTENSION=1 -lsqlite3
28+
_ssl _ssl.c -lssl -lcrypto
29+
_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT -framework AppKit -framework ApplicationServices -framework Carbon -framework CoreServices -framework CoreGraphics -framework IOKit -ltcl8.6 -ltk8.6
30+
_uuid _uuidmodule.c -luuid
31+
pyexpat pyexpat.c expat/xmlparse.c expat/xmlrole.c expat/xmltok.c -DHAVE_EXPAT_CONFIG_H=1 -DXML_POOR_ENTROPY=1 -DUSE_PYEXPAT_CAPI -IModules/expat
32+
readline readline.c -ledit -lncurses

0 commit comments

Comments
 (0)