diff -Paur --no-dereference -- python.upstream/Include/py_curses.h python/Include/py_curses.h --- python.upstream/Include/py_curses.h +++ python/Include/py_curses.h @@ -37,6 +37,12 @@ #endif #ifdef HAVE_NCURSES_H +/* PATCH: Sortix's libcurses doesn't have a public _ISPAD */ +#ifdef _ISPAD +#ifndef WINDOW_HAS_FLAGS +#define WINDOW_HAS_FLAGS 1 +#endif +#endif /* configure was checking , but we will use , which has some or all these features. */ #if !defined(WINDOW_HAS_FLAGS) && !(NCURSES_OPAQUE+0) diff -Paur --no-dereference -- python.upstream/Include/pyport.h python/Include/pyport.h --- python.upstream/Include/pyport.h +++ python/Include/pyport.h @@ -3,6 +3,9 @@ #include "pyconfig.h" /* include for defines */ +/* PATCH: Get SSIZE_MAX on Sortix whose limits.h is broken. */ +#include + #include #include diff -Paur --no-dereference -- python.upstream/Lib/ctypes/__init__.py python/Lib/ctypes/__init__.py --- python.upstream/Lib/ctypes/__init__.py +++ python/Lib/ctypes/__init__.py @@ -469,7 +469,15 @@ elif _sys.platform == "cygwin": pythonapi = PyDLL("libpython%d.%d.dll" % _sys.version_info[:2]) else: - pythonapi = PyDLL(None) + # PATCH: Sortix doesn't have dynamic linking yet, but parts of ctypes are + # still useful without it, so ignore an error. + try: + pythonapi = PyDLL(None) + except OSError: + if _sys.platform == "sortix": + pythonapi = None + else: + raise if _os.name == "nt": diff -Paur --no-dereference -- python.upstream/Makefile.pre.in python/Makefile.pre.in --- python.upstream/Makefile.pre.in +++ python/Makefile.pre.in @@ -2029,24 +2029,29 @@ else true; \ fi (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) python3$(EXE)) + -if test -f $(DESTDIR)$(BINDIR)/python$(EXE) -o -h $(DESTDIR)$(BINDIR)/python$(EXE); \ + then rm -f $(DESTDIR)$(BINDIR)/python$(EXE); \ + else true; \ + fi + (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) python$(EXE)) -if test "$(VERSION)" != "$(LDVERSION)"; then \ - rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)-config; \ - (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(LDVERSION)-config python$(VERSION)-config); \ rm -f $(DESTDIR)$(LIBPC)/python-$(LDVERSION).pc; \ (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python-$(LDVERSION).pc); \ rm -f $(DESTDIR)$(LIBPC)/python-$(LDVERSION)-embed.pc; \ (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION)-embed.pc python-$(LDVERSION)-embed.pc); \ fi - -rm -f $(DESTDIR)$(BINDIR)/python3-config - (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python3-config) -rm -f $(DESTDIR)$(LIBPC)/python3.pc (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python3.pc) -rm -f $(DESTDIR)$(LIBPC)/python3-embed.pc (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION)-embed.pc python3-embed.pc) -rm -f $(DESTDIR)$(BINDIR)/idle3 (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3) + -rm -f $(DESTDIR)$(BINDIR)/idle + (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle) -rm -f $(DESTDIR)$(BINDIR)/pydoc3 (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3) + -rm -f $(DESTDIR)$(BINDIR)/pydoc + (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc) -rm -f $(DESTDIR)$(BINDIR)/2to3 (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3) if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \ @@ -2453,7 +2458,6 @@ $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh $(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py - $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config $(INSTALL_SCRIPT) $(SCRIPT_2TO3) $(DESTDIR)$(BINDIR)/2to3-$(VERSION) $(INSTALL_SCRIPT) $(SCRIPT_IDLE) $(DESTDIR)$(BINDIR)/idle$(VERSION) $(INSTALL_SCRIPT) $(SCRIPT_PYDOC) $(DESTDIR)$(BINDIR)/pydoc$(VERSION) @@ -2710,6 +2714,8 @@ -o -name '*.orig' -o -name '*.rej' \ -o -name '*.bak' ')' \ -exec rm -f {} ';' + -rm -rf $(srcdir)/Lib/plat-sortix + -rm -f Misc/python-config.sh # Check that all symbols exported by libpython start with "Py" or "_Py" .PHONY: smelly diff -Paur --no-dereference -- python.upstream/Modules/Setup.stdlib.in python/Modules/Setup.stdlib.in --- python.upstream/Modules/Setup.stdlib.in +++ python/Modules/Setup.stdlib.in @@ -171,13 +171,14 @@ @MODULE__TESTCAPI_TRUE@_testcapi _testcapimodule.c _testcapi/vectorcall.c _testcapi/vectorcall_limited.c _testcapi/heaptype.c _testcapi/abstract.c _testcapi/bytearray.c _testcapi/bytes.c _testcapi/unicode.c _testcapi/dict.c _testcapi/set.c _testcapi/list.c _testcapi/tuple.c _testcapi/getargs.c _testcapi/pytime.c _testcapi/datetime.c _testcapi/docstring.c _testcapi/mem.c _testcapi/watchers.c _testcapi/long.c _testcapi/float.c _testcapi/complex.c _testcapi/numbers.c _testcapi/structmember.c _testcapi/exceptions.c _testcapi/code.c _testcapi/buffer.c _testcapi/pyos.c _testcapi/file.c _testcapi/codec.c _testcapi/immortal.c _testcapi/heaptype_relative.c _testcapi/gc.c _testcapi/sys.c @MODULE__TESTCLINIC_TRUE@_testclinic _testclinic.c +# PATCH: Sortix doesn't have shared libraries yet and we don't need these. # Some testing modules MUST be built as shared libraries. *shared* -@MODULE__TESTIMPORTMULTIPLE_TRUE@_testimportmultiple _testimportmultiple.c -@MODULE__TESTMULTIPHASE_TRUE@_testmultiphase _testmultiphase.c -@MODULE__TESTMULTIPHASE_TRUE@_testsinglephase _testsinglephase.c -@MODULE__CTYPES_TEST_TRUE@_ctypes_test _ctypes/_ctypes_test.c +#@MODULE__TESTIMPORTMULTIPLE_TRUE@_testimportmultiple _testimportmultiple.c +#@MODULE__TESTMULTIPHASE_TRUE@_testmultiphase _testmultiphase.c +#@MODULE__TESTMULTIPHASE_TRUE@_testsinglephase _testsinglephase.c +#@MODULE__CTYPES_TEST_TRUE@_ctypes_test _ctypes/_ctypes_test.c # Limited API template modules; must be built as shared modules. -@MODULE_XXLIMITED_TRUE@xxlimited xxlimited.c -@MODULE_XXLIMITED_35_TRUE@xxlimited_35 xxlimited_35.c +#@MODULE_XXLIMITED_TRUE@xxlimited xxlimited.c +#@MODULE_XXLIMITED_35_TRUE@xxlimited_35 xxlimited_35.c diff -Paur --no-dereference -- python.upstream/Modules/_cursesmodule.c python/Modules/_cursesmodule.c --- python.upstream/Modules/_cursesmodule.c +++ python/Modules/_cursesmodule.c @@ -167,6 +167,14 @@ [clinic start generated code]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=43265c372c2887d6]*/ +/* PATCH: Avoid conflict with as described above now that we use it. */ +#ifdef lines +#undef lines +#endif +#ifdef columns +#undef columns +#endif + /* Definition of exception curses.error */ static PyObject *PyCursesError; @@ -2154,6 +2162,7 @@ This information can be later retrieved using the getwin() function. [clinic start generated code]*/ +#ifndef __sortix__ static PyObject * _curses_window_putwin(PyCursesWindowObject *self, PyObject *file) /*[clinic end generated code: output=3a25e2a5e7a040ac input=0608648e09c8ea0a]*/ @@ -2188,6 +2197,7 @@ fclose(fp); return res; } +#endif /*[clinic input] _curses.window.redrawln @@ -2534,7 +2544,9 @@ _CURSES_WINDOW_NOUTREFRESH_METHODDEF _CURSES_WINDOW_OVERLAY_METHODDEF _CURSES_WINDOW_OVERWRITE_METHODDEF +#ifndef __sortix__ _CURSES_WINDOW_PUTWIN_METHODDEF +#endif _CURSES_WINDOW_REDRAWLN_METHODDEF {"redrawwin", (PyCFunction)PyCursesWindow_redrawwin, METH_NOARGS}, _CURSES_WINDOW_REFRESH_METHODDEF diff -Paur --no-dereference -- python.upstream/Modules/fcntlmodule.c python/Modules/fcntlmodule.c --- python.upstream/Modules/fcntlmodule.c +++ python/Modules/fcntlmodule.c @@ -299,6 +299,10 @@ ret = flock(fd, code); Py_END_ALLOW_THREADS } while (ret == -1 && errno == EINTR && !(async_err = PyErr_CheckSignals())); +#elif !defined(F_SETLK) + errno = ENOSYS; + PyErr_SetFromErrno(PyExc_IOError); + return NULL; #else #ifndef LOCK_SH @@ -389,6 +393,11 @@ #define LOCK_UN 8 /* unlock */ #endif /* LOCK_SH */ { +#ifndef F_SETLK + errno = ENOSYS; + PyErr_SetFromErrno(PyExc_IOError); + return NULL; +#else struct flock l; if (code == LOCK_UN) l.l_type = F_UNLCK; @@ -430,6 +439,7 @@ ret = fcntl(fd, (code & LOCK_NB) ? F_SETLK : F_SETLKW, &l); Py_END_ALLOW_THREADS } while (ret == -1 && errno == EINTR && !(async_err = PyErr_CheckSignals())); +#endif } if (ret < 0) { return !async_err ? PyErr_SetFromErrno(PyExc_OSError) : NULL; diff -Paur --no-dereference -- python.upstream/Modules/getpath.c python/Modules/getpath.c --- python.upstream/Modules/getpath.c +++ python/Modules/getpath.c @@ -795,6 +795,12 @@ } +static const char* fix_empty_prefix(const char* path) +{ + return path[0] ? path : "/"; +} + + /* Perform the actual path calculation. When compute_path_config is 0, this only reads any initialised path @@ -882,8 +888,8 @@ #else !int_to_dict(dict, "WITH_NEXT_FRAMEWORK", 0) || #endif - !decode_to_dict(dict, "PREFIX", PREFIX) || - !decode_to_dict(dict, "EXEC_PREFIX", EXEC_PREFIX) || + !decode_to_dict(dict, "PREFIX", fix_empty_prefix(PREFIX)) || + !decode_to_dict(dict, "EXEC_PREFIX", fix_empty_prefix(EXEC_PREFIX)) || !decode_to_dict(dict, "PYTHONPATH", PYTHONPATH) || !decode_to_dict(dict, "VPATH", VPATH) || !decode_to_dict(dict, "PLATLIBDIR", PLATLIBDIR) || diff -Paur --no-dereference -- python.upstream/Modules/getpath_noop.c python/Modules/getpath_noop.c --- python.upstream/Modules/getpath_noop.c +++ python/Modules/getpath_noop.c @@ -8,3 +8,10 @@ { return PyStatus_Error("path configuration is unsupported"); } + +/* PATCH: _testinternalcapi.c pulls this in during Programs/_freeze_module */ +PyObject * +_Py_Get_Getpath_CodeObject(void) +{ + return NULL; +} diff -Paur --no-dereference -- python.upstream/Modules/mathmodule.c python/Modules/mathmodule.c --- python.upstream/Modules/mathmodule.c +++ python/Modules/mathmodule.c @@ -123,6 +123,11 @@ return (DoubleLength) {x, y}; } +/* PATCH: Oops Sortix somehow doesn't have fma(3) in libm. */ +#if defined(__sortix__) && !defined(__SORTIX_HAS_FMA__) +#define UNRELIABLE_FMA +#endif + #ifndef UNRELIABLE_FMA static DoubleLength diff -Paur --no-dereference -- python.upstream/Modules/mmapmodule.c python/Modules/mmapmodule.c --- python.upstream/Modules/mmapmodule.c +++ python/Modules/mmapmodule.c @@ -682,7 +682,7 @@ return NULL; } Py_RETURN_NONE; -#elif defined(UNIX) +#elif defined(UNIX) && !(defined(__sortix__) && !defined(__SORTIX_HAS_MSYNC__)) /* XXX flags for msync? */ if (-1 == msync(self->data + offset, size, MS_SYNC)) { PyErr_SetFromErrno(PyExc_OSError); diff -Paur --no-dereference -- python.upstream/Modules/resource.c python/Modules/resource.c --- python.upstream/Modules/resource.c +++ python/Modules/resource.c @@ -9,6 +9,10 @@ #include #include +#if defined(__sortix__) && !defined(RLIM_NLIMITS) +#define RLIM_NLIMITS __RLIMIT_NUM_DECLARED +#endif + /* On some systems, these aren't in any header file. On others they are, with inconsistent prototypes. We declare the (default) return type, to shut up gcc -Wall; @@ -124,6 +128,7 @@ PyFloat_FromDouble(doubletime(ru.ru_utime))); PyStructSequence_SET_ITEM(result, 1, PyFloat_FromDouble(doubletime(ru.ru_stime))); +#if !defined(__sortix__) PyStructSequence_SET_ITEM(result, 2, PyLong_FromLong(ru.ru_maxrss)); PyStructSequence_SET_ITEM(result, 3, PyLong_FromLong(ru.ru_ixrss)); PyStructSequence_SET_ITEM(result, 4, PyLong_FromLong(ru.ru_idrss)); @@ -138,6 +143,7 @@ PyStructSequence_SET_ITEM(result, 13, PyLong_FromLong(ru.ru_nsignals)); PyStructSequence_SET_ITEM(result, 14, PyLong_FromLong(ru.ru_nvcsw)); PyStructSequence_SET_ITEM(result, 15, PyLong_FromLong(ru.ru_nivcsw)); +#endif if (PyErr_Occurred()) { Py_DECREF(result); diff -Paur --no-dereference -- python.upstream/Modules/socketmodule.c python/Modules/socketmodule.c --- python.upstream/Modules/socketmodule.c +++ python/Modules/socketmodule.c @@ -89,6 +89,17 @@ # define Py_BUILD_CORE_MODULE 1 #endif +#if defined(__sortix__) +struct hostent +{ + char *h_name; + char **h_aliases; + int h_addrtype; + int h_length; + char **h_addr_list; +}; +#endif + #ifdef __APPLE__ // Issue #35569: Expose RFC 3542 socket options. #define __APPLE_USE_RFC_3542 1 @@ -592,6 +603,12 @@ #include "clinic/socketmodule.c.h" #undef clinic_state +#if defined(__sortix__) +#define h_errno 0 +#define gethostbyname(a) ((void) (a), (struct hostent*) NULL) +#define gethostbyaddr(a, b, c) ((void) (a), (void) (b), (void) (c), (struct hostent*) NULL) +#endif + /* XXX There's a problem here: *static* functions are not supposed to have a Py prefix (or use CapitalizedWords). Later... */ @@ -5721,7 +5738,6 @@ #endif -#if defined(HAVE_GETHOSTBYNAME_R) || defined (HAVE_GETHOSTBYNAME) || defined (HAVE_GETHOSTBYADDR) static PyObject* sock_decode_hostname(const char *name) { @@ -5735,6 +5751,7 @@ #endif } +#if defined(HAVE_GETHOSTBYNAME_R) || defined (HAVE_GETHOSTBYNAME) || defined (HAVE_GETHOSTBYADDR) /* Convenience function common to gethostbyname_ex and gethostbyaddr */ static PyObject * @@ -6472,7 +6489,7 @@ static PyObject* socket_inet_aton(PyObject *self, PyObject *args) { -#ifdef HAVE_INET_ATON +#if defined(HAVE_INET_ATON) || defined(HAVE_INET_PTON) struct in_addr buf; #endif @@ -6488,6 +6505,15 @@ if (!PyArg_ParseTuple(args, "s:inet_aton", &ip_addr)) return NULL; +#if defined(HAVE_INET_PTON) && !defined(HAVE_INET_ATON) && !defined(HAVE_INET_ADDR) + if (inet_pton(AF_INET, ip_addr, &buf)) + return PyBytes_FromStringAndSize((char *)(&buf), + sizeof(buf)); + + PyErr_SetString(PyExc_OSError, + "illegal IP address string passed to inet_aton"); + return NULL; +#else #ifdef HAVE_INET_ATON @@ -6533,6 +6559,8 @@ #endif #endif + +#endif } #ifdef HAVE_INET_NTOA diff -Paur --no-dereference -- python.upstream/Modules/timemodule.c python/Modules/timemodule.c --- python.upstream/Modules/timemodule.c +++ python/Modules/timemodule.c @@ -1766,13 +1766,25 @@ #if !defined(MS_WINDOWS) || defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) tzset(); #endif +#if defined(__sortix__) && !defined(__SORTIX_HAS_TIMEZONE__) + ADD_INT("timezone", 0); +#else ADD_INT("timezone", _Py_timezone); +#endif #ifdef HAVE_ALTZONE ADD_INT("altzone", altzone); #else +#if defined(__sortix__) && !defined(__SORTIX_HAS_TIMEZONE__) + ADD_INT("altzone", -3600); +#else ADD_INT("altzone", _Py_timezone-3600); #endif +#endif +#if defined(__sortix__) && !defined(__SORTIX_HAS_DAYLIGHT__) + ADD_INT("daylight", 0); +#else ADD_INT("daylight", _Py_daylight); +#endif #ifdef MS_WINDOWS TIME_ZONE_INFORMATION tzinfo = {0}; GetTimeZoneInformation(&tzinfo); diff -Paur --no-dereference -- python.upstream/Programs/_testembed.c python/Programs/_testembed.c --- python.upstream/Programs/_testembed.c +++ python/Programs/_testembed.c @@ -14,6 +14,9 @@ #include // putenv() #include +/* PATCH: Ignore silly tests using putenv instead of setenv. */ +#define putenv(x) + int main_argc; char **main_argv; @@ -1843,6 +1846,10 @@ static int check_use_frozen_modules(const char *rawval) { +#if defined(__sortix__) && !defined(__SORTIX_HAS_SWPRINTF__) + error("no swprintf"); + return -1; +#else wchar_t optval[100]; if (rawval == NULL) { wcscpy(optval, L"frozen_modules"); @@ -1876,6 +1883,7 @@ dump_config(); Py_Finalize(); return 0; +#endif } static int test_init_use_frozen_modules(void) diff -Paur --no-dereference -- python.upstream/Python/fileutils.c python/Python/fileutils.c --- python.upstream/Python/fileutils.c +++ python/Python/fileutils.c @@ -2107,7 +2107,6 @@ wchar_t *resolved_path, size_t resolved_path_len) { char *cpath; - char cresolved_path[MAXPATHLEN]; wchar_t *wresolved_path; char *res; size_t r; @@ -2116,12 +2115,13 @@ errno = EINVAL; return NULL; } - res = realpath(cpath, cresolved_path); + res = realpath(cpath, NULL); PyMem_RawFree(cpath); if (res == NULL) return NULL; - wresolved_path = Py_DecodeLocale(cresolved_path, &r); + wresolved_path = Py_DecodeLocale(res, &r); + free(res); if (wresolved_path == NULL) { errno = EINVAL; return NULL; diff -Paur --no-dereference -- python.upstream/configure python/configure --- python.upstream/configure +++ python/configure @@ -3660,6 +3660,10 @@ # pybuilddir.txt will be created by --generate-posix-vars in the Makefile rm -f pybuilddir.txt +# PATCH: Simplify the port(5) by assuming --with-build-python on cross builds. +if test "x$cross_compiling" = xyes; then + with_build_python=yes +fi # Check whether --with-build-python was given. if test ${with_build_python+y} @@ -4034,6 +4038,9 @@ UNIVERSALSDK= enable_universalsdk= ;; + *-*-sortix*) + ac_sys_system=Sortix + ;; *) UNIVERSALSDK=$enableval if test ! -d "${UNIVERSALSDK}" @@ -4276,6 +4283,9 @@ *-*-wasi) ac_sys_system=WASI ;; + *-*-sortix) + ac_sys_system=Sortix + ;; *) # for now, limit cross builds to known configurations MACHDEP="unknown" @@ -4339,9 +4349,8 @@ _host_cpu=$host_cpu ;; *) - # for now, limit cross builds to known configurations - MACHDEP="unknown" - as_fn_error $? "cross build not supported for $host" "$LINENO" 5 + _host_cpu=$host_cpu + ;; esac _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}" fi @@ -12817,7 +12826,9 @@ CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base" LDCXXSHARED="g++ -shared -Wl,--enable-auto-image-base";; - *) LDSHARED="ld";; + *) + LDSHARED='$(CC) -shared' + LDCXXSHARED='$(CXX) -shared';; esac fi @@ -13613,6 +13624,50 @@ fi +# check if we need libiconv for iconv functions +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libiconv in -liconv" >&5 +$as_echo_n "checking for libiconv in -liconv... " >&6; } +if ${ac_cv_lib_iconv_iconv+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-liconv $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char libiconv (); +int +main () +{ +return libiconv (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_iconv_libiconv=yes +else + ac_cv_lib_iconv_libiconv=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iconv_libiconv" >&5 +$as_echo "$ac_cv_lib_iconv_libiconv" >&6; } +if test "x$ac_cv_lib_iconv_libiconv" = xyes; then : + +$as_echo "#define WITH_LIBICONV 1" >>confdefs.h + + LIBS="-liconv $LIBS" +fi + # check if we need libintl for locale functions { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for textdomain in -lintl" >&5 printf %s "checking for textdomain in -lintl... " >&6; } @@ -22452,7 +22507,7 @@ if test "${enable_ipv6+set}" = set; then ac_cv_buggy_getaddrinfo="no -- configured with --(en|dis)able-ipv6" else - ac_cv_buggy_getaddrinfo=yes + ac_cv_buggy_getaddrinfo="no -- because you assume correctness when cross-compiling" fi else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -27112,18 +27167,10 @@ if test "x$cross_compiling" = xyes; then if test "${ac_cv_file__dev_ptmx+set}" != set; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for /dev/ptmx" >&5 -printf %s "checking for /dev/ptmx... " >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not set" >&5 -printf "%s\n" "not set" >&6; } - as_fn_error $? "set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling" "$LINENO" 5 + ac_cv_file__dev_ptmx=yes fi if test "${ac_cv_file__dev_ptc+set}" != set; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for /dev/ptc" >&5 -printf %s "checking for /dev/ptc... " >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not set" >&5 -printf "%s\n" "not set" >&6; } - as_fn_error $? "set ac_cv_file__dev_ptc to yes/no in your CONFIG_SITE file when cross compiling" "$LINENO" 5 + ac_cv_file__dev_ptc=no fi fi @@ -28643,6 +28690,11 @@ ;; esac +# PATCH: Sortix doesn't have dynamic linking yet. +if test "$host_os" = sortix; then + MODULE_BUILDTYPE=static +fi + MODULE_BLOCK= diff -Paur --no-dereference -- python.upstream/configure.ac python/configure.ac --- python.upstream/configure.ac +++ python/configure.ac @@ -436,6 +436,9 @@ fi enable_framework= ;; + *-*-sortix*) + ac_sys_system=Sortix + ;; *) PYTHONFRAMEWORKPREFIX="${enableval}" PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR @@ -620,9 +623,8 @@ _host_cpu=$host_cpu ;; *) - # for now, limit cross builds to known configurations - MACHDEP="unknown" - AC_MSG_ERROR([cross build not supported for $host]) + _host_cpu=$host_cpu + ;; esac _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}" fi @@ -3381,7 +3383,9 @@ CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base" LDCXXSHARED="g++ -shared -Wl,--enable-auto-image-base";; - *) LDSHARED="ld";; + *) + LDSHARED='$(CC) -shared' + LDCXXSHARED='$(CXX) -shared';; esac fi @@ -3634,6 +3638,12 @@ # pthread (first!) on Linux AC_SEARCH_LIBS([sem_init], [pthread rt posix4]) +# check if we need libiconv for iconv functions +AC_CHECK_LIB(iconv, libiconv, + [AC_DEFINE(WITH_ICONV, 1, + [Define to 1 if libiconv is needed for iconv functions.]) + LIBS="-liconv $LIBS"]) + # check if we need libintl for locale functions AC_CHECK_LIB([intl], [textdomain], [AC_DEFINE([WITH_LIBINTL], [1], @@ -5389,7 +5399,7 @@ if test "${enable_ipv6+set}" = set; then ac_cv_buggy_getaddrinfo="no -- configured with --(en|dis)able-ipv6" else - ac_cv_buggy_getaddrinfo=yes + ac_cv_buggy_getaddrinfo="no -- because you assume correctness when cross-compiling" fi])) dnl if ac_cv_func_getaddrinfo @@ -6599,6 +6609,12 @@ dnl NOTE: Inform user how to proceed with files when cross compiling. if test "x$cross_compiling" = xyes; then if test "${ac_cv_file__dev_ptmx+set}" != set; then + ac_cv_file__dev_ptmx=yes + fi + if test "${ac_cv_file__dev_ptc+set}" != set; then + ac_cv_file__dev_ptc=no + fi + if test "${ac_cv_file__dev_ptmx+set}" != set; then AC_MSG_CHECKING([for /dev/ptmx]) AC_MSG_RESULT([not set]) AC_MSG_ERROR([set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling])