port 2P step 1: vendor CPython 2.7.18 as the mtpython static library
The embedded 40250 script layer needs its own interpreter on five platforms. 2.7 is end-of-life, so nothing can be fetched from the target SDKs and the source is vendored (official 2.7.18 tarball, trimmed to 25MB; Lib/ stays for step 3's python27.zip). cpython-2.7.18/CMakeLists.txt builds one `mtpython` static library from exactly the 133 objects the reference libpython2.7.a contains, off by default behind -DMTGODOT_EMBED_PYTHON=ON. The source list and the built-in module table (config/config.c, 39 entries) are shared; pyconfig.h is a probe result and is not, so each platform keeps its own under config/<platform>/, regenerated by tools/py_embed/gen_pyconfig.sh and checked against the shared table. Three vendor patches, documented in docs/THIRD-PARTY.md: configure/configure.ac learn arm64 on macOS, and posixmodule.c undefines the process-control calls it hard-defines past pyconfig.h when building for iOS. macOS (ctest python.embed: every builtin imports, codecs and pickle work off the vendored Lib/), Android arm64 and iOS arm64 build. Linux needs a Linux host and Windows needs a MinGW-vs-MSVC decision; both are noted for step 4. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
/* Generated automatically from /Users/shenlei/Work/mt/metin2-client/extension/third_party/cpython-2.7.18/Modules/config.c.in by makesetup. */
|
||||
/* -*- C -*- ***********************************************
|
||||
Copyright (c) 2000, BeOpen.com.
|
||||
Copyright (c) 1995-2000, Corporation for National Research Initiatives.
|
||||
Copyright (c) 1990-1995, Stichting Mathematisch Centrum.
|
||||
All rights reserved.
|
||||
|
||||
See the file "Misc/COPYRIGHT" for information on usage and
|
||||
redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
******************************************************************/
|
||||
|
||||
/* Module configuration */
|
||||
|
||||
/* !!! !!! !!! This file is edited by the makesetup script !!! !!! !!! */
|
||||
|
||||
/* This file contains the table of built-in modules.
|
||||
See init_builtin() in import.c. */
|
||||
|
||||
#include "Python.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
extern void initthread(void);
|
||||
extern void initsignal(void);
|
||||
extern void initposix(void);
|
||||
extern void initerrno(void);
|
||||
extern void initpwd(void);
|
||||
extern void init_sre(void);
|
||||
extern void init_codecs(void);
|
||||
extern void init_weakref(void);
|
||||
extern void initzipimport(void);
|
||||
extern void init_symtable(void);
|
||||
extern void initarray(void);
|
||||
extern void initmath(void);
|
||||
extern void init_struct(void);
|
||||
extern void inittime(void);
|
||||
extern void initoperator(void);
|
||||
extern void init_random(void);
|
||||
extern void init_collections(void);
|
||||
extern void init_heapq(void);
|
||||
extern void inititertools(void);
|
||||
extern void initstrop(void);
|
||||
extern void init_functools(void);
|
||||
extern void initdatetime(void);
|
||||
extern void init_bisect(void);
|
||||
extern void init_locale(void);
|
||||
extern void initfcntl(void);
|
||||
extern void initselect(void);
|
||||
extern void initbinascii(void);
|
||||
extern void initcStringIO(void);
|
||||
extern void initcPickle(void);
|
||||
extern void initxxsubtype(void);
|
||||
|
||||
/* -- ADDMODULE MARKER 1 -- */
|
||||
|
||||
extern void PyMarshal_Init(void);
|
||||
extern void initimp(void);
|
||||
extern void initgc(void);
|
||||
extern void init_ast(void);
|
||||
extern void _PyWarnings_Init(void);
|
||||
|
||||
struct _inittab _PyImport_Inittab[] = {
|
||||
|
||||
{"thread", initthread},
|
||||
{"signal", initsignal},
|
||||
{"posix", initposix},
|
||||
{"errno", initerrno},
|
||||
{"pwd", initpwd},
|
||||
{"_sre", init_sre},
|
||||
{"_codecs", init_codecs},
|
||||
{"_weakref", init_weakref},
|
||||
{"zipimport", initzipimport},
|
||||
{"_symtable", init_symtable},
|
||||
{"array", initarray},
|
||||
{"math", initmath},
|
||||
{"_struct", init_struct},
|
||||
{"time", inittime},
|
||||
{"operator", initoperator},
|
||||
{"_random", init_random},
|
||||
{"_collections", init_collections},
|
||||
{"_heapq", init_heapq},
|
||||
{"itertools", inititertools},
|
||||
{"strop", initstrop},
|
||||
{"_functools", init_functools},
|
||||
{"datetime", initdatetime},
|
||||
{"_bisect", init_bisect},
|
||||
{"_locale", init_locale},
|
||||
{"fcntl", initfcntl},
|
||||
{"select", initselect},
|
||||
{"binascii", initbinascii},
|
||||
{"cStringIO", initcStringIO},
|
||||
{"cPickle", initcPickle},
|
||||
{"xxsubtype", initxxsubtype},
|
||||
|
||||
/* -- ADDMODULE MARKER 2 -- */
|
||||
|
||||
/* This module lives in marshal.c */
|
||||
{"marshal", PyMarshal_Init},
|
||||
|
||||
/* This lives in import.c */
|
||||
{"imp", initimp},
|
||||
|
||||
/* This lives in Python/Python-ast.c */
|
||||
{"_ast", init_ast},
|
||||
|
||||
/* These entries are here for sys.builtin_module_names */
|
||||
{"__main__", NULL},
|
||||
{"__builtin__", NULL},
|
||||
{"sys", NULL},
|
||||
{"exceptions", NULL},
|
||||
|
||||
/* This lives in gcmodule.c */
|
||||
{"gc", initgc},
|
||||
|
||||
/* This lives in _warnings.c */
|
||||
{"_warnings", _PyWarnings_Init},
|
||||
|
||||
/* Sentinel */
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user