# Patch allowing building universal Python (ppc+ppc64). Supported only for 10.5.x

--- configure.orig	2022-03-24 05:12:08.000000000 +0800
+++ configure	2022-04-01 02:16:31.000000000 +0800
@@ -1523,7 +1523,7 @@
                           specify the kind of macOS universal binary that
                           should be created. This option is only valid when
                           --enable-universalsdk is set; options are:
-                          ("universal2", "intel-64", "intel-32", "intel",
+                          ("universal2", "intel-64", "intel-32", "intel", "powerpc",
                           "32-bit", "64-bit", "3-way", or "all") see
                           Mac/README.rst
   --with-framework-name=FRAMEWORK
@@ -7497,52 +7497,9 @@
         LIPO_INTEL64_FLAGS=""
         if test "${enable_universalsdk}"
         then
-            case "$UNIVERSAL_ARCHS" in
-            32-bit)
-               UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
-               LIPO_32BIT_FLAGS=""
-               ARCH_RUN_32BIT=""
-               ;;
-            64-bit)
-               UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
-               LIPO_32BIT_FLAGS=""
-               ARCH_RUN_32BIT="true"
-               ;;
-            all)
-               UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
-               LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
-               ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
-               ;;
-            universal2)
-               UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
-               LIPO_32BIT_FLAGS=""
-               LIPO_INTEL64_FLAGS="-extract x86_64"
-               ARCH_RUN_32BIT="true"
-               ;;
-            intel)
-               UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
-               LIPO_32BIT_FLAGS="-extract i386"
-               ARCH_RUN_32BIT="/usr/bin/arch -i386"
-               ;;
-            intel-32)
-               UNIVERSAL_ARCH_FLAGS="-arch i386"
-               LIPO_32BIT_FLAGS=""
-               ARCH_RUN_32BIT=""
-               ;;
-            intel-64)
-               UNIVERSAL_ARCH_FLAGS="-arch x86_64"
-               LIPO_32BIT_FLAGS=""
-               ARCH_RUN_32BIT="true"
-               ;;
-            3-way)
-               UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
-               LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
-               ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
-               ;;
-            *)
-               as_fn_error $? "proper usage is --with-universal-arch=universal2|32-bit|64-bit|all|intel|3-way" "$LINENO" 5
-               ;;
-            esac
+            UNIVERSAL_ARCH_FLAGS="__UNIVERSAL_ARCHFLAGS__"
+            ARCH_RUN_32BIT=""
+            LIPO_32BIT_FLAGS=""
 
             if test "${UNIVERSALSDK}" != "/"
             then
@@ -7584,7 +7541,7 @@
             if test ${enable_universalsdk}
             then
                 case "$UNIVERSAL_ARCHS" in
-                all|3-way|intel|64-bit)
+                all|3-way|intel|powerpc|64-bit)
                     # These configurations were first supported in 10.5
                     cur_target='10.5'
                     ;;

--- Mac/BuildScript/build-installer.py.orig	2022-03-24 05:12:08.000000000 +0800
+++ Mac/BuildScript/build-installer.py	2022-03-31 23:27:57.000000000 +0800
@@ -123,11 +123,12 @@
 universal_opts_map = { 'universal2': ('arm64', 'x86_64'),
                        '32-bit': ('i386', 'ppc',),
                        '64-bit': ('x86_64', 'ppc64',),
-                       'intel':  ('i386', 'x86_64'),
-                       'intel-32':  ('i386',),
-                       'intel-64':  ('x86_64',),
-                       '3-way':  ('ppc', 'i386', 'x86_64'),
-                       'all':    ('i386', 'ppc', 'x86_64', 'ppc64',) }
+                       'intel': ('i386', 'x86_64'),
+                       'intel-32': ('i386',),
+                       'intel-64': ('x86_64',),
+                       'powerpc': ('ppc', 'ppc64'),
+                       '3-way': ('ppc', 'i386', 'x86_64'),
+                       'all': ('i386', 'ppc', 'x86_64', 'ppc64',) }
 default_target_map = {
         'universal2': '10.9',
         '64-bit': '10.5',
@@ -135,6 +136,7 @@
         'intel': '10.5',
         'intel-32': '10.4',
         'intel-64': '10.5',
+        'powerpc': '10.5',
         'all': '10.5',
 }
 
--- Lib/_osx_support.py.orig	2022-03-24 05:12:08.000000000 +0800
+++ Lib/_osx_support.py	2022-03-31 23:32:30.000000000 +0800
@@ -547,6 +547,8 @@
                 machine = 'fat'
             elif archs == ('i386', 'x86_64'):
                 machine = 'intel'
+            elif archs == ('ppc', 'ppc64'):
+                machine = 'powerpc'
             elif archs == ('i386', 'ppc', 'x86_64'):
                 machine = 'fat3'
             elif archs == ('ppc64', 'x86_64'):
