Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Include/osdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ extern "C" {
#define DELIM L';'
#endif

#ifdef __VXWORKS__
#define DELIM L';'
#endif

/* Filename separator */
#ifndef SEP
#define SEP L'/'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Enable cpython build system to cross-build for VxWorks RTOS.
23 changes: 20 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -3268,6 +3268,9 @@ then
*-*-cygwin*)
ac_sys_system=Cygwin
;;
*-*-vxworks*)
ac_sys_system=VxWorks
;;
*)
# for now, limit cross builds to known configurations
MACHDEP="unknown"
Expand Down Expand Up @@ -3312,6 +3315,9 @@ if test "$cross_compiling" = yes; then
*-*-cygwin*)
_host_cpu=
;;
*-*-vxworks*)
_host_cpu=$host_cpu
;;
*)
# for now, limit cross builds to known configurations
MACHDEP="unknown"
Expand Down Expand Up @@ -3399,6 +3405,11 @@ $as_echo "#define _BSD_SOURCE 1" >>confdefs.h
QNX/6.3.2)
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

Expand Down Expand Up @@ -5283,6 +5294,8 @@ cat >> conftest.c <<EOF
i386-gnu
#elif defined(__APPLE__)
darwin
#elif defined(__VXWORKS__)
vxworks
#else
# error unknown platform triplet
#endif
Expand Down Expand Up @@ -9391,7 +9404,7 @@ then
BLDSHARED="$LDSHARED"
fi
;;
Linux*|GNU*|QNX*)
Linux*|GNU*|QNX*|VxWorks*)
LDSHARED='$(CC) -shared'
LDCXXSHARED='$(CXX) -shared';;
FreeBSD*)
Expand Down Expand Up @@ -9472,6 +9485,8 @@ then
then CCSHARED="-fPIC"
else CCSHARED="-Kpic -belf"
fi;;
VxWorks*)
CCSHARED="-fpic -D__SO_PICABILINUX__ -ftls-model=global-dynamic"
esac
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CCSHARED" >&5
Expand Down Expand Up @@ -9530,6 +9545,8 @@ then
# to 2048 kilobytes so that the stack doesn't overflow
# when running test_compile.py.
LINKFORSHARED='-Wl,-E -N 2048K';;
VxWorks*)
LINKFORSHARED='--export-dynamic';;
esac
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LINKFORSHARED" >&5
Expand Down Expand Up @@ -11459,7 +11476,7 @@ for ac_func in alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
sigtimedwait sigwait sigwaitinfo snprintf strftime strlcpy strsignal symlinkat sync \
sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
truncate uname unlinkat unsetenv utimensat utimes waitid waitpid wait3 wait4 \
wcscoll wcsftime wcsxfrm wmemcmp writev _getpty
wcscoll wcsftime wcsxfrm wmemcmp writev _getpty rtpSpawn
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
Expand Down Expand Up @@ -15079,7 +15096,7 @@ $as_echo "$SOABI" >&6; }


case $ac_sys_system in
Linux*|GNU*|Darwin)
Linux*|GNU*|Darwin|VxWorks)
EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};;
*)
EXT_SUFFIX=${SHLIB_SUFFIX};;
Expand Down
23 changes: 20 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,9 @@ then
*-*-cygwin*)
ac_sys_system=Cygwin
;;
*-*-vxworks*)
ac_sys_system=VxWorks
;;
*)
# for now, limit cross builds to known configurations
MACHDEP="unknown"
Expand Down Expand Up @@ -423,6 +426,9 @@ if test "$cross_compiling" = yes; then
*-*-cygwin*)
_host_cpu=
;;
*-*-vxworks*)
_host_cpu=$host_cpu
;;
*)
# for now, limit cross builds to known configurations
MACHDEP="unknown"
Expand Down Expand Up @@ -507,6 +513,11 @@ case $ac_sys_system/$ac_sys_release in
QNX/6.3.2)
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

