summaryrefslogtreecommitdiff
path: root/tools/pkg/7/python/diff/python.diff
blob: 33892cf1f43a872abe25cb1da45f7fe7dc435655 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
diff -Naur python/configure python-patched/configure
--- python/configure	2025-10-14 16:52:31.000000000 +0300
+++ python-patched/configure	2025-11-16 12:02:51.627810642 +0300
@@ -4067,6 +4067,9 @@
 	*-*-wasi*)
 	    ac_sys_system=WASI
 	    ;;
+	*-*-mlibc*)
+	    ac_sys_system=Mlibc
+	    ;;
 	*)
 		# for now, limit cross builds to known configurations
 		MACHDEP="unknown"
@@ -4491,7 +4494,7 @@
 
 if test "$cross_compiling" = yes; then
 	case "$host" in
-	*-*-linux*)
+	*-*-linux*|*-*-mlibc*)
 		case "$host_cpu" in
 		arm*)
 			_host_ident=arm
@@ -7587,7 +7590,7 @@
         PY3LIBRARY=libpython3.so
       fi
       ;;
-    Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|VxWorks*)
+    Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|VxWorks*|Mlibc*)
       LDLIBRARY='libpython$(LDVERSION).so'
       BLDLIBRARY='-L. -lpython$(LDVERSION)'
       RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
@@ -12983,7 +12986,7 @@
 	Emscripten*|WASI*)
 		LDSHARED='$(CC) -shared'
 		LDCXXSHARED='$(CXX) -shared';;
-	Linux*|GNU*|QNX*|VxWorks*|Haiku*)
+	Linux*|GNU*|QNX*|VxWorks*|Haiku*|Mlibc*)
 		LDSHARED='$(CC) -shared'
 		LDCXXSHARED='$(CXX) -shared';;
 	FreeBSD*)
@@ -13068,7 +13071,7 @@
 		 then CCSHARED="-fPIC";
 		 else CCSHARED="+z";
 		 fi;;
-	Linux*|GNU*) CCSHARED="-fPIC";;
+	Linux*|GNU*|Mlibc*) CCSHARED="-fPIC";;
 	Emscripten*|WASI*)
 		if test "x$enable_wasm_dynamic_linking" = xyes
 then :
@@ -13106,7 +13109,7 @@
 	    LINKFORSHARED="-Wl,-E -Wl,+s";;
 #	    LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
 	Linux-android*) LINKFORSHARED="-pie -Xlinker -export-dynamic";;
-	Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
+	Linux*|GNU*|Mlibc*) LINKFORSHARED="-Xlinker -export-dynamic";;
 	# -u libsys_s pulls in all symbols in libsys
 	Darwin/*|iOS/*)
 		LINKFORSHARED="$extra_undefs -framework CoreFoundation"
diff -Naur python/Lib/site.py python-patched/Lib/site.py
--- python/Lib/site.py	2025-10-14 16:52:31.000000000 +0300
+++ python-patched/Lib/site.py	2025-11-16 12:02:51.627810642 +0300
@@ -409,6 +409,10 @@
                                     f"{implementation}{ver[0]}.{ver[1]}{abi_thread}",
                                     "site-packages")
                 sitepackages.append(path)
+                path = os.path.join(prefix, libdir,
+                                    f"{implementation}{ver[0]}.{ver[1]}{abi_thread}",
+                                    "dist-packages")
+                sitepackages.append(path)
         else:
             sitepackages.append(prefix)
             sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
diff -Naur python/Modules/timemodule.c python-patched/Modules/timemodule.c
--- python/Modules/timemodule.c	2025-10-14 16:52:31.000000000 +0300
+++ python-patched/Modules/timemodule.c	2025-11-16 12:10:46.792330954 +0300
@@ -185,13 +185,7 @@
 static int
 time_clockid_converter(PyObject *obj, clockid_t *p)
 {
-#ifdef _AIX
-    long long clk_id = PyLong_AsLongLong(obj);
-#elif defined(__DragonFly__)
-    long clk_id = PyLong_AsLong(obj);
-#else
-    int clk_id = PyLong_AsInt(obj);
-#endif
+	int clk_id = PyLong_AsInt(obj);
     if (clk_id == -1 && PyErr_Occurred()) {
         PyErr_Format(PyExc_TypeError,
                      "clk_id should be integer, not %s",
diff -Naur python/Objects/mimalloc/prim/unix/prim.c python-patched/Objects/mimalloc/prim/unix/prim.c
--- python/Objects/mimalloc/prim/unix/prim.c	2025-10-14 16:52:31.000000000 +0300
+++ python-patched/Objects/mimalloc/prim/unix/prim.c	2025-11-16 12:02:51.627810642 +0300
@@ -29,6 +29,10 @@
 #include <unistd.h>    // sysconf
 #include <fcntl.h>     // open, close, read, access
 
+#if defined(__orange__)
+  #define MADV_DONTNEED 1
+#endif
+
 #if defined(__linux__)
   #include <features.h>
   #include <fcntl.h>
@@ -51,11 +55,6 @@
   #include <sys/sysctl.h>
 #endif
 
-#if !defined(__HAIKU__) && !defined(__APPLE__) && !defined(__CYGWIN__) && !defined(_AIX) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__sun) && !defined(__NetBSD__)
-  #define MI_HAS_SYSCALL_H
-  #include <sys/syscall.h>
-#endif
-
 //------------------------------------------------------------------------------------
 // Use syscalls for some primitives to allow for libraries that override open/read/close etc.
 // and do allocation themselves; using syscalls prevents recursion when mimalloc is
@@ -156,6 +155,9 @@
 static int unix_madvise(void* addr, size_t size, int advice) {
   #if defined(__sun)
   return madvise((caddr_t)addr, size, advice);  // Solaris needs cast (issue #520)
+  #elif defined(__orange__)
+  (void)addr; (void)size; (void)advice;
+  return 0;
   #else
   return madvise(addr, size, advice);
   #endif