Skip to content

python313: fix build on Tiger and Leopard #28265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
8 changes: 7 additions & 1 deletion lang/python313/Portfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

Check warning on line 1 in lang/python313/Portfile

View workflow job for this annotation

GitHub Actions / macos-15

port lint python313: Warning: Unnecessary platforms line as darwin is the default

Check warning on line 1 in lang/python313/Portfile

View workflow job for this annotation

GitHub Actions / macos-14

port lint python313: Warning: Unnecessary platforms line as darwin is the default

Check warning on line 1 in lang/python313/Portfile

View workflow job for this annotation

GitHub Actions / macos-13

port lint python313: Warning: Unnecessary platforms line as darwin is the default

PortSystem 1.0

Expand Down Expand Up @@ -36,7 +36,11 @@
if {${os.platform} eq "darwin" && ${os.major} <= 10} {
# work around no copyfile and/or pthread_threadid_np on older systems
patchfiles-append patch-no-copyfile-on-Tiger.diff \
patch-threadid-older-systems.diff
patch-threadid-older-systems.diff \
patch-testexternalinspection-tiger.patch
if {${os.major} < 9} {
patchfiles-append patch-largefile-tiger.patch
}
}

depends_build path:bin/pkg-config:pkgconfig
Expand Down Expand Up @@ -122,6 +126,8 @@
platform darwin {
if {${os.major} < 11} {
configure.args-append --without-mimalloc
# Use 64 bit inodes on 10.5 and 10.6 ppc
configure.cppflags-append -D_DARWIN_USE_64_BIT_INODE
}
if {${os.major} < 9} {
# Fixes the return type of `ttyname_r`
Expand Down
11 changes: 11 additions & 0 deletions lang/python313/files/patch-largefile-tiger.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- Modules/posixmodule.c
+++ Modules/posixmodule.c
@@ -13238,7 +13238,7 @@ _pystatvfs_fromstructstatfs(PyObject *module, struct statfs st) {
flags |= ST_NOSUID;
}

- _Static_assert(sizeof(st.f_blocks) == sizeof(long long), "assuming large file");
+ /* _Static_assert(sizeof(st.f_blocks) == sizeof(long long), "assuming large file"); */

#define SET_ITEM(SEQ, INDEX, EXPR) \
do { \
21 changes: 21 additions & 0 deletions lang/python313/files/patch-testexternalinspection-tiger.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--- Modules/_testexternalinspection.c
+++ Modules/_testexternalinspection.c
@@ -17,10 +17,18 @@

#if defined(__APPLE__)
# include <TargetConditionals.h>
+# include <AvailabilityMacros.h>
// Older macOS SDKs do not define TARGET_OS_OSX
# if !defined(TARGET_OS_OSX)
# define TARGET_OS_OSX 1
# endif
+
+// Tiger does not have libproc, so use the non-osx fallback
+# if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+# undef TARGET_OS_OSX
+# define TARGET_OS_OSX 0
+# endif
+
# if TARGET_OS_OSX
# include <libproc.h>
# include <mach-o/fat.h>