bpo-31904: Add cross-build support for VxWorks RTOS (GH-11968)
This commit is contained in:
parent
53b9e1a1c1
commit
32f5fdd7f4
|
@ -14,6 +14,10 @@ extern "C" {
|
||||||
#define DELIM L';'
|
#define DELIM L';'
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __VXWORKS__
|
||||||
|
#define DELIM L';'
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Filename separator */
|
/* Filename separator */
|
||||||
#ifndef SEP
|
#ifndef SEP
|
||||||
#define SEP L'/'
|
#define SEP L'/'
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Enable build system to cross-build for VxWorks RTOS.
|
|
@ -3268,6 +3268,9 @@ then
|
||||||
*-*-cygwin*)
|
*-*-cygwin*)
|
||||||
ac_sys_system=Cygwin
|
ac_sys_system=Cygwin
|
||||||
;;
|
;;
|
||||||
|
*-*-vxworks*)
|
||||||
|
ac_sys_system=VxWorks
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
# for now, limit cross builds to known configurations
|
# for now, limit cross builds to known configurations
|
||||||
MACHDEP="unknown"
|
MACHDEP="unknown"
|
||||||
|
@ -3312,6 +3315,9 @@ if test "$cross_compiling" = yes; then
|
||||||
*-*-cygwin*)
|
*-*-cygwin*)
|
||||||
_host_cpu=
|
_host_cpu=
|
||||||
;;
|
;;
|
||||||
|
*-*-vxworks*)
|
||||||
|
_host_cpu=$host_cpu
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
# for now, limit cross builds to known configurations
|
# for now, limit cross builds to known configurations
|
||||||
MACHDEP="unknown"
|
MACHDEP="unknown"
|
||||||
|
@ -3399,6 +3405,11 @@ $as_echo "#define _BSD_SOURCE 1" >>confdefs.h
|
||||||
QNX/6.3.2)
|
QNX/6.3.2)
|
||||||
define_xopen_source=no
|
define_xopen_source=no
|
||||||
;;
|
;;
|
||||||
|
# On VxWorks, defining _XOPEN_SOURCE causes compile failures
|
||||||
|
# in network headers still using system V types.
|
||||||
|
VxWorks/*)
|
||||||
|
define_xopen_source=no
|
||||||
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -5283,6 +5294,8 @@ cat >> conftest.c <<EOF
|
||||||
i386-gnu
|
i386-gnu
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
darwin
|
darwin
|
||||||
|
#elif defined(__VXWORKS__)
|
||||||
|
vxworks
|
||||||
#else
|
#else
|
||||||
# error unknown platform triplet
|
# error unknown platform triplet
|
||||||
#endif
|
#endif
|
||||||
|
@ -9391,7 +9404,7 @@ then
|
||||||
BLDSHARED="$LDSHARED"
|
BLDSHARED="$LDSHARED"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
Linux*|GNU*|QNX*)
|
Linux*|GNU*|QNX*|VxWorks*)
|
||||||
LDSHARED='$(CC) -shared'
|
LDSHARED='$(CC) -shared'
|
||||||
LDCXXSHARED='$(CXX) -shared';;
|
LDCXXSHARED='$(CXX) -shared';;
|
||||||
FreeBSD*)
|
FreeBSD*)
|
||||||
|
@ -9472,6 +9485,8 @@ then
|
||||||
then CCSHARED="-fPIC"
|
then CCSHARED="-fPIC"
|
||||||
else CCSHARED="-Kpic -belf"
|
else CCSHARED="-Kpic -belf"
|
||||||
fi;;
|
fi;;
|
||||||
|
VxWorks*)
|
||||||
|
CCSHARED="-fpic -D__SO_PICABILINUX__ -ftls-model=global-dynamic"
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CCSHARED" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CCSHARED" >&5
|
||||||
|
@ -9530,6 +9545,8 @@ then
|
||||||
# to 2048 kilobytes so that the stack doesn't overflow
|
# to 2048 kilobytes so that the stack doesn't overflow
|
||||||
# when running test_compile.py.
|
# when running test_compile.py.
|
||||||
LINKFORSHARED='-Wl,-E -N 2048K';;
|
LINKFORSHARED='-Wl,-E -N 2048K';;
|
||||||
|
VxWorks*)
|
||||||
|
LINKFORSHARED='--export-dynamic';;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LINKFORSHARED" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LINKFORSHARED" >&5
|
||||||
|
@ -15079,7 +15096,7 @@ $as_echo "$SOABI" >&6; }
|
||||||
|
|
||||||
|
|
||||||
case $ac_sys_system in
|
case $ac_sys_system in
|
||||||
Linux*|GNU*|Darwin)
|
Linux*|GNU*|Darwin|VxWorks)
|
||||||
EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};;
|
EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};;
|
||||||
*)
|
*)
|
||||||
EXT_SUFFIX=${SHLIB_SUFFIX};;
|
EXT_SUFFIX=${SHLIB_SUFFIX};;
|
||||||
|
|
21
configure.ac
21
configure.ac
|
@ -379,6 +379,9 @@ then
|
||||||
*-*-cygwin*)
|
*-*-cygwin*)
|
||||||
ac_sys_system=Cygwin
|
ac_sys_system=Cygwin
|
||||||
;;
|
;;
|
||||||
|
*-*-vxworks*)
|
||||||
|
ac_sys_system=VxWorks
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
# for now, limit cross builds to known configurations
|
# for now, limit cross builds to known configurations
|
||||||
MACHDEP="unknown"
|
MACHDEP="unknown"
|
||||||
|
@ -423,6 +426,9 @@ if test "$cross_compiling" = yes; then
|
||||||
*-*-cygwin*)
|
*-*-cygwin*)
|
||||||
_host_cpu=
|
_host_cpu=
|
||||||
;;
|
;;
|
||||||
|
*-*-vxworks*)
|
||||||
|
_host_cpu=$host_cpu
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
# for now, limit cross builds to known configurations
|
# for now, limit cross builds to known configurations
|
||||||
MACHDEP="unknown"
|
MACHDEP="unknown"
|
||||||
|
@ -507,6 +513,11 @@ case $ac_sys_system/$ac_sys_release in
|
||||||
QNX/6.3.2)
|
QNX/6.3.2)
|
||||||
define_xopen_source=no
|
define_xopen_source=no
|
||||||
;;
|
;;
|
||||||
|
# On VxWorks, defining _XOPEN_SOURCE causes compile failures
|
||||||
|
# in network headers still using system V types.
|
||||||
|
VxWorks/*)
|
||||||
|
define_xopen_source=no
|
||||||
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -829,6 +840,8 @@ cat >> conftest.c <<EOF
|
||||||
i386-gnu
|
i386-gnu
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
darwin
|
darwin
|
||||||
|
#elif defined(__VXWORKS__)
|
||||||
|
vxworks
|
||||||
#else
|
#else
|
||||||
# error unknown platform triplet
|
# error unknown platform triplet
|
||||||
#endif
|
#endif
|
||||||
|
@ -2555,7 +2568,7 @@ then
|
||||||
BLDSHARED="$LDSHARED"
|
BLDSHARED="$LDSHARED"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
Linux*|GNU*|QNX*)
|
Linux*|GNU*|QNX*|VxWorks*)
|
||||||
LDSHARED='$(CC) -shared'
|
LDSHARED='$(CC) -shared'
|
||||||
LDCXXSHARED='$(CXX) -shared';;
|
LDCXXSHARED='$(CXX) -shared';;
|
||||||
FreeBSD*)
|
FreeBSD*)
|
||||||
|
@ -2634,6 +2647,8 @@ then
|
||||||
then CCSHARED="-fPIC"
|
then CCSHARED="-fPIC"
|
||||||
else CCSHARED="-Kpic -belf"
|
else CCSHARED="-Kpic -belf"
|
||||||
fi;;
|
fi;;
|
||||||
|
VxWorks*)
|
||||||
|
CCSHARED="-fpic -D__SO_PICABILINUX__ -ftls-model=global-dynamic"
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
AC_MSG_RESULT($CCSHARED)
|
AC_MSG_RESULT($CCSHARED)
|
||||||
|
@ -2690,6 +2705,8 @@ then
|
||||||
# to 2048 kilobytes so that the stack doesn't overflow
|
# to 2048 kilobytes so that the stack doesn't overflow
|
||||||
# when running test_compile.py.
|
# when running test_compile.py.
|
||||||
LINKFORSHARED='-Wl,-E -N 2048K';;
|
LINKFORSHARED='-Wl,-E -N 2048K';;
|
||||||
|
VxWorks*)
|
||||||
|
LINKFORSHARED='--export-dynamic';;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
AC_MSG_RESULT($LINKFORSHARED)
|
AC_MSG_RESULT($LINKFORSHARED)
|
||||||
|
@ -4578,7 +4595,7 @@ AC_MSG_RESULT($SOABI)
|
||||||
|
|
||||||
AC_SUBST(EXT_SUFFIX)
|
AC_SUBST(EXT_SUFFIX)
|
||||||
case $ac_sys_system in
|
case $ac_sys_system in
|
||||||
Linux*|GNU*|Darwin)
|
Linux*|GNU*|Darwin|VxWorks)
|
||||||
EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};;
|
EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};;
|
||||||
*)
|
*)
|
||||||
EXT_SUFFIX=${SHLIB_SUFFIX};;
|
EXT_SUFFIX=${SHLIB_SUFFIX};;
|
||||||
|
|
32
setup.py
32
setup.py
|
@ -44,6 +44,8 @@ def get_platform():
|
||||||
return sys.platform
|
return sys.platform
|
||||||
host_platform = get_platform()
|
host_platform = get_platform()
|
||||||
|
|
||||||
|
VXWORKS = ('vxworks' in host_platform)
|
||||||
|
|
||||||
# Were we compiled --with-pydebug or with #define Py_DEBUG?
|
# Were we compiled --with-pydebug or with #define Py_DEBUG?
|
||||||
COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
|
COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
|
||||||
|
|
||||||
|
@ -509,13 +511,14 @@ class PyBuildExt(build_ext):
|
||||||
finally:
|
finally:
|
||||||
os.unlink(tmpfile)
|
os.unlink(tmpfile)
|
||||||
|
|
||||||
def add_gcc_paths(self):
|
def add_cross_compiling_paths(self):
|
||||||
gcc = sysconfig.get_config_var('CC')
|
cc = sysconfig.get_config_var('CC')
|
||||||
tmpfile = os.path.join(self.build_temp, 'gccpaths')
|
tmpfile = os.path.join(self.build_temp, 'ccpaths')
|
||||||
if not os.path.exists(self.build_temp):
|
if not os.path.exists(self.build_temp):
|
||||||
os.makedirs(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
|
is_gcc = False
|
||||||
|
is_clang = False
|
||||||
in_incdirs = False
|
in_incdirs = False
|
||||||
inc_dirs = []
|
inc_dirs = []
|
||||||
lib_dirs = []
|
lib_dirs = []
|
||||||
|
@ -525,17 +528,19 @@ class PyBuildExt(build_ext):
|
||||||
for line in fp.readlines():
|
for line in fp.readlines():
|
||||||
if line.startswith("gcc version"):
|
if line.startswith("gcc version"):
|
||||||
is_gcc = True
|
is_gcc = True
|
||||||
|
elif line.startswith("clang version"):
|
||||||
|
is_clang = True
|
||||||
elif line.startswith("#include <...>"):
|
elif line.startswith("#include <...>"):
|
||||||
in_incdirs = True
|
in_incdirs = True
|
||||||
elif line.startswith("End of search list"):
|
elif line.startswith("End of search list"):
|
||||||
in_incdirs = False
|
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(":"):
|
for d in line.strip().split("=")[1].split(":"):
|
||||||
d = os.path.normpath(d)
|
d = os.path.normpath(d)
|
||||||
if '/gcc/' not in d:
|
if '/gcc/' not in d:
|
||||||
add_dir_to_list(self.compiler.library_dirs,
|
add_dir_to_list(self.compiler.library_dirs,
|
||||||
d)
|
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,
|
add_dir_to_list(self.compiler.include_dirs,
|
||||||
line.strip())
|
line.strip())
|
||||||
finally:
|
finally:
|
||||||
|
@ -550,7 +555,7 @@ class PyBuildExt(build_ext):
|
||||||
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
|
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
|
||||||
# only change this for cross builds for 3.3, issues on Mageia
|
# only change this for cross builds for 3.3, issues on Mageia
|
||||||
if cross_compiling:
|
if cross_compiling:
|
||||||
self.add_gcc_paths()
|
self.add_cross_compiling_paths()
|
||||||
self.add_multiarch_paths()
|
self.add_multiarch_paths()
|
||||||
|
|
||||||
# Add paths specified in the environment variables LDFLAGS and
|
# Add paths specified in the environment variables LDFLAGS and
|
||||||
|
@ -722,6 +727,7 @@ class PyBuildExt(build_ext):
|
||||||
# pwd(3)
|
# pwd(3)
|
||||||
exts.append( Extension('pwd', ['pwdmodule.c']) )
|
exts.append( Extension('pwd', ['pwdmodule.c']) )
|
||||||
# grp(3)
|
# grp(3)
|
||||||
|
if not VXWORKS:
|
||||||
exts.append( Extension('grp', ['grpmodule.c']) )
|
exts.append( Extension('grp', ['grpmodule.c']) )
|
||||||
# spwd, shadow passwords
|
# spwd, shadow passwords
|
||||||
if (config_h_vars.get('HAVE_GETSPNAM', False) or
|
if (config_h_vars.get('HAVE_GETSPNAM', False) or
|
||||||
|
@ -859,6 +865,11 @@ class PyBuildExt(build_ext):
|
||||||
libs = ['crypt']
|
libs = ['crypt']
|
||||||
else:
|
else:
|
||||||
libs = []
|
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) )
|
exts.append( Extension('_crypt', ['_cryptmodule.c'], libraries=libs) )
|
||||||
|
|
||||||
# CSV files
|
# CSV files
|
||||||
|
@ -868,8 +879,14 @@ class PyBuildExt(build_ext):
|
||||||
exts.append( Extension('_posixsubprocess', ['_posixsubprocess.c']) )
|
exts.append( Extension('_posixsubprocess', ['_posixsubprocess.c']) )
|
||||||
|
|
||||||
# socket(2)
|
# socket(2)
|
||||||
|
if not VXWORKS:
|
||||||
exts.append( Extension('_socket', ['socketmodule.c'],
|
exts.append( Extension('_socket', ['socketmodule.c'],
|
||||||
depends = ['socketmodule.h']) )
|
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)
|
# Detect SSL support for the socket module (via _ssl)
|
||||||
ssl_ext, hashlib_ext = self._detect_openssl(inc_dirs, lib_dirs)
|
ssl_ext, hashlib_ext = self._detect_openssl(inc_dirs, lib_dirs)
|
||||||
if ssl_ext is not None:
|
if ssl_ext is not None:
|
||||||
|
@ -1319,6 +1336,7 @@ class PyBuildExt(build_ext):
|
||||||
|
|
||||||
# Unix-only modules
|
# Unix-only modules
|
||||||
if host_platform != 'win32':
|
if host_platform != 'win32':
|
||||||
|
if not VXWORKS:
|
||||||
# Steen Lumholt's termios module
|
# Steen Lumholt's termios module
|
||||||
exts.append( Extension('termios', ['termios.c']) )
|
exts.append( Extension('termios', ['termios.c']) )
|
||||||
# Jeremy Hylton's rlimit interface
|
# Jeremy Hylton's rlimit interface
|
||||||
|
|
Loading…
Reference in New Issue