-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
bpo-31904: Add cross-build support for VxWorks RTOS #11968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
721e8f5
09eafcc
a59146b
e4a6ac6
a42825e
694f01d
156d8e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Enable cpython build system to cross-build for VxWorks RTOS. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,8 @@ def get_platform(): | |
| return sys.platform | ||
| host_platform = get_platform() | ||
|
|
||
| _vxworks = ('vxworks' in host_platform) | ||
|
||
|
|
||
| # Were we compiled --with-pydebug or with #define Py_DEBUG? | ||
| COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS")) | ||
|
|
||
|
|
@@ -509,13 +511,14 @@ def add_multiarch_paths(self): | |
| finally: | ||
| os.unlink(tmpfile) | ||
|
|
||
| def add_gcc_paths(self): | ||
| gcc = sysconfig.get_config_var('CC') | ||
| tmpfile = os.path.join(self.build_temp, 'gccpaths') | ||
| def add_cross_compiling_paths(self): | ||
| cc = sysconfig.get_config_var('CC') | ||
| tmpfile = os.path.join(self.build_temp, 'ccpaths') | ||
| if not os.path.exists(self.build_temp): | ||
| os.makedirs(self.build_temp) | ||
| ret = os.system('%s -E -v - </dev/null 2>%s 1>/dev/null' % (gcc, tmpfile)) | ||
| ret = os.system('%s -E -v - </dev/null 2>%s 1>/dev/null' % (cc, tmpfile)) | ||
| is_gcc = False | ||
pxinwr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| is_clang = False | ||
| in_incdirs = False | ||
| inc_dirs = [] | ||
| lib_dirs = [] | ||
|
|
@@ -525,17 +528,19 @@ def add_gcc_paths(self): | |
| for line in fp.readlines(): | ||
| if line.startswith("gcc version"): | ||
| is_gcc = True | ||
| elif line.startswith("clang version"): | ||
| is_clang = True | ||
| elif line.startswith("#include <...>"): | ||
| in_incdirs = True | ||
| elif line.startswith("End of search list"): | ||
| in_incdirs = False | ||
| elif is_gcc and line.startswith("LIBRARY_PATH"): | ||
| elif (is_gcc or is_clang) and line.startswith("LIBRARY_PATH"): | ||
| for d in line.strip().split("=")[1].split(":"): | ||
| d = os.path.normpath(d) | ||
| if '/gcc/' not in d: | ||
| add_dir_to_list(self.compiler.library_dirs, | ||
| d) | ||
| elif is_gcc and in_incdirs and '/gcc/' not in line: | ||
| elif (is_gcc or is_clang) and in_incdirs and '/gcc/' not in line and '/clang/' not in line: | ||
| add_dir_to_list(self.compiler.include_dirs, | ||
| line.strip()) | ||
| finally: | ||
|
|
@@ -550,7 +555,7 @@ def detect_modules(self): | |
| add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | ||
| # only change this for cross builds for 3.3, issues on Mageia | ||
| if cross_compiling: | ||
| self.add_gcc_paths() | ||
| self.add_cross_compiling_paths() | ||
| self.add_multiarch_paths() | ||
|
|
||
| # Add paths specified in the environment variables LDFLAGS and | ||
|
|
@@ -722,7 +727,8 @@ def detect_modules(self): | |
| # pwd(3) | ||
| exts.append( Extension('pwd', ['pwdmodule.c']) ) | ||
| # grp(3) | ||
| exts.append( Extension('grp', ['grpmodule.c']) ) | ||
| if not _vxworks: | ||
| exts.append( Extension('grp', ['grpmodule.c']) ) | ||
| # spwd, shadow passwords | ||
| if (config_h_vars.get('HAVE_GETSPNAM', False) or | ||
| config_h_vars.get('HAVE_GETSPENT', False)): | ||
|
|
@@ -859,7 +865,12 @@ def detect_modules(self): | |
| libs = ['crypt'] | ||
| else: | ||
| libs = [] | ||
| exts.append( Extension('_crypt', ['_cryptmodule.c'], libraries=libs) ) | ||
|
|
||
| if not _vxworks: | ||
| exts.append( Extension('_crypt', ['_cryptmodule.c'], libraries=libs) ) | ||
| elif self.compiler.find_library_file(lib_dirs, 'OPENSSL'): | ||
| libs = ['OPENSSL'] | ||
| exts.append( Extension('_crypt', ['_cryptmodule.c'], libraries=libs) ) | ||
|
|
||
| # CSV files | ||
| exts.append( Extension('_csv', ['_csv.c']) ) | ||
|
|
@@ -868,8 +879,14 @@ def detect_modules(self): | |
| exts.append( Extension('_posixsubprocess', ['_posixsubprocess.c']) ) | ||
|
|
||
| # socket(2) | ||
| exts.append( Extension('_socket', ['socketmodule.c'], | ||
| depends = ['socketmodule.h']) ) | ||
| if not _vxworks: | ||
| exts.append( Extension('_socket', ['socketmodule.c'], | ||
| depends = ['socketmodule.h']) ) | ||
| elif self.compiler.find_library_file(lib_dirs, 'net'): | ||
| libs = ['net'] | ||
| exts.append( Extension('_socket', ['socketmodule.c'], | ||
| depends = ['socketmodule.h'], libraries=libs) ) | ||
|
|
||
| # Detect SSL support for the socket module (via _ssl) | ||
| ssl_ext, hashlib_ext = self._detect_openssl(inc_dirs, lib_dirs) | ||
| if ssl_ext is not None: | ||
|
|
@@ -1319,9 +1336,10 @@ class db_found(Exception): pass | |
|
|
||
| # Unix-only modules | ||
| if host_platform != 'win32': | ||
| # Steen Lumholt's termios module | ||
| exts.append( Extension('termios', ['termios.c']) ) | ||
| # Jeremy Hylton's rlimit interface | ||
| if not _vxworks: | ||
| # Steen Lumholt's termios module | ||
| exts.append( Extension('termios', ['termios.c']) ) | ||
| # Jeremy Hylton's rlimit interface | ||
| exts.append( Extension('resource', ['resource.c']) ) | ||
| else: | ||
| missing.extend(['resource', 'termios']) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.