[MacPorts] #64904: A fix for python3.x to build with +lto on PowerPC

MacPorts noreply at macports.org
Tue Mar 29 07:15:44 UTC 2022


#64904: A fix for python3.x to build with +lto on PowerPC
-------------------------------------------+-------------------------------
 Reporter:  barracuda156                   |      Owner:  (none)
     Type:  enhancement                    |     Status:  new
 Priority:  Normal                         |  Milestone:
Component:  ports                          |    Version:  2.7.2
 Keywords:  powerpc, leopard, snowleopard  |       Port:  python39,
                                           |  python310
-------------------------------------------+-------------------------------
 I have apparently fixed +lto for Pythons on PowerPC. Please try, who can
 check it.

 The following change in a portfile required:

 {{{
 variant lto description {enable Link-Time Optimization} {
     configure.args-append   --with-lto
     if {${os.major} < 11} {
     patchfiles-append   patch-enable_dynamic.diff
     compiler.blacklist  *gcc-4.0 *gcc-4.2
     }
 }
 }}}

 This is the patch for python310:

 {{{
 --- configure.orig      2022-03-24 04:12:04.000000000 +0800
 +++ configure   2022-03-29 15:03:21.000000000 +0800
 @@ -6755,7 +6755,7 @@
        case $ac_sys_system in
          Darwin*)
            # Any changes made here should be reflected in the GCC+Darwin
 case below
 -          LTOFLAGS="-flto -Wl,-export_dynamic"
 +          LTOFLAGS="-flto"
            LTOCFLAGS="-flto"
            ;;
          *)
 @@ -6766,7 +6766,7 @@
      *gcc*)
        case $ac_sys_system in
          Darwin*)
 -          LTOFLAGS="-flto -Wl,-export_dynamic"
 +          LTOFLAGS="-flto"
            LTOCFLAGS="-flto"
            ;;
          *)

 }}}

 And for python39:

 {{{
 --- configure.orig      2022-03-24 05:12:08.000000000 +0800
 +++ configure   2022-03-29 14:21:47.000000000 +0800
 @@ -6696,7 +6696,7 @@
        case $ac_sys_system in
          Darwin*)
            # Any changes made here should be reflected in the GCC+Darwin
 case below
 -          LTOFLAGS="-flto -Wl,-export_dynamic"
 +          LTOFLAGS="-flto"
            LTOCFLAGS="-flto"
            ;;
          *)
 @@ -6707,7 +6707,7 @@
      *gcc*)
        case $ac_sys_system in
          Darwin*)
 -          LTOFLAGS="-flto -Wl,-export_dynamic"
 +          LTOFLAGS="-flto"
            LTOCFLAGS="-flto"
            ;;
          *)

 }}}

 Then python upgrades with:

 {{{
 sudo port -v -n upgrade --enforce-variants python310 +lto
 }}}

 Procedure apparently worked for python39 and python310:

 {{{
 36-109% port -v installed python39
 The following ports are currently installed:
   python39 @3.9.6_0 requested_variants='' platform='darwin 10' archs='ppc'
 date='2021-10-04T15:33:04+0800'
   python39 @3.9.9_0 requested_variants='' platform='darwin 10' archs='ppc'
 date='2021-12-26T10:58:28+0800'
   python39 @3.9.10_0 requested_variants='' platform='darwin 10'
 archs='ppc' date='2022-02-10T23:05:27+0800'
   python39 @3.9.11_0 requested_variants='' platform='darwin 10'
 archs='ppc' date='2022-03-18T01:49:38+0800'
   python39 @3.9.12_0 requested_variants='' platform='darwin 10'
 archs='ppc' date='2022-03-25T16:21:26+0800'
   python39 @3.9.12_0+lto (active) requested_variants='+lto'
 platform='darwin 10' archs='ppc' date='2022-03-29T14:39:25+0800'
 36-109% port -v installed python310
 The following ports are currently installed:
   python310 @3.10.1_0 requested_variants='' platform='darwin 10'
 archs='ppc' date='2021-12-13T01:20:48+0800'
   python310 @3.10.2_0 requested_variants='' platform='darwin 10'
 archs='ppc' date='2022-02-10T23:55:57+0800'
   python310 @3.10.3_0 requested_variants='' platform='darwin 10'
 archs='ppc' date='2022-03-18T01:56:20+0800'
   python310 @3.10.4_0 requested_variants='' platform='darwin 10'
 archs='ppc' date='2022-03-25T16:31:53+0800'
   python310 @3.10.4_0+lto (active) requested_variants='+lto'
 platform='darwin 10' archs='ppc' date='2022-03-29T15:13:15+0800'
 }}}

-- 
Ticket URL: <https://trac.macports.org/ticket/64904>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list