# 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-03-31 23:39:05.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
@@ -7519,6 +7519,11 @@
                LIPO_INTEL64_FLAGS="-extract x86_64"
                ARCH_RUN_32BIT="true"
                ;;
+            powerpc)
+               UNIVERSAL_ARCH_FLAGS="-arch ppc -arch ppc64"
+               LIPO_32BIT_FLAGS="-extract ppc7400"
+               ARCH_RUN_32BIT="/usr/bin/arch -ppc"
+               ;;
             intel)
                UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
                LIPO_32BIT_FLAGS="-extract i386"
@@ -7540,7 +7545,7 @@
                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
+               as_fn_error $? "proper usage is --with-universal-arch=universal2|32-bit|64-bit|all|intel|powerpc|3-way" "$LINENO" 5
                ;;
             esac
 
@@ -7584,7 +7589,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'):
