mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
Ports: Build most python3 extension modules statically
Attempting to import C-extensions (lib-dynload/*.so) currently asserts in the dynamic loader - let's just build them statically instead for the time being. This makes a large number of modules available for use and the port a lot more functional! :^)
This commit is contained in:
parent
92ca22a5e1
commit
404dab5383
Notes:
sideshowbarker
2024-07-18 22:38:19 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/404dab5383c Pull-request: https://github.com/SerenityOS/serenity/pull/5217
1
Ports/.gitignore
vendored
1
Ports/.gitignore
vendored
@ -4,4 +4,3 @@
|
||||
!*/patches/*
|
||||
!*/.gitignore
|
||||
!*/README.md
|
||||
!python3/version.sh
|
||||
|
2
Ports/python3/.gitignore
vendored
Normal file
2
Ports/python3/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
!version.sh
|
||||
!Setup.local
|
76
Ports/python3/Setup.local
Normal file
76
Ports/python3/Setup.local
Normal file
@ -0,0 +1,76 @@
|
||||
# Build most modules that are usually built as shared objects statically as importing such modules
|
||||
# currently asserts in the dynamic loader (may or may not be related to https://github.com/SerenityOS/serenity/issues/4642):
|
||||
#
|
||||
# ASSERTION FAILED: flags & RTLD_GLOBAL
|
||||
# ../Userland/Libraries/LibELF/DynamicLoader.cpp:171 (as of 2020-02-01 at least)
|
||||
#
|
||||
# This means we otherwise couldn't import any of these nor anything that imports them, which is quite limiting.
|
||||
#
|
||||
# The list is mostly copied from Modules/Setup, with some minor tweaks (include paths, added a bunch of other modules).
|
||||
# As a result of static linking, a build failure in any of these modules will fail the build of Python itself,
|
||||
# instead of just not building that specific .so - obviously. If this stops working, tweak the list accordingly.
|
||||
#
|
||||
# Some stuff is neither under *static* nor *disabled*, so lib-dynload isn't entirely empty - mostly _test* modules though.
|
||||
#
|
||||
# Python itself is still linked dynamically, which works fine - it's just module imports that blow up.
|
||||
# This file can simply be removed, along with post_configure() in package.sh, once the issue mentioned above is resolved.
|
||||
|
||||
*static*
|
||||
|
||||
_asyncio _asynciomodule.c
|
||||
_bisect _bisectmodule.c
|
||||
_blake2 _blake2/blake2module.c _blake2/blake2b_impl.c _blake2/blake2s_impl.c
|
||||
_codecs_cn cjkcodecs/_codecs_cn.c
|
||||
_codecs_hk cjkcodecs/_codecs_hk.c
|
||||
_codecs_iso2022 cjkcodecs/_codecs_iso2022.c
|
||||
_codecs_jp cjkcodecs/_codecs_jp.c
|
||||
_codecs_kr cjkcodecs/_codecs_kr.c
|
||||
_codecs_tw cjkcodecs/_codecs_tw.c
|
||||
_contextvars _contextvarsmodule.c
|
||||
_crypt _cryptmodule.c
|
||||
_csv _csv.c
|
||||
_ctypes _ctypes/_ctypes.c _ctypes/callbacks.c _ctypes/callproc.c _ctypes/cfield.c _ctypes/malloc_closure.c _ctypes/stgdict.c -I$(SERENITY_ROOT)/Build/Root/usr/local/include $(SERENITY_ROOT)/Build/Root/usr/local/lib/libffi.a
|
||||
_datetime _datetimemodule.c
|
||||
_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c
|
||||
_heapq _heapqmodule.c
|
||||
_json -I$(srcdir)/Include/internal -DPy_BUILD_CORE_BUILTIN _json.c
|
||||
_md5 md5module.c
|
||||
_multibytecodec cjkcodecs/multibytecodec.c
|
||||
_opcode _opcode.c
|
||||
_pickle _pickle.c
|
||||
_posixsubprocess _posixsubprocess.c
|
||||
_queue _queuemodule.c
|
||||
_random _randommodule.c -DPy_BUILD_CORE_MODULE
|
||||
_sha1 sha1module.c
|
||||
_sha256 sha256module.c -DPy_BUILD_CORE_BUILTIN
|
||||
_sha3 _sha3/sha3module.c
|
||||
_sha512 sha512module.c -DPy_BUILD_CORE_BUILTIN
|
||||
_statistics _statisticsmodule.c
|
||||
_struct _struct.c
|
||||
_weakref _weakref.c
|
||||
_xxsubinterpreters _xxsubinterpretersmodule.c
|
||||
_zoneinfo _zoneinfo.c
|
||||
array arraymodule.c
|
||||
audioop audioop.c
|
||||
binascii binascii.c
|
||||
cmath cmathmodule.c _math.c -DPy_BUILD_CORE_MODULE
|
||||
fcntl fcntlmodule.c
|
||||
grp grpmodule.c
|
||||
math mathmodule.c _math.c -DPy_BUILD_CORE_MODULE
|
||||
parser parsermodule.c
|
||||
pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DXML_POOR_ENTROPY -DUSE_PYEXPAT_CAPI
|
||||
select selectmodule.c
|
||||
syslog syslogmodule.c
|
||||
unicodedata unicodedata.c
|
||||
xxlimited xxlimited.c
|
||||
xxsubtype xxsubtype.c
|
||||
|
||||
*disabled*
|
||||
# Not building, patch Python some more or fix LibC...
|
||||
_decimal _socket mmap resource spwd termios
|
||||
|
||||
# Linker errors
|
||||
_lsprof _multiprocessing
|
||||
|
||||
# Lots and lots of linker errors, although these flags should be correct:
|
||||
_curses _cursesmodule.c -I$(SERENITY_ROOT)/Build/Root/usr/local/include/ncurses -L$(SERENITY_ROOT)/Build/Root/usr/local/lib -lncurses -ltermcap
|
@ -25,6 +25,10 @@ configopts="--build=${BUILD} --without-ensurepip ac_cv_file__dev_ptmx=no ac_cv_f
|
||||
|
||||
export BLDSHARED="${CC} -shared"
|
||||
|
||||
post_configure() {
|
||||
run cp "${SERENITY_ROOT}/Ports/${port}/Setup.local" "Modules/Setup.local"
|
||||
}
|
||||
|
||||
if [ -x "$(command -v python3)" ]; then
|
||||
# Check if major and minor version of python3 are matching
|
||||
if ! python3 -c "import sys; major, minor, _ = map(int, '${PYTHON_VERSION}'.split('.')); sys.exit(not (sys.version_info.major == major and sys.version_info.minor == minor))"; then
|
||||
|
Loading…
Reference in New Issue
Block a user