Expand Down Expand Up @@ -829,6 +840,8 @@ cat >> conftest.c <<EOF
i386-gnu
#elif defined(__APPLE__)
darwin
#elif defined(__VXWORKS__)
vxworks
#else
# error unknown platform triplet
#endif
Expand Down Expand Up @@ -2555,7 +2568,7 @@ then
BLDSHARED="$LDSHARED"
fi
;;
Linux*|GNU*|QNX*)
Linux*|GNU*|QNX*|VxWorks*)
LDSHARED='$(CC) -shared'
LDCXXSHARED='$(CXX) -shared';;
FreeBSD*)
Expand Down Expand Up @@ -2634,6 +2647,8 @@ then
then CCSHARED="-fPIC"
else CCSHARED="-Kpic -belf"
fi;;
VxWorks*)
CCSHARED="-fpic -D__SO_PICABILINUX__ -ftls-model=global-dynamic"
esac
fi
AC_MSG_RESULT($CCSHARED)
Expand Down Expand Up @@ -2690,6 +2705,8 @@ then
# to 2048 kilobytes so that the stack doesn't overflow
# when running test_compile.py.
LINKFORSHARED='-Wl,-E -N 2048K';;
VxWorks*)
LINKFORSHARED='--export-dynamic';;
esac
fi
AC_MSG_RESULT($LINKFORSHARED)
Expand Down Expand Up @@ -3517,7 +3534,7 @@ AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
sigtimedwait sigwait sigwaitinfo snprintf strftime strlcpy strsignal symlinkat sync \
sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
truncate uname unlinkat unsetenv utimensat utimes waitid waitpid wait3 wait4 \
wcscoll wcsftime wcsxfrm wmemcmp writev _getpty)
wcscoll wcsftime wcsxfrm wmemcmp writev _getpty rtpSpawn)

# Force lchmod off for Linux. Linux disallows changing the mode of symbolic
# links. Some libc implementations have a stub lchmod implementation that always
Expand Down Expand Up @@ -4578,7 +4595,7 @@ AC_MSG_RESULT($SOABI)

AC_SUBST(EXT_SUFFIX)
case $ac_sys_system in
Linux*|GNU*|Darwin)
Linux*|GNU*|Darwin|VxWorks)
EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};;
*)
EXT_SUFFIX=${SHLIB_SUFFIX};;
Expand Down
3 changes: 3 additions & 0 deletions pyconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,9 @@
/* Define to 1 if you have the `round' function. */
#undef HAVE_ROUND

/* Define to 1 if you have the `rtpSpawn' function. */
#undef HAVE_RTPSPAWN

/* Define to 1 if you have the `sched_get_priority_max' function. */
#undef HAVE_SCHED_GET_PRIORITY_MAX

Expand Down
34 changes: 25 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ def add_gcc_paths(self):
os.makedirs(self.build_temp)
ret = os.system('%s -E -v - </dev/null 2>%s 1>/dev/null' % (gcc, tmpfile))
is_gcc = False
is_clang = False
in_incdirs = False
inc_dirs = []
lib_dirs = []
Expand All @@ -525,17 +526,19 @@ def add_gcc_paths(self):
for line in fp.readlines():
if line.startswith("gcc version"):
is_gcc = True
if 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:
Expand Down Expand Up @@ -722,7 +725,8 @@ def detect_modules(self):
# pwd(3)
exts.append( Extension('pwd', ['pwdmodule.c']) )
# grp(3)
exts.append( Extension('grp', ['grpmodule.c']) )
if 'vxworks' not in host_platform:
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)):
Expand Down Expand Up @@ -859,7 +863,12 @@ def detect_modules(self):
libs = ['crypt']
else:
libs = []
exts.append( Extension('_crypt', ['_cryptmodule.c'], libraries=libs) )

if 'vxworks' not in host_platform:
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']) )
Expand All @@ -868,8 +877,14 @@ def detect_modules(self):
exts.append( Extension('_posixsubprocess', ['_posixsubprocess.c']) )

# socket(2)
exts.append( Extension('_socket', ['socketmodule.c'],
depends = ['socketmodule.h']) )
if 'vxworks' not in host_platform :
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:
Expand Down Expand Up @@ -1319,9 +1334,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 'vxworks' not in host_platform :
# 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'])
Expand Down