diff --git a/include/python3/osreldate.h b/include/python3/osreldate.h new file mode 100644 index 0000000..b84e708 --- /dev/null +++ b/include/python3/osreldate.h @@ -0,0 +1,3 @@ +/* + * Note: This is just a dummy, since Python thinks we're running on FreeBSD. + */ diff --git a/include/python3/pyconfig.h b/include/python3/pyconfig.h new file mode 100644 index 0000000..f3d01c5 --- /dev/null +++ b/include/python3/pyconfig.h @@ -0,0 +1,1122 @@ +/* pyconfig.h. Generated from pyconfig.h.in by configure. */ +/* pyconfig.h.in. Generated from configure.ac by autoheader. */ + +#include + +#ifndef Py_PYCONFIG_H +#define Py_PYCONFIG_H + +#define SOABI "lib" + +#undef HAVE_SIGTIMEDWAIT + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Define for AIX if your compiler is a genuine IBM xlC/xlC_r and you want + support for AIX C++ shared extension modules. */ +#undef AIX_GENUINE_CPLUSPLUS + +/* The Android API level. */ +/* #undef ANDROID_API_LEVEL */ + +/* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM + mixed-endian order (byte order 45670123) */ +/* #undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 */ + +/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the most + significant byte first */ +/* #undef DOUBLE_IS_BIG_ENDIAN_IEEE754 */ + +/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the + least significant byte first */ +/* #define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 1 */ + +/* Define if --enable-ipv6 is specified */ +#undef ENABLE_IPV6 + +/* Define if flock needs to be linked with bsd library. */ +/* #undef FLOCK_NEEDS_LIBBSD */ + +/* Define if getpgrp() must be called as getpgrp(0). */ +#undef GETPGRP_HAVE_ARG + +/* Define if gettimeofday() does not have second (timezone) argument This is + the case on Motorola V4 (R40V4.2) */ +/* #undef GETTIMEOFDAY_NO_TZ */ + +/* Define to 1 if you have the `accept4' function. */ +#undef HAVE_ACCEPT4 + +/* Define to 1 if you have the `acosh' function. */ +#undef HAVE_ACOSH + +/* struct addrinfo (netdb.h) */ +#undef HAVE_ADDRINFO + +/* Define to 1 if you have the `alarm' function. */ +#undef HAVE_ALARM + +/* Define if aligned memory access is required */ +/* #undef HAVE_ALIGNED_REQUIRED */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_ALLOCA_H + +/* Define this if your time.h defines altzone. */ +#undef HAVE_ALTZONE + +/* Define to 1 if you have the `asinh' function. */ +#undef HAVE_ASINH + +/* Define to 1 if you have the header file. */ +#undef HAVE_ASM_TYPES_H + +/* Define to 1 if you have the `atanh' function. */ +#undef HAVE_ATANH + +/* Define to 1 if you have the `bind_textdomain_codeset' function. */ +#define HAVE_BIND_TEXTDOMAIN_CODESET 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_BLUETOOTH_BLUETOOTH_H + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BLUETOOTH_H */ + +/* Define if mbstowcs(NULL, "text", 0) does not return the number of wide + chars that would be converted. */ +/* #undef HAVE_BROKEN_MBSTOWCS */ + +/* Define if nice() returns success/failure instead of the new priority. */ +/* #undef HAVE_BROKEN_NICE */ + +/* Define if the system reports an invalid PIPE_BUF value. */ +/* #undef HAVE_BROKEN_PIPE_BUF */ + +/* Define if poll() sets errno on invalid file descriptors. */ +#undef HAVE_BROKEN_POLL + +/* Define if the Posix semaphores do not work on your system */ +#undef HAVE_BROKEN_POSIX_SEMAPHORES + +/* Define if pthread_sigmask() does not work on your system. */ +/* #undef HAVE_BROKEN_PTHREAD_SIGMASK */ + +/* define to 1 if your sem_getvalue is broken. */ +/* #undef HAVE_BROKEN_SEM_GETVALUE */ + +/* Define if `unsetenv` does not return an int. */ +/* #undef HAVE_BROKEN_UNSETENV */ + +/* Has builtin atomics */ +#define HAVE_BUILTIN_ATOMIC 1 + +/* Define to 1 if you have the `chflags' function. */ +#undef HAVE_CHFLAGS + +/* Define to 1 if you have the `chown' function. */ +#undef HAVE_CHOWN + +/* Define if you have the 'chroot' function. */ +#undef HAVE_CHROOT + +/* Define to 1 if you have the `clock' function. */ +#define HAVE_CLOCK 1 + +#define HAVE_CLOCK_GETTIME 1 +#define HAVE_CLOCK_GETRES 1 +//#undef HAVE_CLOCK_SETTIME + +/* Define to 1 if you have the `confstr' function. */ +#undef HAVE_CONFSTR + +/* Define to 1 if you have the header file. */ +#undef HAVE_CONIO_H + +/* Define to 1 if you have the `copysign' function. */ +#undef HAVE_COPYSIGN + +/* Define to 1 if you have the `ctermid' function. */ +#undef HAVE_CTERMID + +/* Define if you have the 'ctermid_r' function. */ +#undef HAVE_CTERMID_R + +/* Define to 1 if you have the header file. */ +#undef HAVE_CURSES_H + +/* Define if you have the 'is_term_resized' function. */ +#undef HAVE_CURSES_IS_TERM_RESIZED + +/* Define if you have the 'resizeterm' function. */ +#undef HAVE_CURSES_RESIZETERM + +/* Define if you have the 'resize_term' function. */ +#undef HAVE_CURSES_RESIZE_TERM + +/* Define to 1 if you have the declaration of `isfinite', and to 0 if you + don't. */ +#undef HAVE_DECL_ISFINITE + +/* Define to 1 if you have the declaration of `isinf', and to 0 if you don't. + */ +#undef HAVE_DECL_ISINF + +/* Define to 1 if you have the declaration of `isnan', and to 0 if you don't. + */ +#undef HAVE_DECL_ISNAN + +/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. + */ +#undef HAVE_DECL_TZNAME + +/* Define to 1 if you have the device macros. */ +#undef HAVE_DEVICE_MACROS + +/* Define if we have /dev/ptc. */ +#undef HAVE_DEV_PTC + +/* Define if we have /dev/ptmx. */ +#undef HAVE_DEV_PTMX + +/* Define to 1 if you have the header file. */ +#undef HAVE_DIRECT_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the `dlopen' function. */ +#define HAVE_DLOPEN 1 + +/* Define to 1 if you have the `dup2' function. */ +#undef HAVE_DUP2 + +/* Defined when any dynamic module loading is enabled. */ +#define HAVE_DYNAMIC_LOADING 1 + +/* Define if you have the 'epoll' functions. */ +#undef HAVE_EPOLL + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the `execv' function. */ +#undef HAVE_EXECV + +/* Define to 1 if you have the `expm1' function. */ +#undef HAVE_EXPM1 + +/* Define if you have the 'fchdir' function. */ +#undef HAVE_FCHDIR + +/* Define to 1 if you have the `fchmod' function. */ +#undef HAVE_FCHMOD + +/* Define to 1 if you have the `fchown' function. */ +#undef HAVE_FCHOWN + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have the 'fdatasync' function. */ +#undef HAVE_FDATASYNC + +/* Define to 1 if you have the `finite' function. */ +#undef HAVE_FINITE + +/* Define if you have the 'flock' function. */ +#undef HAVE_FLOCK + +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK + +/* Define to 1 if you have the `forkpty' function. */ +#undef HAVE_FORKPTY + +/* Define to 1 if you have the `fpathconf' function. */ +#undef HAVE_FPATHCONF + +/* Define to 1 if you have the `fseek64' function. */ +#undef HAVE_FSEEK64 + +/* Define to 1 if you have the `fseeko' function. */ +#undef HAVE_FSEEKO + +/* Define to 1 if you have the `fstatvfs' function. */ +#undef HAVE_FSTATVFS + +/* Define if you have the 'fsync' function. */ +#undef HAVE_FSYNC + +/* Define to 1 if you have the `ftell64' function. */ +#undef HAVE_FTELL64 + +/* Define to 1 if you have the `ftello' function. */ +#undef HAVE_FTELLO + +/* Define to 1 if you have the `ftime' function. */ +#undef HAVE_FTIME + +/* Define to 1 if you have the `ftruncate' function. */ +#undef HAVE_FTRUNCATE + +/* Define to 1 if you have the `gai_strerror' function. */ +#undef HAVE_GAI_STRERROR + +/* Define if you have the getaddrinfo function. */ +#undef HAVE_GETADDRINFO + +/* Define to 1 if you have the `getcwd' function. */ +#undef HAVE_GETCWD + +/* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */ +#undef HAVE_GETC_UNLOCKED + +/* Define to 1 if you have the `getgroups' function. */ +#undef HAVE_GETGROUPS + +/* Define to 1 if you have the `gethostbyname' function. */ +#undef HAVE_GETHOSTBYNAME + +/* Define this if you have some version of gethostbyname_r() */ +#undef HAVE_GETHOSTBYNAME_R + +/* Define this if you have the 3-arg version of gethostbyname_r(). */ +#undef HAVE_GETHOSTBYNAME_R_3_ARG + +/* Define this if you have the 5-arg version of gethostbyname_r(). */ +#undef HAVE_GETHOSTBYNAME_R_5_ARG + +/* Define this if you have the 6-arg version of gethostbyname_r(). */ +#undef HAVE_GETHOSTBYNAME_R_6_ARG + +/* Define to 1 if you have the `getitimer' function. */ +#undef HAVE_GETITIMER + +/* Define to 1 if you have the `getloadavg' function. */ +#undef HAVE_GETLOADAVG + +/* Define to 1 if you have the `getlogin' function. */ +#undef HAVE_GETLOGIN + +/* Define to 1 if you have the `getnameinfo' function. */ +#undef HAVE_GETNAMEINFO + +/* Define if you have the 'getpagesize' function. */ +#undef HAVE_GETPAGESIZE + +/* Define to 1 if you have the `getpeername' function. */ +#undef HAVE_GETPEERNAME + +/* Define to 1 if you have the `getpgid' function. */ +#undef HAVE_GETPGID + +/* Define to 1 if you have the `getpgrp' function. */ +#undef HAVE_GETPGRP + +/* Define to 1 if you have the `getpid' function. */ +#undef HAVE_GETPID + +/* Define to 1 if you have the `getpriority' function. */ +#undef HAVE_GETPRIORITY + +/* Define to 1 if you have the `getpwent' function. */ +#undef HAVE_GETPWENT + +/* Define to 1 if you have the `getsid' function. */ +#undef HAVE_GETSID + +/* Define to 1 if you have the `getspent' function. */ +#undef HAVE_GETSPENT + +/* Define to 1 if you have the `getspnam' function. */ +#undef HAVE_GETSPNAM + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the `getwd' function. */ +#undef HAVE_GETWD + +/* Define to 1 if you have the header file. */ +#undef HAVE_GRP_H + +/* Define if you have the 'hstrerror' function. */ +#undef HAVE_HSTRERROR + +/* Define to 1 if you have the `hypot' function. */ +#undef HAVE_HYPOT + +/* Define to 1 if you have the header file. */ +#undef HAVE_IEEEFP_H + +/* Define if you have the 'inet_aton' function. */ +#undef HAVE_INET_ATON + +/* Define if you have the 'inet_pton' function. */ +#undef HAVE_INET_PTON + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_IO_H + +/* Define to 1 if you have the `kill' function. */ +#undef HAVE_KILL + +/* Define to 1 if you have the `killpg' function. */ +#undef HAVE_KILLPG + +/* Define if you have the 'kqueue' functions. */ +#undef HAVE_KQUEUE + +/* Define to 1 if you have the header file. */ +#define HAVE_LANGINFO_H 1 + +/* Defined to enable large file support when an off_t is bigger than a long + and long long is available and at least as big as an off_t. You may need to + add some flags for configuration and compilation to enable this mode. (For + Solaris and Linux, the necessary defines are already defined.) */ +#undef HAVE_LARGEFILE_SUPPORT + +/* Define to 1 if you have the `lchflags' function. */ +#undef HAVE_LCHFLAGS + +/* Define to 1 if you have the `lchmod' function. */ +#undef HAVE_LCHMOD + +/* Define to 1 if you have the `lchown' function. */ +#undef HAVE_LCHOWN + +/* Define to 1 if you have the `dl' library (-ldl). */ +#undef HAVE_LIBDL + +/* Define to 1 if you have the `dld' library (-ldld). */ +#undef HAVE_LIBDLD + +/* Define to 1 if you have the `ieee' library (-lieee). */ +#undef HAVE_LIBIEEE + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBINTL_H + +/* Define if you have the readline library (-lreadline). */ +#undef HAVE_LIBREADLINE + +/* Define to 1 if you have the `resolv' library (-lresolv). */ +#undef HAVE_LIBRESOLV + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBUTIL_H + +/* Define if you have the 'link' function. */ +#undef HAVE_LINK + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_NETLINK_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_TIPC_H + +/* Define to 1 if you have the `log1p' function. */ +#undef HAVE_LOG1P + +/* Define this if you have the type long double. */ +#undef HAVE_LONG_DOUBLE + +/* Define this if you have the type long long. */ +#define HAVE_LONG_LONG 1 + +/* Define to 1 if you have the `lstat' function. */ +#undef HAVE_LSTAT + +/* Define this if you have the makedev macro. */ +#undef HAVE_MAKEDEV + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `mkfifo' function. */ +#undef HAVE_MKFIFO + +/* Define to 1 if you have the `mknod' function. */ +#undef HAVE_MKNOD + +/* Define to 1 if you have the `mktime' function. */ +#undef HAVE_MKTIME + +/* Define to 1 if you have the `mremap' function. */ +#undef HAVE_MREMAP + +/* Define to 1 if you have the header file. */ +#undef HAVE_NCURSES_H + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +#undef HAVE_NDIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETPACKET_PACKET_H + +/* Define to 1 if you have the `nice' function. */ +#undef HAVE_NICE + +/* Define to 1 if you have the `openpty' function. */ +#undef HAVE_OPENPTY + +/* Define if compiling using MacOS X 10.5 SDK or later. */ +#undef HAVE_OSX105_SDK + +/* Define to 1 if you have the `pathconf' function. */ +#undef HAVE_PATHCONF + +/* Define to 1 if you have the `pause' function. */ +#undef HAVE_PAUSE + +/* Define to 1 if you have the `plock' function. */ +#undef HAVE_PLOCK + +/* Define to 1 if you have the `poll' function. */ +#undef HAVE_POLL + +/* Define to 1 if you have the header file. */ +#undef HAVE_POLL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_PROCESS_H + +/* Define if your compiler supports function prototype */ +#undef HAVE_PROTOTYPES + +/* Define if you have GNU PTH threads. */ +#undef HAVE_PTH + +/* Defined for Solaris 2.6 bug in pthread header. */ +#undef HAVE_PTHREAD_DESTRUCTOR + +/* Define to 1 if you have the header file. */ +#undef HAVE_PTHREAD_H + +/* Define to 1 if you have the `pthread_init' function. */ +#undef HAVE_PTHREAD_INIT + +/* Define to 1 if you have the `pthread_sigmask' function. */ +#undef HAVE_PTHREAD_SIGMASK + +/* Define to 1 if you have the header file. */ +#undef HAVE_PTY_H + +/* Define to 1 if you have the `putenv' function. */ +#undef HAVE_PUTENV + +/* Define to 1 if you have the `readlink' function. */ +#undef HAVE_READLINK + +/* Define to 1 if you have the `realpath' function. */ +#undef HAVE_REALPATH + +/* Define if you have readline 2.1 */ +#undef HAVE_RL_CALLBACK + +/* Define if you can turn off readline's signal handling. */ +#undef HAVE_RL_CATCH_SIGNAL + +/* Define if you have readline 2.2 */ +#undef HAVE_RL_COMPLETION_APPEND_CHARACTER + +/* Define if you have readline 4.0 */ +#undef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK + +/* Define if you have readline 4.2 */ +#undef HAVE_RL_COMPLETION_MATCHES + +/* Define if you have readline 4.0 */ +#undef HAVE_RL_PRE_INPUT_HOOK + +/* Define to 1 if you have the `select' function. */ +#undef HAVE_SELECT + +/* Define to 1 if you have the `setegid' function. */ +#undef HAVE_SETEGID + +/* Define to 1 if you have the `seteuid' function. */ +#undef HAVE_SETEUID + +/* Define to 1 if you have the `setgid' function. */ +#undef HAVE_SETGID + +/* Define if you have the 'setgroups' function. */ +#undef HAVE_SETGROUPS + +/* Define to 1 if you have the `setitimer' function. */ +#undef HAVE_SETITIMER + +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + +/* Define to 1 if you have the `setpgid' function. */ +#undef HAVE_SETPGID + +/* Define to 1 if you have the `setpgrp' function. */ +#undef HAVE_SETPGRP + +/* Define to 1 if you have the `setregid' function. */ +#undef HAVE_SETREGID + +/* Define to 1 if you have the `setreuid' function. */ +#undef HAVE_SETREUID + +/* Define to 1 if you have the `setsid' function. */ +#undef HAVE_SETSID + +/* Define to 1 if you have the `setuid' function. */ +#undef HAVE_SETUID + +/* Define to 1 if you have the `setvbuf' function. */ +#undef HAVE_SETVBUF + +/* Define to 1 if you have the header file. */ +#undef HAVE_SHADOW_H + +/* Define to 1 if you have the `sigaction' function. */ +#undef HAVE_SIGACTION + +/* Define to 1 if you have the `siginterrupt' function. */ +#undef HAVE_SIGINTERRUPT + +/* Define to 1 if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define to 1 if you have the `sigrelse' function. */ +#undef HAVE_SIGRELSE + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* Define if sockaddr has sa_len member */ +#undef HAVE_SOCKADDR_SA_LEN + +/* struct sockaddr_storage (sys/socket.h) */ +#undef HAVE_SOCKADDR_STORAGE + +/* Define if you have the 'socketpair' function. */ +#undef HAVE_SOCKETPAIR + +/* Define if your compiler provides ssize_t */ +#undef HAVE_SSIZE_T + +/* Define to 1 if you have the `statvfs' function. */ +#undef HAVE_STATVFS + +/* Define if you have struct stat.st_mtim.tv_nsec */ +#undef HAVE_STAT_TV_NSEC + +/* Define if you have struct stat.st_mtimensec */ +#undef HAVE_STAT_TV_NSEC2 + +/* Define if your compiler supports variable length function prototypes (e.g. + void fprintf(FILE *, char *, ...);) *and* */ +#define HAVE_STDARG_PROTOTYPES 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the `strftime' function. */ +#undef HAVE_STRFTIME + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STROPTS_H + +/* Define to 1 if `st_birthtime' is member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_BIRTHTIME + +/* Define to 1 if `st_blksize' is member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_BLKSIZE + +/* Define to 1 if `st_blocks' is member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_BLOCKS + +/* Define to 1 if `st_flags' is member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_FLAGS + +/* Define to 1 if `st_gen' is member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_GEN + +/* Define to 1 if `st_rdev' is member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_RDEV + +/* Define to 1 if `tm_zone' is member of `struct tm'. */ +#undef HAVE_STRUCT_TM_TM_ZONE + +/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use + `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ +#undef HAVE_ST_BLOCKS + +/* Define if you have the 'symlink' function. */ +#undef HAVE_SYMLINK + +/* Define to 1 if you have the `sysconf' function. */ +#undef HAVE_SYSCONF + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYSEXITS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_AUDIOIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_BSDTTY_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_DIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_EPOLL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_EVENT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_FILE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_LOADAVG_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_LOCK_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MKDEV_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MODEM_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_NDIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_POLL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_RESOURCE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STATVFS_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TERMIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIMES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_UN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_UTSNAME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_WAIT_H + +/* Define to 1 if you have the `tcgetpgrp' function. */ +#undef HAVE_TCGETPGRP + +/* Define to 1 if you have the `tcsetpgrp' function. */ +#undef HAVE_TCSETPGRP + +/* Define to 1 if you have the `tempnam' function. */ +#undef HAVE_TEMPNAM + +/* Define to 1 if you have the header file. */ +#undef HAVE_TERMIOS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TERM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_THREAD_H + +/* Define to 1 if you have the `timegm' function. */ +#define HAVE_TIMEGM 1 + +/* Define to 1 if you have the `times' function. */ +#undef HAVE_TIMES + +/* Define to 1 if you have the `tmpfile' function. */ +#undef HAVE_TMPFILE + +/* Define to 1 if you have the `tmpnam' function. */ +#undef HAVE_TMPNAM + +/* Define to 1 if you have the `tmpnam_r' function. */ +#undef HAVE_TMPNAM_R + +/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use + `HAVE_STRUCT_TM_TM_ZONE' instead. */ +#undef HAVE_TM_ZONE + +/* Define to 1 if you have the `truncate' function. */ +#undef HAVE_TRUNCATE + +/* Define to 1 if you don't have `tm_zone' but do have the external array + `tzname'. */ +#undef HAVE_TZNAME + +/* Define this if you have tcl and TCL_UTF_MAX==6 */ +#undef HAVE_UCS4_TCL + +/* Define to 1 if the system has the type `uintptr_t'. */ +#undef HAVE_UINTPTR_T + +/* Define to 1 if you have the `uname' function. */ +#undef HAVE_UNAME + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `unsetenv' function. */ +#undef HAVE_UNSETENV + +/* Define if you have a useable wchar_t type defined in wchar.h; useable means + wchar_t must be an unsigned type with at least 16 bits. (see + Include/unicodeobject.h). */ +#undef HAVE_USABLE_WCHAR_T + +/* Define to 1 if you have the `utimes' function. */ +#undef HAVE_UTIMES + +/* Define to 1 if you have the header file. */ +#undef HAVE_UTIME_H + +/* Define to 1 if you have the `wait3' function. */ +#undef HAVE_WAIT3 + +/* Define to 1 if you have the `wait4' function. */ +#undef HAVE_WAIT4 + +/* Define to 1 if you have the `waitpid' function. */ +#undef HAVE_WAITPID + +/* Define if the compiler provides a wchar.h header file. */ +#define HAVE_WCHAR_H 1 + +/* Define to 1 if you have the `wcscoll' function. */ +#undef HAVE_WCSCOLL + +/* Define if tzset() actually switches the local timezone in a meaningful way. + */ +#undef HAVE_WORKING_TZSET + +/* Define if the zlib library has inflateCopy */ +#undef HAVE_ZLIB_COPY + +/* Define to 1 if you have the `_getpty' function. */ +#undef HAVE__GETPTY + +/* Define if you are using Mach cthreads directly under /include */ +#undef HURD_C_THREADS + +/* Define if you are using Mach cthreads under mach / */ +#undef MACH_C_THREADS + +/* Define to 1 if `major', `minor', and `makedev' are declared in . + */ +#undef MAJOR_IN_MKDEV + +/* Define to 1 if `major', `minor', and `makedev' are declared in + . */ +#undef MAJOR_IN_SYSMACROS + +/* Define if mvwdelch in curses.h is an expression. */ +#undef MVWDELCH_IS_EXPRESSION + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Defined if PTHREAD_SCOPE_SYSTEM supported. */ +#undef PTHREAD_SYSTEM_SCHED_SUPPORTED + +/* Define to printf format modifier for Py_ssize_t */ +#undef PY_FORMAT_SIZE_T + +/* Define if you want to build an interpreter with many run-time checks. */ +#undef Py_DEBUG + +/* Defined if Python is built as a shared library. */ +#undef Py_ENABLE_SHARED + + +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* Define if setpgrp() must be called as setpgrp(0, 0). */ +#undef SETPGRP_HAVE_ARG + +/* Define if i>>j for signed int i does not extend the sign bit when i < 0 */ +#undef SIGNED_RIGHT_SHIFT_ZERO_FILLS + +/* The size of `double', as computed by sizeof. */ +#undef SIZEOF_DOUBLE + +/* The size of `float', as computed by sizeof. */ +#undef SIZEOF_FLOAT + +/* The size of `fpos_t', as computed by sizeof. */ +#undef SIZEOF_FPOS_T + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT GENODE_SIZEOF_INT + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG GENODE_SIZEOF_LONG + +/* The size of `long double', as computed by sizeof. */ +#undef SIZEOF_LONG_DOUBLE + +/* The size of `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The number of bytes in an off_t. */ +#define SIZEOF_OFF_T SIZEOF_LONG + +/* The size of `pid_t', as computed by sizeof. */ +#undef SIZEOF_PID_T + +/* The number of bytes in a pthread_t. */ +#undef SIZEOF_PTHREAD_T + +/* The size of `short', as computed by sizeof. */ +#undef SIZEOF_SHORT + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T GENODE_SIZEOF_LONG + +/* The number of bytes in a time_t. */ +#undef SIZEOF_TIME_T + +/* The size of `uintptr_t', as computed by sizeof. */ +#undef SIZEOF_UINTPTR_T + +/* The size of `void *', as computed by sizeof. */ +#define SIZEOF_VOID_P GENODE_SIZEOF_LONG + +/* The size of `wchar_t', as computed by sizeof. */ +#define SIZEOF_WCHAR_T GENODE_SIZEOF_WCHAR + +/* The size of `_Bool', as computed by sizeof. */ +#undef SIZEOF__BOOL + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if you can safely include both and + (which you can't on SCO ODT 3.0). */ +#undef SYS_SELECT_WITH_SYS_TIME + +/* Define if tanh(-0.) is -0., or if platform doesn't have signed zeros */ +#undef TANH_PRESERVES_ZERO_SIGN + +/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* Define to 1 if your declares `struct tm'. */ +#undef TM_IN_SYS_TIME + +/* Define if you want to use MacPython modules on MacOSX in unix-Python. */ +#undef USE_TOOLBOX_OBJECT_GLUE + +/* Define if a va_list is an array of some kind */ +#undef VA_LIST_IS_ARRAY + +/* Define if you want SIGFPE handled (see Include/pyfpe.h). */ +#undef WANT_SIGFPE_HANDLER + +/* Define if you want wctype.h functions to be used instead of the one + supplied by Python itself. (see Include/unicodectype.h). */ +#undef WANT_WCTYPE_FUNCTIONS + +/* Define if WINDOW in curses.h offers a field _flags. */ +#undef WINDOW_HAS_FLAGS + +/* Define if you want documentation strings in extension modules */ +#undef WITH_DOC_STRINGS + +/* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) dynamic + linker (dyld) instead of the old-style (NextStep) dynamic linker (rld). + Dyld is necessary to support frameworks. */ +#undef WITH_DYLD + +/* Define to 1 if libintl is needed for locale functions. */ +#undef WITH_LIBINTL + +/* Define if you want to produce an OpenStep/Rhapsody framework (shared + library plus accessory files). */ +#undef WITH_NEXT_FRAMEWORK + +/* Define if you want to compile in Python-specific mallocs */ +#undef WITH_PYMALLOC + +/* Define if you want to compile in rudimentary thread support */ +#undef WITH_THREAD + +/* Define to profile with the Pentium timestamp counter */ +#undef WITH_TSC + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + +/* Define if arithmetic is subject to x87-style double rounding issue */ +#undef X87_DOUBLE_ROUNDING + +/* Define to 1 if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif + +/* Define on OpenBSD to activate all library features */ +#undef _BSD_SOURCE + +/* Define on Irix to enable u_int */ +#undef _BSD_TYPES + +/* Define on Darwin to activate all library features */ +#undef _DARWIN_C_SOURCE + +/* This must be set to 64 on some systems to enable large file support. */ +#undef _FILE_OFFSET_BITS + +/* Define on Linux to activate all library features */ +#undef _GNU_SOURCE + +/* This must be defined on some systems to enable large file support. */ +#undef _LARGEFILE_SOURCE + +/* Define on NetBSD to activate all library features */ +#undef _NETBSD_SOURCE + +/* Define _OSF_SOURCE to get the makedev macro. */ +#undef _OSF_SOURCE + +/* Define to activate features from IEEE Stds 1003.1-2001 */ +#undef _POSIX_C_SOURCE + +/* Define if you have POSIX threads, and your system does not define that. */ +#undef _POSIX_THREADS + +/* Define to force use of thread-safe errno, h_errno, and other functions */ +#undef _REENTRANT + +/* Define to the level of X/Open that your system supports */ +#undef _XOPEN_SOURCE + +/* Define to activate Unix95-and-earlier features */ +#undef _XOPEN_SOURCE_EXTENDED + +/* Define on FreeBSD to activate all library features */ +#undef __BSD_VISIBLE + +/* Define to 1 if type `char' is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +# undef __CHAR_UNSIGNED__ +#endif + +#define XML_DEV_URANDOM + +/* Defined on Solaris to see additional function prototypes. */ +#undef __EXTENSIONS__ + +/* Define to 'long' if doesn't define. */ +#undef clock_t + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `int' if doesn't define. */ +#undef gid_t + +/* Define to `int' if does not define. */ +#undef mode_t + +/* Define to `long int' if does not define. */ +#undef off_t + +/* Define to `int' if does not define. */ +#undef pid_t + +/* Define to empty if the keyword does not work. */ +#undef signed + +/* Define to `unsigned int' if does not define. */ +#undef size_t + +/* Define to `int' if does not define. */ +#undef socklen_t + +/* Define to `int' if doesn't define. */ +#undef uid_t + +/* Define to empty if the keyword does not work. */ +#undef volatile + +/* Define the macros needed if on a UnixWare 7.x system. */ +#if defined(__USLC__) && defined(__SCO_VERSION__) +#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ +#endif + +#endif /*Py_PYCONFIG_H*/ + diff --git a/include/python3/spec/x86_32/genode_defs.h b/include/python3/spec/x86_32/genode_defs.h new file mode 100644 index 0000000..7bd0872 --- /dev/null +++ b/include/python3/spec/x86_32/genode_defs.h @@ -0,0 +1,21 @@ +/* + * \brief Data type size definitions (32 Bit) + * \author Sebastian Sumpf + * \date 2010-02-17 + */ + +/* + * Copyright (C) 2010-2017 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU Affero General Public License version 3. + */ + +#ifndef _PYTHON__GENODE_DEFS_H_ +#define _PYTHON__GENODE_DEFS_H_ + +#define GENODE_SIZEOF_LONG 4 +#define GENODE_SIZEOF_INT 4 +#define GENODE_SIZEOF_WCHAR 4 + +#endif /* _PYTHON__GENODE_DEFS_H_ */ diff --git a/include/python3/spec/x86_64/genode_defs.h b/include/python3/spec/x86_64/genode_defs.h new file mode 100644 index 0000000..892f7ba --- /dev/null +++ b/include/python3/spec/x86_64/genode_defs.h @@ -0,0 +1,21 @@ +/* + * \brief Data type size definitions (32 Bit) + * \author Sebastian Sumpf + * \date 2010-02-17 + */ + +/* + * Copyright (C) 2010-2017 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU Affero General Public License version 3. + */ + +#ifndef _PYTHON__GENODE_DEFS_H_ +#define _PYTHON__GENODE_DEFS_H_ + +#define GENODE_SIZEOF_LONG 8 +#define GENODE_SIZEOF_INT 4 +#define GENODE_SIZEOF_WCHAR 4 + +#endif /* _PYTHON__GENODE_DEFS_H_ */ diff --git a/lib/import/import-python3.mk b/lib/import/import-python3.mk new file mode 100644 index 0000000..7abeecb --- /dev/null +++ b/lib/import/import-python3.mk @@ -0,0 +1,14 @@ +PYTHON = python-3.6.5 +REP_INC_DIR += include/python3 +INC_DIR += $(call select_from_ports,python3)/include + +ifeq ($(filter-out $(SPECS),x86),) + ifeq ($(filter-out $(SPECS),32bit),) + REP_INC_DIR += include/python3/spec/x86_32 + endif # 32bit + + ifeq ($(filter-out $(SPECS),64bit),) + REP_INC_DIR += include/python3/spec/x86_64 + endif # 64bit +endif # x86 + diff --git a/lib/mk/python3.inc b/lib/mk/python3.inc new file mode 100644 index 0000000..0ab808e --- /dev/null +++ b/lib/mk/python3.inc @@ -0,0 +1,217 @@ +PYTHON_PORT_DIR := $(call select_from_ports,python3) +PYTHON_DIR := $(PYTHON_PORT_DIR)/src/lib/python3 +LIBS += libc libm +SHARED_LIB = yes + +# use our custom 'pyconfig.h' file +INC_DIR += $(REP_DIR)/include/python3 + +# Python headres +INC_DIR += $(PYTHON_DIR)/Include + +# zlib headers +INC_DIR += $(PYTHON_DIR)/Modules/zlib + +# expat headers +INC_DIR += $(PYTHON_DIR)/Modules/expat + +D_OPTS = Py_BUILD_CORE NDBEUG PREFIX='""' VPATH='"."' EXEC_PREFIX='"lib"' PYTHONPATH='""' HAVE_EXPAT_CONFIG_H='""' VERSION='"3"' +F_OPTS = no-strict-aliasing wrapv +D_OPTS := $(addprefix -D,$(D_OPTS)) +F_OPTS := $(addprefix -f,$(F_OPTS)) +CC_DEF += $(F_OPTS) $(D_OPTS) + +# python.c +# +SRC_C = \ + dynload_shlib.c \ + getbuildinfo.c \ + acceler.c \ + grammar1.c \ + listnode.c \ + node.c \ + parser.c \ + parsetok.c \ + bitset.c \ + metagrammar.c \ + firstsets.c \ + grammar.c \ + pgen.c \ + myreadline.c \ + tokenizer.c \ + abstract.c \ + boolobject.c \ + bytes_methods.c \ + bytearrayobject.c \ + bytesobject.c \ + capsule.c \ + cellobject.c \ + classobject.c \ + codeobject.c \ + complexobject.c \ + descrobject.c \ + enumobject.c \ + exceptions.c \ + genobject.c \ + fileobject.c \ + floatobject.c \ + frameobject.c \ + funcobject.c \ + iterobject.c \ + listobject.c \ + longobject.c \ + dictobject.c \ + methodobject.c \ + moduleobject.c \ + object.c \ + obmalloc.c \ + rangeobject.c \ + setobject.c \ + sliceobject.c \ + structseq.c \ + tupleobject.c \ + typeobject.c \ + weakrefobject.c \ + unicodeobject.c \ + unicodectype.c \ + _warnings.c \ + Python-ast.c \ + asdl.c \ + ast.c \ + bltinmodule.c \ + ceval.c \ + compile.c \ + codecs.c \ + errors.c \ + faulthandler.c \ + fileutils.c \ + frozen.c \ + frozenmain.c \ + future.c \ + getargs.c \ + getcompiler.c \ + getcopyright.c \ + getplatform.c \ + getversion.c \ + graminit.c \ + hashtable.c \ + import.c \ + importdl.c \ + marshal.c \ + _math.c \ + memoryobject.c \ + modsupport.c \ + mystrtoul.c \ + mysnprintf.c \ + namespaceobject.c \ + odictobject.c \ + peephole.c \ + pyarena.c \ + pyctype.c \ + pyfpe.c \ + pyhash.c \ + pylifecycle.c \ + pymath.c \ + pystate.c \ + pystrhex.c \ + pytime.c \ + pythonrun.c \ + random.c \ + structmember.c \ + symtable.c \ + sysmodule.c \ + traceback.c \ + _tracemalloc.c \ + getopt.c \ + pystrcmp.c \ + pystrtod.c \ + formatter_unicode.c \ + config.c \ + getpath.c \ + main.c \ + gcmodule.c \ + signalmodule.c \ + posixmodule.c \ + errnomodule.c \ + pwdmodule.c \ + md5module.c \ + sha1module.c \ + sha256module.c \ + sha512module.c \ + _blake2/blake2module.c \ + _blake2/blake2b_impl.c \ + _blake2/blake2s_impl.c \ + _sha3/sha3module.c \ + _sre.c \ + _codecsmodule.c \ + timemodule.c \ + _operator.c \ + _randommodule.c \ + itertoolsmodule.c \ + _functoolsmodule.c \ + _collectionsmodule.c \ + _weakref.c \ + _io/iobase.c \ + _io/fileio.c \ + _io/bufferedio.c \ + _io/stringio.c \ + _io/textio.c \ + _io/bytesio.c \ + _io/winconsoleio.c \ + _io/_iomodule.c \ + _localemodule.c \ + atexitmodule.c \ + pyexpat.c \ + expat/xmlparse.c \ + expat/xmlrole.c \ + expat/xmltok.c \ + _struct.c \ + accu.c \ + zipimport.c \ + zlibmodule.c \ + zlib/adler32.c \ + zlib/compress.c \ + zlib/crc32.c \ + zlib/deflate.c \ + zlib/gzlib.c \ + zlib/gzread.c \ + zlib/gzwrite.c \ + zlib/infback.c \ + zlib/inffast.c \ + zlib/inflate.c \ + zlib/inftrees.c \ + zlib/trees.c \ + zlib/uncompr.c \ + zlib/zutil.c \ + mathmodule.c \ + symtablemodule.c \ + xxsubtype.c + +CC_C_OPT = -Wno-implicit-function-declaration \ + -Wno-int-to-pointer-cast \ + -Wno-unused-but-set-variable \ + -Wno-unused-function \ + -Wno-unused-variable + +vpath %.c $(PYTHON_DIR)/Modules +vpath %.c $(PYTHON_DIR)/Objects +vpath %.c $(PYTHON_DIR)/Parser +vpath %.c $(PYTHON_DIR)/Python +vpath %.c $(REP_DIR)/src/lib/python3 +vpath %.cc $(REP_DIR)/src/lib/python3 + + +PYTHON3_ZIP = $(BUILD_BASE_DIR)/bin/python3.zip + +$(PYTHON3_ZIP): + $(MSG_MERGE)$(notdir $@) + $(VERBOSE)cd $(PYTHON_DIR)/Lib; zip -rq $(PYTHON3_ZIP) * + +# +# Generate python3.zip at the build stage, not the dependency stage, of the +# build system. +# +ifeq ($(called_from_lib_mk),yes) +python3.lib.tag: $(PYTHON3_ZIP) +endif + diff --git a/lib/mk/spec/x86_64/python3.mk b/lib/mk/spec/x86_64/python3.mk new file mode 100644 index 0000000..04a5a3f --- /dev/null +++ b/lib/mk/spec/x86_64/python3.mk @@ -0,0 +1,3 @@ +include $(REP_DIR)/lib/mk/python3.inc + +INC_DIR += $(REP_DIR)/include/python3/spec/x86_64 diff --git a/ports/python3.hash b/ports/python3.hash new file mode 100644 index 0000000..ecdf903 --- /dev/null +++ b/ports/python3.hash @@ -0,0 +1 @@ +0e64c351246be6e49e5d866ed2e19fa546badbd0 diff --git a/ports/python3.port b/ports/python3.port new file mode 100644 index 0000000..e11aa9a --- /dev/null +++ b/ports/python3.port @@ -0,0 +1,14 @@ +LICENSE := Python +VERSION := 3.6.5 +DOWNLOADS := python3.archive + +URL(python3) := https://www.python.org/ftp/python/$(VERSION)/Python-$(VERSION).tar.xz +SHA(python3) := f434053ba1b5c8a5cc597e966ead3c5143012af827fd3f0697d21450bb8d87a6 +SIG(python3) := ${URL(python)}.asc +PYTHON_KEY := 12EF3DC38047DA382D18A5B999CDEA9DA4135B38 +DIR(python3) := src/lib/python3 + +PATCHES := src/lib/python3/posixmodule.patch src/lib/python3/dup.patch src/lib/python3/expat.patch + +DIRS := include/python3 +DIR_CONTENT(include/python3) := src/lib/python3/Include/*.h diff --git a/run/python3.run b/run/python3.run new file mode 100644 index 0000000..4f01e1f --- /dev/null +++ b/run/python3.run @@ -0,0 +1,130 @@ +# +# \brief Test for running python +# \author Norman Feske +# \author Johannes Schlatow +# \date 2011-11-22 +# + +if {![have_spec x86]} { + puts "Run script is only supported on x86"; exit 0 } + + +# +# Build +# + +build { + core init + app/python3 + lib/vfs/jitterentropy + drivers/timer + drivers/rtc +} + +create_boot_directory + +# +# Generate config +# + +set config { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +print(" \r\n\r"); +print(" -============================-"); +print(" || ||"); +print(" || Python Core 3 ||"); +print(" || ||"); +print(" || Genode 17.11 ||"); +print(" || ||"); +print(" -============================-"); +print(" \r"); +print(" 2018 by Genode Labs www.genode-labs.com"); +print(" \r\n\r"); + + + + + + +} + +install_config $config + +# +# Boot modules +# + +# generic modules +set boot_modules { + core init + ld.lib.so libc.lib.so libm.lib.so python3.lib.so posix.lib.so + python3 + vfs_jitterentropy.lib.so + timer + rtc_drv + python3.zip + vfs.lib.so +} + +build_boot_image $boot_modules + +# +# Execute test case +# + +append qemu_args " -nographic " + +run_genode_until {.*Executed .*} 60 + +grep_output {python3\] } +compare_output_to { +[init -> python3] +[init -> python3] -============================- +[init -> python3] || || +[init -> python3] || Python Core 3 || +[init -> python3] || || +[init -> python3] || Genode 17.11 || +[init -> python3] || || +[init -> python3] -============================- +[init -> python3] +[init -> python3] 2018 by Genode Labs www.genode-labs.com +[init -> python3] +} + +# vi: set ft=tcl : diff --git a/src/app/python3/main.cc b/src/app/python3/main.cc new file mode 100644 index 0000000..747b3ef --- /dev/null +++ b/src/app/python3/main.cc @@ -0,0 +1,97 @@ +/* + * \brief Running python script on Genode + * \author Johannes Schlatow + * \date 2010-02-17 + */ + +/* + * Copyright (C) 2018 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU Affero General Public License version 3. + */ + +/* Python includes */ +#include + +/* Genode includes */ +#include +#include +#include +#include + +/* libc includes */ +#include + +namespace Python +{ + struct Main; +} + +struct Python::Main +{ + Genode::Env &_env; + + Genode::Attached_rom_dataspace _config = { _env, "config" }; + + void _handle_config() + { + enum { + MAX_NAME_LEN = 128 + }; + + char filename[MAX_NAME_LEN]; + + if (_config.xml().has_sub_node("file")) { + Genode::Xml_node script = _config.xml().sub_node("file"); + + script.attribute("name").value(filename, sizeof(filename)); + } else { + Genode::error("Need as argument!"); + return; + } + + wchar_t wbuf[MAX_NAME_LEN]; + + if (_config.xml().has_sub_node("pythonpath")) { + char pythonpath[MAX_NAME_LEN]; + Genode::Xml_node path = _config.xml().sub_node("pythonpath"); + + path.attribute("name").value(pythonpath, sizeof(pythonpath)); + mbstowcs(wbuf, pythonpath, strlen(pythonpath)); + + Py_SetPath(wbuf); + } + + mbstowcs(wbuf, filename, strlen(filename)); + + FILE * fp = fopen(filename, "r"); + //fp._flags = __SRD; + Py_SetProgramName(wbuf); + //don't need the 'site' module + Py_NoSiteFlag = 1; + //don't support interactive mode, yet + Py_InteractiveFlag = 0; + Py_Initialize(); + + Genode::log("Starting python ..."); + PyRun_SimpleFile(fp, filename); + Genode::log("Executed '", Genode::Cstring(filename), "'"); + Py_Finalize(); + } + + Genode::Signal_handler
_config_handler { + _env.ep(), *this, &Main::_handle_config }; + + Main(Genode::Env &env) : _env(env) + { + _config.sigh(_config_handler); + _handle_config(); + } +}; + + +void Libc::Component::construct(Libc::Env &env) +{ + Libc::with_libc([&] () { static Python::Main main(env); }); +} diff --git a/src/app/python3/target.mk b/src/app/python3/target.mk new file mode 100644 index 0000000..842c669 --- /dev/null +++ b/src/app/python3/target.mk @@ -0,0 +1,4 @@ +TARGET = python3 +LIBS = python3 libc +REQUIRES = x86 +SRC_CC = main.cc diff --git a/src/lib/python3/config.c b/src/lib/python3/config.c new file mode 100644 index 0000000..7febe81 --- /dev/null +++ b/src/lib/python3/config.c @@ -0,0 +1,129 @@ +/* Generated automatically from ./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 create_builtin() in import.c. */ + +#include "Python.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +extern PyObject* PyInit__signal(void); +extern PyObject* PyInit__struct(void); +extern PyObject* PyInit_atexit(void); +extern PyObject* PyInit_posix(void); +extern PyObject* PyInit_errno(void); +extern PyObject* PyInit_pwd(void); +extern PyObject* PyInit__sre(void); +extern PyObject* PyInit__codecs(void); +extern PyObject* PyInit_zipimport(void); +extern PyObject* PyInit__symtable(void); +extern PyObject* PyInit_xxsubtype(void); +extern PyObject* PyInit_math(void); +extern PyObject* PyInit_time(void); +extern PyObject* PyInit__operator(void); +extern PyObject* PyInit_zlib(void); +extern PyObject* PyInit__random(void); +extern PyObject* PyInit_itertools(void); +extern PyObject* PyInit__functools(void); +extern PyObject* PyInit__collections(void); +extern PyObject* PyInit__weakref(void); +extern PyObject* PyInit__locale(void); +extern PyObject* PyInit__io(void); +extern PyObject* PyInit__md5(void); +extern PyObject* PyInit__sha1(void); +extern PyObject* PyInit__sha256(void); +extern PyObject* PyInit__sha512(void); +extern PyObject* PyInit__blake2(void); +extern PyObject* PyInit__sha3(void); +extern PyObject* PyInit_pyexpat(void); + +/* -- ADDMODULE MARKER 1 -- */ + +extern PyObject* PyMarshal_Init(void); +extern PyObject* PyInit_imp(void); +extern PyObject* PyInit_gc(void); +extern PyObject* PyInit__ast(void); +extern PyObject* _PyWarnings_Init(void); +extern PyObject* PyInit__string(void); + +struct _inittab _PyImport_Inittab[] = { + + {"_signal", PyInit__signal}, + {"_struct", PyInit__struct}, + {"atexit", PyInit_atexit}, + {"posix", PyInit_posix}, + {"errno", PyInit_errno}, + {"pwd", PyInit_pwd}, + {"_sre", PyInit__sre}, + {"_codecs", PyInit__codecs}, + {"_weakref", PyInit__weakref}, + {"_operator", PyInit__operator}, + {"math", PyInit_math}, + {"time", PyInit_time}, + {"itertools", PyInit_itertools}, + {"_functools", PyInit__functools}, + {"_collections", PyInit__collections}, + {"_locale", PyInit__locale}, + {"_io", PyInit__io}, + {"zipimport", PyInit_zipimport}, + {"_symtable", PyInit__symtable}, + {"xxsubtype", PyInit_xxsubtype}, + {"_random", PyInit__random}, + {"zlib", PyInit_zlib}, + {"_md5", PyInit__md5}, + {"_sha1", PyInit__sha1}, + {"_sha256", PyInit__sha256}, + {"_sha512", PyInit__sha512}, + {"_blake2", PyInit__blake2}, + {"_sha3", PyInit__sha3}, + {"pyexpat", PyInit_pyexpat}, + +/* -- ADDMODULE MARKER 2 -- */ + + /* This module lives in marshal.c */ + {"marshal", PyMarshal_Init}, + + /* This lives in import.c */ + {"imp", PyInit_imp}, + + /* This lives in Python/Python-ast.c */ + {"_ast", PyInit__ast}, + + /* These entries are here for sys.builtin_module_names */ + {"builtins", NULL}, + {"sys", NULL}, + + /* This lives in gcmodule.c */ + {"gc", PyInit_gc}, + + /* This lives in _warnings.c */ + {"_warnings", _PyWarnings_Init}, + + /* This lives in Objects/unicodeobject.c */ + {"_string", PyInit__string}, + + /* Sentinel */ + {0, 0} +}; + + +#ifdef __cplusplus +} +#endif + diff --git a/src/lib/python3/dup.patch b/src/lib/python3/dup.patch new file mode 100644 index 0000000..f85f568 --- /dev/null +++ b/src/lib/python3/dup.patch @@ -0,0 +1,27 @@ ++++ src/lib/python3/Python/pylifecycle.c 2018-05-11 15:20:34.421070206 +0200 +@@ -1051,15 +1051,7 @@ + int fd2; + if (fd < 0) + return 0; +- _Py_BEGIN_SUPPRESS_IPH +- /* Prefer dup() over fstat(). fstat() can require input/output whereas +- dup() doesn't, there is a low risk of EMFILE/ENFILE at Python +- startup. */ +- fd2 = dup(fd); +- if (fd2 >= 0) +- close(fd2); +- _Py_END_SUPPRESS_IPH +- return fd2 >= 0; ++ return fd >= 0; + #endif + } + ++++ src/lib/python3/Python/fileutils.c 2018-05-11 15:15:46.841809875 +0200 +@@ -1543,6 +1543,7 @@ + int + _Py_dup(int fd) + { ++ return fd; + #ifdef MS_WINDOWS + HANDLE handle; + DWORD ftype; diff --git a/src/lib/python3/expat.patch b/src/lib/python3/expat.patch new file mode 100644 index 0000000..46d3a3c --- /dev/null +++ b/src/lib/python3/expat.patch @@ -0,0 +1,8 @@ ++++ src/lib/python3/Modules/expat/expat_config.h 2018-05-29 14:26:26.737762285 +0200 +@@ -16,4 +16,6 @@ + #define XML_DTD 1 + #define XML_CONTEXT_BYTES 1024 + ++#undef PREFIX ++ + #endif /* EXPAT_CONFIG_H */ diff --git a/src/lib/python3/posixmodule.patch b/src/lib/python3/posixmodule.patch new file mode 100644 index 0000000..e2809d5 --- /dev/null +++ b/src/lib/python3/posixmodule.patch @@ -0,0 +1,20 @@ ++++ src/lib/python3/Modules/posixmodule.c +@@ -178,15 +178,15 @@ + #define fsync _commit + #else + /* Unix functions that the configure script doesn't check for */ +-#define HAVE_EXECV 1 ++//#define HAVE_EXECV 1 + #define HAVE_FORK 1 + #if defined(__USLC__) && defined(__SCO_VERSION__) /* SCO UDK Compiler */ + #define HAVE_FORK1 1 + #endif +-#define HAVE_GETEGID 1 ++//#define HAVE_GETEGID 1 + #define HAVE_GETEUID 1 + #define HAVE_GETGID 1 +-#define HAVE_GETPPID 1 ++//#define HAVE_GETPPID 1 + #define HAVE_GETUID 1 + #define HAVE_KILL 1 + #define HAVE_OPENDIR 1