@@ -33,7 +33,7 @@ export trailer_m4=${TOOLS_PATH}/host/share/autoconf/autoconf/trailer.m4
3333
3434# The share/autoconf/autom4te.cfg file also hard-codes some paths. Rewrite
3535# those to the real tools path.
36- if [ " ${PYBUILD_PLATFORM} " = " macos" ]; then
36+ if [[ " ${PYBUILD_PLATFORM} " = macos* ] ]; then
3737 sed_args=(-i ' ' -e)
3838else
3939 sed_args=(-i)
@@ -59,7 +59,7 @@ cat Makefile.extra
5959pushd Python-${PYTHON_VERSION}
6060
6161# configure doesn't support cross-compiling on Apple. Teach it.
62- if [ " ${PYBUILD_PLATFORM} " = " macos" ]; then
62+ if [[ " ${PYBUILD_PLATFORM} " = macos* ] ]; then
6363 if [ -n " ${PYTHON_MEETS_MINIMUM_VERSION_3_13} " ]; then
6464 patch -p1 -i ${ROOT} /patch-apple-cross-3.13.patch
6565 elif [ " ${PYTHON_MAJMIN_VERSION} " = " 3.12" ]; then
159159# linked modules. But those libraries should only get linked into libpython, not the
160160# executable. This behavior is kinda suspect on all platforms, as it could be adding
161161# library dependencies that shouldn't need to be there.
162- if [ " ${PYBUILD_PLATFORM} " = " macos" ]; then
162+ if [[ " ${PYBUILD_PLATFORM} " = macos* ] ]; then
163163 if [ " ${PYTHON_MAJMIN_VERSION} " = " 3.9" ]; then
164164 patch -p1 -i ${ROOT} /patch-python-link-modules-3.9.patch
165165 elif [ " ${PYTHON_MAJMIN_VERSION} " = " 3.10" ]; then
214214# macOS. On older versions, we need to hack up readline.c to build against
215215# libedit. This patch breaks older libedit (as seen on macOS) so don't apply
216216# on macOS.
217- if [[ -n " ${PYTHON_MEETS_MAXIMUM_VERSION_3_9} " && " ${PYBUILD_PLATFORM} " != " macos" ]]; then
217+ if [[ -n " ${PYTHON_MEETS_MAXIMUM_VERSION_3_9} " && " ${PYBUILD_PLATFORM} " != macos* ]]; then
218218 # readline.c assumes that a modern readline API version has a free_history_entry().
219219 # but libedit does not. Change the #ifdef accordingly.
220220 #
@@ -317,13 +317,13 @@ CFLAGS=${CFLAGS//-fvisibility=hidden/}
317317
318318# But some symbols from some dependency libraries are still non-hidden for some
319319# reason. We force the linker to do our bidding.
320- if [ " ${PYBUILD_PLATFORM} " != " macos" ]; then
320+ if [[ " ${PYBUILD_PLATFORM} " != macos* ] ]; then
321321 LDFLAGS=" ${LDFLAGS} -Wl,--exclude-libs,ALL"
322322fi
323323
324324EXTRA_CONFIGURE_FLAGS=
325325
326- if [ " ${PYBUILD_PLATFORM} " = " macos" ]; then
326+ if [[ " ${PYBUILD_PLATFORM} " = macos* ] ]; then
327327 CFLAGS=" ${CFLAGS} -I${TOOLS_PATH} /deps/include/uuid"
328328
329329 # Prevent using symbols not supported by current macOS SDK target.
332332
333333# Always build against libedit instead of the default of readline.
334334# macOS always uses the system libedit, so no tweaks are needed.
335- if [ " ${PYBUILD_PLATFORM} " != " macos" ]; then
335+ if [[ " ${PYBUILD_PLATFORM} " != macos* ] ]; then
336336 # CPython 3.10 introduced proper configure support for libedit, so add configure
337337 # flag there.
338338 if [ -n " ${PYTHON_MEETS_MINIMUM_VERSION_3_10} " ]; then
@@ -381,7 +381,7 @@ CONFIGURE_FLAGS="
381381# this patch mildly conflicts with the macos-only patch-python-link-modules
382382# applied above, so you will need to resolve that conflict if you re-enable
383383# this for macos.
384- if [ " ${PYBUILD_PLATFORM} " != " macos" ]; then
384+ if [[ " ${PYBUILD_PLATFORM} " != macos* ] ]; then
385385 if [ -n " ${PYTHON_MEETS_MINIMUM_VERSION_3_12} " ]; then
386386 patch -p1 -i " ${ROOT} /patch-python-configure-add-enable-static-libpython-for-interpreter.patch"
387387 else
@@ -457,7 +457,7 @@ if [ -n "${CPYTHON_OPTIMIZED}" ]; then
457457
458458 # The JIT build is failing on macOS due to compiler errors
459459 # Only enable on Linux / 3.13 until that's fixed upstream
460- if [[ " ${PYBUILD_PLATFORM} " != " macos" ]]; then
460+ if [[ " ${PYBUILD_PLATFORM} " != macos* ]]; then
461461 CONFIGURE_FLAGS=" ${CONFIGURE_FLAGS} --enable-experimental-jit=yes-off"
462462 fi
463463
@@ -484,7 +484,7 @@ if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_11}" ]; then
484484 CONFIGURE_FLAGS=" ${CONFIGURE_FLAGS} --with-build-python=${TOOLS_PATH} /host/bin/python${PYTHON_MAJMIN_VERSION} "
485485fi
486486
487- if [ " ${PYBUILD_PLATFORM} " = " macos" ]; then
487+ if [[ " ${PYBUILD_PLATFORM} " = macos* ] ]; then
488488 # Configure may detect libintl from non-system sources, such
489489 # as Homebrew or MacPorts. So nerf the check to prevent this.
490490 CONFIGURE_FLAGS=" ${CONFIGURE_FLAGS} ac_cv_lib_intl_textdomain=no"
@@ -554,7 +554,7 @@ if [ "${PYBUILD_PLATFORM}" = "macos" ]; then
554554fi
555555
556556# ptsrname_r is only available in SDK 13.4+, but we target a lower version for compatibility.
557- if [ " ${PYBUILD_PLATFORM} " = " macos" ]; then
557+ if [[ " ${PYBUILD_PLATFORM} " = macos* ] ]; then
558558 CONFIGURE_FLAGS=" ${CONFIGURE_FLAGS} ac_cv_func_ptsname_r=no"
559559fi
560560
566566
567567# On 3.14+ `test_strftime_y2k` fails when cross-compiling for `x86_64_v2` and `x86_64_v3` targets on
568568# Linux, so we ignore it. See https://github.com/python/cpython/issues/128104
569- if [[ -n " ${PYTHON_MEETS_MINIMUM_VERSION_3_14} " && -n " ${CROSS_COMPILING} " && " ${PYBUILD_PLATFORM} " != " macos" ]]; then
569+ if [[ -n " ${PYTHON_MEETS_MINIMUM_VERSION_3_14} " && -n " ${CROSS_COMPILING} " && " ${PYBUILD_PLATFORM} " != macos* ]]; then
570570 export PROFILE_TASK=' -m test --pgo --ignore test_strftime_y2k'
571571fi
572572
573573# We use ndbm on macOS and BerkeleyDB elsewhere.
574- if [ " ${PYBUILD_PLATFORM} " = " macos" ]; then
574+ if [[ " ${PYBUILD_PLATFORM} " = macos* ] ]; then
575575 CONFIGURE_FLAGS=" ${CONFIGURE_FLAGS} --with-dbmliborder=ndbm"
576576else
577577 CONFIGURE_FLAGS=" ${CONFIGURE_FLAGS} --with-dbmliborder=bdb"
@@ -599,7 +599,7 @@ if [ -n "${CROSS_COMPILING}" ]; then
599599 # python will end up with the time.tzset function or not. All linux targets,
600600 # however, should have a working tzset function via libc. So we manually
601601 # indicate this to the configure script.
602- if [ " ${PYBUILD_PLATFORM} " != " macos" ]; then
602+ if [[ " ${PYBUILD_PLATFORM} " != macos* ] ]; then
603603 CONFIGURE_FLAGS=" ${CONFIGURE_FLAGS} ac_cv_working_tzset=yes"
604604 fi
605605
651651# This ensures we can run the binary in any location without
652652# LD_LIBRARY_PATH pointing to the directory containing libpython.
653653if [ " ${PYBUILD_SHARED} " = " 1" ]; then
654- if [ " ${PYBUILD_PLATFORM} " = " macos" ]; then
654+ if [[ " ${PYBUILD_PLATFORM} " = macos* ] ]; then
655655 # There's only 1 dylib produced on macOS and it has the binary suffix.
656656 LIBPYTHON_SHARED_LIBRARY_BASENAME=libpython${PYTHON_MAJMIN_VERSION}${PYTHON_BINARY_SUFFIX} .dylib
657657 LIBPYTHON_SHARED_LIBRARY=${ROOT} /out/python/install/lib/${LIBPYTHON_SHARED_LIBRARY_BASENAME}
@@ -1134,7 +1134,7 @@ cp -av ${TOOLS_PATH}/deps/lib/*.a ${ROOT}/out/python/build/lib/
11341134#
11351135# We copy the libclang_rt.<platform>.a library from our clang into the
11361136# distribution so it is available. See documentation in quirks.rst for more.
1137- if [ " ${PYBUILD_PLATFORM} " = " macos" ]; then
1137+ if [[ " ${PYBUILD_PLATFORM} " = macos* ] ]; then
11381138 cp -av $( dirname $( which clang) ) /../lib/clang/* /lib/darwin/libclang_rt.osx.a ${ROOT} /out/python/build/lib/
11391139fi
11401140
@@ -1149,7 +1149,7 @@ if [ -d "${TOOLS_PATH}/deps/lib/tcl8" ]; then
11491149 cp -av $source ${ROOT} /out/python/install/lib/
11501150 done
11511151
1152- if [ " ${PYBUILD_PLATFORM} " != " macos" ]; then
1152+ if [[ " ${PYBUILD_PLATFORM} " != macos* ] ]; then
11531153 cp -av ${TOOLS_PATH} /deps/lib/Tix8.4.3 ${ROOT} /out/python/install/lib/
11541154 fi
11551155fi
0 commit comments