Skip to content

Commit

Permalink
python3[567]: fix building on macOS11
Browse files Browse the repository at this point in the history
see #682
  • Loading branch information
nieder committed Nov 15, 2020
1 parent 8199b70 commit ecbc060
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 7 deletions.
21 changes: 21 additions & 0 deletions 10.9-libcxx/stable/main/finkinfo/languages/python35-darwin20.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff -ruN Python-3.5.10-orig/configure Python-3.5.10/configure
--- Python-3.5.10-orig/configure 2020-09-05 02:22:07.000000000 -0500
+++ Python-3.5.10/configure 2020-11-14 13:19:46.000000000 -0600
@@ -3492,7 +3492,7 @@
# has no effect, don't bother defining them
Darwin/[6789].*)
define_xopen_source=no;;
- Darwin/1[0-9].*)
+ Darwin/[12][0-9].*)
define_xopen_source=no;;
# On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
# used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
@@ -7222,7 +7222,7 @@
ARCH_RUN_32BIT=""
;;
64-bit)
- UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
+ UNIVERSAL_ARCH_FLAGS="-arch x86_64"
LIPO_32BIT_FLAGS=""
ARCH_RUN_32BIT="true"
;;
21 changes: 18 additions & 3 deletions 10.9-libcxx/stable/main/finkinfo/languages/python35.info
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@ Source-Checksum: SHA256(0f0fa8685c1dc1f1dacb0b4e7779796b90aef99dc1fa4967a71b9da7
#Source2-MD5: c576463076f94da8daaf39f8eaeacd14
PatchFile: %n.patch
PatchFile-MD5: f07ce62c88ca3be5afd05362a935f0a6
PatchFile2: %n-darwin20.patch
PatchFile2-MD5: 5fc4c8c53d930e55ec850bb3bc9cccbf
PatchScript: <<
#!/bin/sh -ex
sed 's|@PREFIX@|%p|g' < %{PatchFile} | patch -p1
patch -p1 < %{PatchFile2}
# /tmp and /var/tmp are symlinks to /private/tmp and /private/var/tmp
# on OS X. That's fine except it can cause tests in some packages to
# fail since '/tmp' != '/private/tmp'. Default to using /private/tmp.
Expand Down Expand Up @@ -96,14 +99,19 @@ CompileScript: <<
export CPPFLAGS="-I%p/include -I%p/include/ncursesw -I$SDK_PATH/usr/include"
perl -pi -e "s|/usr/include|$SDK_PATH/usr/include|" setup.py
fi
# for macOS 11, need help finding libz in new system-library cache
# https://bugs.python.org/issue41116
if [ "$(uname -r | cut -d. -f1)" -ge 20 ]; then
DIST_CONFIG_PARAMS="--enable-universalsdk=$(xcrun --sdk macosx --show-sdk-path) --with-universal-archs=64-bit"
fi

# https://bugs.python.org/issue28456 and radar://28372390
# https://daniel.haxx.se/blog/2016/10/11/poll-on-mac-10-12-is-broken/
./configure %c
./configure %c $DIST_CONFIG_PARAMS
perl -pi -e 's|\#define HAVE_POLL 1||' ./pyconfig.h
perl -pi -e 's|\#define HAVE_POLL_H 1||g' ./pyconfig.h
perl -pi -e 's|\#define HAVE_SYS_POLL_H 1||g' ./pyconfig.h
make
make -w -j1
<<

# Tests have started hanging for me.
Expand All @@ -124,7 +132,8 @@ InfoTest: <<
# test_socket can fail with some DNS settings.
# multiprocessing_spawn fails on "KeyboardInterrupt not raised by wait",
# the other 4 hang indefinitely
EXTRATESTOPTS='-w -unone -x test_socket test_distutils test_ssl test_multiprocessing_spawn test_asyncio test_httpservers test_logging test_xmlrpc'
# test_ctypes is currently broken on 11.0
EXTRATESTOPTS='-w -unone -x test_socket test_distutils test_ssl test_multiprocessing_spawn test_asyncio test_httpservers test_logging test_xmlrpc test_ctypes'
LANG=en_US.UTF-8 make -k test EXTRATESTOPTS="$EXTRATESTOPTS" || TESTRETURN=$?

# Put install_name back.
Expand Down Expand Up @@ -281,6 +290,12 @@ DescPort: <<

Call build executable by correct filename in test suite
(python on case-sensitive, python.exe on -insensitive file systems).

On macOS11, ctypes test needs to know about shared library cache
but not yet ported to release branches.
https://github.com/python/cpython/pull/22855
Also, for python35, 64-bit building implies ppc64 as well, so patch out
that arch.
<<
License: OSI-Approved
Homepage: http://www.python.org
Expand Down
11 changes: 11 additions & 0 deletions 10.9-libcxx/stable/main/finkinfo/languages/python36-darwin20.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/configure 2020-06-29 23:03:57.000000000 +1000
+++ b/configure 2020-06-29 23:06:58.000000000 +1000
@@ -3377,7 +3377,7 @@
# has no effect, don't bother defining them
Darwin/[6789].*)
define_xopen_source=no;;
- Darwin/1[0-9].*)
+ Darwin/[12][0-9].*)
define_xopen_source=no;;
# On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
# used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
18 changes: 16 additions & 2 deletions 10.9-libcxx/stable/main/finkinfo/languages/python36.info
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,12 @@ Source-Checksum: SHA256(70953a9b5d6891d92e65d184c3512126a15814bee15e1eff2ddcce04

PatchFile: %n.patch
PatchFile-MD5: d1f5d23c7ee06375a290374404552ecb
PatchFile2: %n-darwin20.patch
PatchFile2-MD5: ce2e335a3d3964002ef12219e7ed56ae
PatchScript: <<
#!/bin/sh -ex
sed 's|@PREFIX@|%p|g' < %{PatchFile} | patch -p1
patch -p1 < %{PatchFile2}
# /tmp and /var/tmp are symlinks to /private/tmp and /private/var/tmp
# on OS X. That's fine except it can cause tests in some packages to
# fail since '/tmp' != '/private/tmp'. Default to using /private/tmp.
Expand Down Expand Up @@ -95,10 +98,15 @@ CompileScript: <<
export CPPFLAGS="-I%p/include -I%p/include/ncursesw -I$SDK_PATH/usr/include"
perl -pi -e "s|/usr/include|$SDK_PATH/usr/include|" setup.py
fi
# for macOS 11, need help finding libz in new system-library cache
# https://bugs.python.org/issue41116
if [ "$(uname -r | cut -d. -f1)" -ge 20 ]; then
DIST_CONFIG_PARAMS="--enable-universalsdk=$(xcrun --sdk macosx --show-sdk-path) --with-universal-archs=intel-64"
fi

# https://bugs.python.org/issue28456 and radar://28372390
# https://daniel.haxx.se/blog/2016/10/11/poll-on-mac-10-12-is-broken/
./configure %c
./configure %c $DIST_CONFIG_PARAMS
perl -pi -e 's|\#define HAVE_POLL 1||' ./pyconfig.h
perl -pi -e 's|\#define HAVE_POLL_H 1||g' ./pyconfig.h
perl -pi -e 's|\#define HAVE_SYS_POLL_H 1||g' ./pyconfig.h
Expand All @@ -123,7 +131,9 @@ InfoTest: <<
# EXTRATESTOPTS='-w -unone -x test_socket test_distutils test_ssl'
# multiprocessing_span can fail on "KeyboardInterrupt not raised by wait",
# the other 4 hang indefinitely
EXTRATESTOPTS='-w -unone -x test_asyncio test_httpservers test_logging test_xmlrpc'
# test_distutils requires an installed python36 instance for linking
# test_ctypes is currently broken on 11.0
EXTRATESTOPTS='-w -unone -x test_socket test_asyncio test_httpservers test_logging test_xmlrpc test_distutils test_ctypes'
LANG=en_US.UTF-8 make -k test EXTRATESTOPTS="$EXTRATESTOPTS" || TESTRETURN=$?

# Put install_name back.
Expand Down Expand Up @@ -277,6 +287,10 @@ DescPort: <<

Call build executable by correct filename in test suite
(python on case-sensitive, python.exe on -insensitive file systems).

On macOS11, ctypes test needs to know about shared library cache
but not yet ported to release branches.
https://github.com/python/cpython/pull/22855
<<
License: OSI-Approved
Homepage: http://www.python.org
Expand Down
14 changes: 12 additions & 2 deletions 10.9-libcxx/stable/main/finkinfo/languages/python37.info
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,15 @@ CompileScript: <<
export CPPFLAGS="-I%p/include -I%p/include/ncursesw -I$SDK_PATH/usr/include"
perl -pi -e "s|/usr/include|$SDK_PATH/usr/include|" setup.py
fi
# for macOS 11, need help finding libz in new system-library cache
# https://bugs.python.org/issue41116
if [ "$(uname -r | cut -d. -f1)" -ge 20 ]; then
DIST_CONFIG_PARAMS="--enable-universalsdk=$(xcrun --sdk macosx --show-sdk-path) --with-universal-archs=intel-64"
fi

# https://bugs.python.org/issue28456 and radar://28372390
# https://daniel.haxx.se/blog/2016/10/11/poll-on-mac-10-12-is-broken/
./configure %c
./configure %c $DIST_CONFIG_PARAMS
perl -pi -e 's|\#define HAVE_POLL 1||' ./pyconfig.h
perl -pi -e 's|\#define HAVE_POLL_H 1||g' ./pyconfig.h
perl -pi -e 's|\#define HAVE_SYS_POLL_H 1||g' ./pyconfig.h
Expand All @@ -125,7 +130,8 @@ InfoTest: <<
# test_socket can fail with some DNS settings.
# multiprocessing_spawn fails on "KeyboardInterrupt not raised by wait",
# the other 4 hang indefinitely
EXTRATESTOPTS='-w -unone -x test_socket test_distutils test_ssl test_multiprocessing_spawn test_asyncio test_httpservers test_logging test_xmlrpc'
# test_ctypes is currently broken on 11.0 (py3.8.6)
EXTRATESTOPTS='-w -unone -x test_socket test_distutils test_ssl test_multiprocessing_spawn test_asyncio test_httpservers test_logging test_xmlrpc test_ctypes'
LANG=en_US.UTF-8 make -k test EXTRATESTOPTS="$EXTRATESTOPTS" || TESTRETURN=$?

# Put install_name back.
Expand Down Expand Up @@ -278,6 +284,10 @@ DescPort: <<

Call build executable by correct filename in test suite
(python on case-sensitive, python.exe on -insensitive file systems).

On macOS11, ctypes test needs to know about shared library cache
but not yet ported to release branches.
https://github.com/python/cpython/pull/22855
<<
License: OSI-Approved
Homepage: http://www.python.org
Expand Down

0 comments on commit ecbc060

Please sign in to comment.