From bb84fe1a34c5a08d24f35d97ace28ce02937af23 Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 2 Dec 2018 15:21:08 -0500 Subject: project, config/x86_64-linux-musl: created profiles/, refactored inittab bits. --- config/x86_64-linux-musl/config.c | 127 +++--------------------------------- profiles/linkage/inittab.h | 131 ++++++++++++++++++++++++++++++++++++++ profiles/linkage/static.h | 67 +++++++++++++++++++ project/extras.mk | 2 +- src/static/static.h | 62 ------------------ 5 files changed, 207 insertions(+), 182 deletions(-) create mode 100644 profiles/linkage/inittab.h create mode 100644 profiles/linkage/static.h delete mode 100644 src/static/static.h diff --git a/config/x86_64-linux-musl/config.c b/config/x86_64-linux-musl/config.c index 25bbc11..a4ec971 100644 --- a/config/x86_64-linux-musl/config.c +++ b/config/x86_64-linux-musl/config.c @@ -1,126 +1,15 @@ -#define PY_INIT_FUNC(x) extern void x(void) -#define PY_INIT_PTR(x) void (*x)(void) +#include "linkage/inittab.h" -PY_INIT_FUNC(initthread); -PY_INIT_FUNC(initsignal); -PY_INIT_FUNC(initposix); -PY_INIT_FUNC(initerrno); -PY_INIT_FUNC(initpwd); -PY_INIT_FUNC(init_sre); -PY_INIT_FUNC(init_codecs); -PY_INIT_FUNC(init_weakref); -PY_INIT_FUNC(initzipimport); -PY_INIT_FUNC(init_symtable); -PY_INIT_FUNC(initxxsubtype); - -PY_INIT_FUNC(PyMarshal_Init); -PY_INIT_FUNC(initimp); -PY_INIT_FUNC(initgc); -PY_INIT_FUNC(init_ast); -PY_INIT_FUNC(_PyWarnings_Init); - -#ifdef PY_ALL_STATIC - -#include "static.h" - -#define PY_IMPORT_INITTAB_STATIC \ - {"_bisect", init_bisect}, \ - {"_codecs_cn", init_codecs_cn}, \ - {"_codecs_hk", init_codecs_hk}, \ - {"_codecs_iso2022", init_codecs_iso2022}, \ - {"_codecs_jp", init_codecs_jp}, \ - {"_codecs_kr", init_codecs_kr}, \ - {"_codecs_tw", init_codecs_tw}, \ - {"_collections", init_collections}, \ - {"_csv", init_csv}, \ - {"_ctypes", init_ctypes}, \ - {"_ctypes_test", init_ctypes_test}, \ - {"_curses", init_curses}, \ - {"_curses_panel", init_curses_panel}, \ - {"_elementtree", init_elementtree}, \ - {"_functools", init_functools}, \ - {"_hashlib", init_hashlib}, \ - {"_heapq", init_heapq}, \ - {"_hotshot", init_hotshot}, \ - {"_io", init_io}, \ - {"_json", init_json}, \ - {"_locale", init_locale}, \ - {"_lsprof", init_lsprof}, \ - {"_multibytecodec", init_multibytecodec}, \ - {"_multiprocessing", init_multiprocessing}, \ - {"_random", init_random}, \ - {"_socket", init_socket}, \ - {"_sqlite3", init_sqlite3}, \ - {"_ssl", init_ssl}, \ - {"_struct", init_struct}, \ - {"_testcapi", init_testcapi}, \ - {"array", initarray}, \ - {"audioop", initaudioop}, \ - {"binascii", initbinascii}, \ - {"bz2", initbz2}, \ - {"cPickle", initcPickle}, \ - {"cStringIO", initcStringIO}, \ - {"cmath", initcmath}, \ - {"crypt", initcrypt}, \ - {"datetime", initdatetime}, \ - {"dbm", initdbm}, \ - {"fcntl", initfcntl}, \ - {"future_builtins", initfuture_builtins}, \ - {"gdbm", initgdbm}, \ - {"grp", initgrp}, \ - {"itertools", inititertools}, \ - {"linuxaudiodev", initlinuxaudiodev}, \ - {"math", initmath}, \ - {"mmap", initmmap}, \ - {"operator", initoperator}, \ - {"ossaudiodev", initossaudiodev}, \ - {"parser", initparser}, \ - {"pyexpat", initpyexpat}, \ - {"readline", initreadline}, \ - {"resource", initresource}, \ - {"select", initselect}, \ - {"spwd", initspwd}, \ - {"strop", initstrop}, \ - {"syslog", initsyslog}, \ - {"termios", inittermios}, \ - {"time", inittime}, \ - {"unicodedata", initunicodedata}, \ - {"zlib", initzlib}, \ - -#else +struct _inittab _PyImport_Inittab[] = { -#define PY_IMPORT_INITTAB_STATIC + PY_IMPORT_INITTAB_BASE, + PY_IMPORT_INITTAB_COMMON, +#ifdef PY_ALL_STATIC + PY_IMPORT_INITTAB_ANYOS_CORE, + PY_IMPORT_INITTAB_ANYOS_AUDIO, + PY_IMPORT_INITTAB_LINUX_AUDIO, #endif -struct _inittab { - char * name; - PY_INIT_PTR(initfunc); -}; - -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}, - {"xxsubtype", initxxsubtype}, - - PY_IMPORT_INITTAB_STATIC - - {"marshal", PyMarshal_Init}, - {"imp", initimp}, - {"_ast", init_ast}, - {"__main__", 0}, - {"__builtin__", 0}, - {"sys", 0}, - {"exceptions", 0}, - {"gc", initgc}, - {"_warnings", _PyWarnings_Init}, {0, 0} }; diff --git a/profiles/linkage/inittab.h b/profiles/linkage/inittab.h new file mode 100644 index 0000000..dd22809 --- /dev/null +++ b/profiles/linkage/inittab.h @@ -0,0 +1,131 @@ +#ifndef PY_LINKAGE_INITTAB_H +#define PY_LINKAGE_INITTAB_H + +#define PY_INIT_FUNC(x) extern void x(void) +#define PY_INIT_PTR(x) void (*x)(void) + +#ifdef PY_ALL_STATIC +#include "static.h" +#endif + +struct _inittab { + char * name; + PY_INIT_PTR(initfunc); +}; + +PY_INIT_FUNC(initthread); +PY_INIT_FUNC(initsignal); +PY_INIT_FUNC(initposix); +PY_INIT_FUNC(initerrno); +PY_INIT_FUNC(initpwd); +PY_INIT_FUNC(init_sre); +PY_INIT_FUNC(init_codecs); +PY_INIT_FUNC(init_weakref); +PY_INIT_FUNC(initzipimport); +PY_INIT_FUNC(init_symtable); +PY_INIT_FUNC(initxxsubtype); + +PY_INIT_FUNC(PyMarshal_Init); +PY_INIT_FUNC(initimp); +PY_INIT_FUNC(initgc); +PY_INIT_FUNC(init_ast); +PY_INIT_FUNC(_PyWarnings_Init); + +#define PY_IMPORT_INITTAB_BASE \ + {"__main__", 0}, \ + {"__builtin__", 0}, \ + {"sys", 0}, \ + {"exceptions", 0}, \ + {"_ast", init_ast}, \ + {"gc", initgc}, \ + {"imp", initimp}, \ + {"marshal", PyMarshal_Init}, \ + {"_warnings", _PyWarnings_Init} + + +#define PY_IMPORT_INITTAB_COMMON \ + {"thread", initthread}, \ + {"signal", initsignal}, \ + {"posix", initposix}, \ + {"errno", initerrno}, \ + {"pwd", initpwd}, \ + {"_sre", init_sre}, \ + {"_codecs", init_codecs}, \ + {"_weakref", init_weakref}, \ + {"zipimport", initzipimport}, \ + {"_symtable", init_symtable}, \ + {"xxsubtype", initxxsubtype} + + +#define PY_IMPORT_INITTAB_ANYOS_CORE \ + {"_bisect", init_bisect}, \ + {"_codecs_cn", init_codecs_cn}, \ + {"_codecs_hk", init_codecs_hk}, \ + {"_codecs_iso2022", init_codecs_iso2022}, \ + {"_codecs_jp", init_codecs_jp}, \ + {"_codecs_kr", init_codecs_kr}, \ + {"_codecs_tw", init_codecs_tw}, \ + {"_collections", init_collections}, \ + {"_csv", init_csv}, \ + {"_ctypes", init_ctypes}, \ + {"_ctypes_test", init_ctypes_test}, \ + {"_curses", init_curses}, \ + {"_curses_panel", init_curses_panel}, \ + {"_elementtree", init_elementtree}, \ + {"_functools", init_functools}, \ + {"_hashlib", init_hashlib}, \ + {"_heapq", init_heapq}, \ + {"_hotshot", init_hotshot}, \ + {"_io", init_io}, \ + {"_json", init_json}, \ + {"_locale", init_locale}, \ + {"_lsprof", init_lsprof}, \ + {"_multibytecodec", init_multibytecodec}, \ + {"_multiprocessing", init_multiprocessing}, \ + {"_random", init_random}, \ + {"_socket", init_socket}, \ + {"_sqlite3", init_sqlite3}, \ + {"_ssl", init_ssl}, \ + {"_struct", init_struct}, \ + {"_testcapi", init_testcapi}, \ + {"array", initarray}, \ + {"binascii", initbinascii}, \ + {"bz2", initbz2}, \ + {"cPickle", initcPickle}, \ + {"cStringIO", initcStringIO}, \ + {"cmath", initcmath}, \ + {"crypt", initcrypt}, \ + {"datetime", initdatetime}, \ + {"dbm", initdbm}, \ + {"fcntl", initfcntl}, \ + {"future_builtins", initfuture_builtins}, \ + {"gdbm", initgdbm}, \ + {"grp", initgrp}, \ + {"itertools", inititertools}, \ + {"math", initmath}, \ + {"mmap", initmmap}, \ + {"operator", initoperator}, \ + {"ossaudiodev", initossaudiodev}, \ + {"parser", initparser}, \ + {"pyexpat", initpyexpat}, \ + {"readline", initreadline}, \ + {"resource", initresource}, \ + {"select", initselect}, \ + {"spwd", initspwd}, \ + {"strop", initstrop}, \ + {"syslog", initsyslog}, \ + {"termios", inittermios}, \ + {"time", inittime}, \ + {"unicodedata", initunicodedata}, \ + {"zlib", initzlib} + + +#define PY_IMPORT_INITTAB_ANYOS_AUDIO \ + {"audioop", initaudioop}, \ + {"ossaudiodev", initossaudiodev} + + +#define PY_IMPORT_INITTAB_LINUX_AUDIO \ + {"linuxaudiodev", initlinuxaudiodev} + +#endif diff --git a/profiles/linkage/static.h b/profiles/linkage/static.h new file mode 100644 index 0000000..bf18523 --- /dev/null +++ b/profiles/linkage/static.h @@ -0,0 +1,67 @@ +#ifndef PY_LINKAGE_STATIC_H +#define PY_LINKAGE_STATIC_H + +PY_INIT_FUNC(init_bisect); +PY_INIT_FUNC(init_codecs_cn); +PY_INIT_FUNC(init_codecs_hk); +PY_INIT_FUNC(init_codecs_iso2022); +PY_INIT_FUNC(init_codecs_jp); +PY_INIT_FUNC(init_codecs_kr); +PY_INIT_FUNC(init_codecs_tw); +PY_INIT_FUNC(init_collections); +PY_INIT_FUNC(init_csv); +PY_INIT_FUNC(init_ctypes); +PY_INIT_FUNC(init_ctypes_test); +PY_INIT_FUNC(init_curses); +PY_INIT_FUNC(init_curses_panel); +PY_INIT_FUNC(init_elementtree); +PY_INIT_FUNC(init_functools); +PY_INIT_FUNC(init_hashlib); +PY_INIT_FUNC(init_heapq); +PY_INIT_FUNC(init_hotshot); +PY_INIT_FUNC(init_io); +PY_INIT_FUNC(init_json); +PY_INIT_FUNC(init_locale); +PY_INIT_FUNC(init_lsprof); +PY_INIT_FUNC(init_multibytecodec); +PY_INIT_FUNC(init_multiprocessing); +PY_INIT_FUNC(init_random); +PY_INIT_FUNC(init_socket); +PY_INIT_FUNC(init_sqlite3); +PY_INIT_FUNC(init_ssl); +PY_INIT_FUNC(init_struct); +PY_INIT_FUNC(init_testcapi); +PY_INIT_FUNC(initarray); +PY_INIT_FUNC(initaudioop); +PY_INIT_FUNC(initbinascii); +PY_INIT_FUNC(initbz2); +PY_INIT_FUNC(initcPickle); +PY_INIT_FUNC(initcStringIO); +PY_INIT_FUNC(initcmath); +PY_INIT_FUNC(initcrypt); +PY_INIT_FUNC(initdatetime); +PY_INIT_FUNC(initdbm); +PY_INIT_FUNC(initfcntl); +PY_INIT_FUNC(initfuture_builtins); +PY_INIT_FUNC(initgdbm); +PY_INIT_FUNC(initgrp); +PY_INIT_FUNC(inititertools); +PY_INIT_FUNC(initlinuxaudiodev); +PY_INIT_FUNC(initmath); +PY_INIT_FUNC(initmmap); +PY_INIT_FUNC(initoperator); +PY_INIT_FUNC(initossaudiodev); +PY_INIT_FUNC(initparser); +PY_INIT_FUNC(initpyexpat); +PY_INIT_FUNC(initreadline); +PY_INIT_FUNC(initresource); +PY_INIT_FUNC(initselect); +PY_INIT_FUNC(initspwd); +PY_INIT_FUNC(initstrop); +PY_INIT_FUNC(initsyslog); +PY_INIT_FUNC(inittermios); +PY_INIT_FUNC(inittime); +PY_INIT_FUNC(initunicodedata); +PY_INIT_FUNC(initzlib); + +#endif diff --git a/project/extras.mk b/project/extras.mk index 6e20198..f8bfa4b 100644 --- a/project/extras.mk +++ b/project/extras.mk @@ -1,6 +1,7 @@ # build info PYTHON_VER = 2.7 +CFLAGS_COMMON += -I$(PROJECT_DIR)/profiles CFLAGS_COMMON += -I$(SOURCE_DIR)/Include CFLAGS_CONFIG += -DPLATFORM=\"$(PYTHON_PLATFORM)\" @@ -11,7 +12,6 @@ CFLAGS_CONFIG += -DVPATH=\"$(SOURCE_DIR)\" CFLAGS_CONFIG += -DPYTHONPATH=\"$(PYTHON_PATH)\" ifeq ($(ALL_STATIC),yes) - CFLAGS_STATIC += -I$(PROJECT_DIR)/src/static CFLAGS_STATIC += -DPY_ALL_STATIC LDFLAGS_STATIC += $(PYEXT_SUBSET_STATIC) diff --git a/src/static/static.h b/src/static/static.h deleted file mode 100644 index 0108f81..0000000 --- a/src/static/static.h +++ /dev/null @@ -1,62 +0,0 @@ -PY_INIT_FUNC(init_bisect); -PY_INIT_FUNC(init_codecs_cn); -PY_INIT_FUNC(init_codecs_hk); -PY_INIT_FUNC(init_codecs_iso2022); -PY_INIT_FUNC(init_codecs_jp); -PY_INIT_FUNC(init_codecs_kr); -PY_INIT_FUNC(init_codecs_tw); -PY_INIT_FUNC(init_collections); -PY_INIT_FUNC(init_csv); -PY_INIT_FUNC(init_ctypes); -PY_INIT_FUNC(init_ctypes_test); -PY_INIT_FUNC(init_curses); -PY_INIT_FUNC(init_curses_panel); -PY_INIT_FUNC(init_elementtree); -PY_INIT_FUNC(init_functools); -PY_INIT_FUNC(init_hashlib); -PY_INIT_FUNC(init_heapq); -PY_INIT_FUNC(init_hotshot); -PY_INIT_FUNC(init_io); -PY_INIT_FUNC(init_json); -PY_INIT_FUNC(init_locale); -PY_INIT_FUNC(init_lsprof); -PY_INIT_FUNC(init_multibytecodec); -PY_INIT_FUNC(init_multiprocessing); -PY_INIT_FUNC(init_random); -PY_INIT_FUNC(init_socket); -PY_INIT_FUNC(init_sqlite3); -PY_INIT_FUNC(init_ssl); -PY_INIT_FUNC(init_struct); -PY_INIT_FUNC(init_testcapi); -PY_INIT_FUNC(initarray); -PY_INIT_FUNC(initaudioop); -PY_INIT_FUNC(initbinascii); -PY_INIT_FUNC(initbz2); -PY_INIT_FUNC(initcPickle); -PY_INIT_FUNC(initcStringIO); -PY_INIT_FUNC(initcmath); -PY_INIT_FUNC(initcrypt); -PY_INIT_FUNC(initdatetime); -PY_INIT_FUNC(initdbm); -PY_INIT_FUNC(initfcntl); -PY_INIT_FUNC(initfuture_builtins); -PY_INIT_FUNC(initgdbm); -PY_INIT_FUNC(initgrp); -PY_INIT_FUNC(inititertools); -PY_INIT_FUNC(initlinuxaudiodev); -PY_INIT_FUNC(initmath); -PY_INIT_FUNC(initmmap); -PY_INIT_FUNC(initoperator); -PY_INIT_FUNC(initossaudiodev); -PY_INIT_FUNC(initparser); -PY_INIT_FUNC(initpyexpat); -PY_INIT_FUNC(initreadline); -PY_INIT_FUNC(initresource); -PY_INIT_FUNC(initselect); -PY_INIT_FUNC(initspwd); -PY_INIT_FUNC(initstrop); -PY_INIT_FUNC(initsyslog); -PY_INIT_FUNC(inittermios); -PY_INIT_FUNC(inittime); -PY_INIT_FUNC(initunicodedata); -PY_INIT_FUNC(initzlib); -- cgit v1.2.3