Ticket #21590: Portfile.patch

File Portfile.patch, 2.8 KB (added by Veence (Vincent), 15 years ago)

Patch for Portfile (should replace old version)

  • Portfile

    old new  
    2828                    sha1    0364027c34eb69ce8c51d316c68f10a02a42d036 \
    2929                    rmd160  5b390d09a5b1a5e5fbf29d245aee8543397a1f19
    3030
     31patchfile                       patch-sipconfig_py
    3132set pyversion 2.6
    3233depends_lib-append port:python[strsed ${pyversion} {g/[.]//}]
    3334set pybin ${prefix}/bin/python${pyversion}
     
    4445}
    4546
    4647configure.cmd ${pybin} configure.py
     48configure.universal_args
    4749
    4850pre-configure {
    4951    # Ensure correct compilers are used
     
    5153        ${worksrcpath}/specs/macx-g++
    5254    reinplace "s| c++\$| ${configure.cxx}|" \
    5355        ${worksrcpath}/specs/macx-g++
     56   
     57    # By default, SIP uses i386 and ppc. Override.
     58    set arch_x86  ""
     59    set arch_ppc    ""
     60   
     61    if {[variant_isset universal]} {
     62      # Manually enter flags
     63      foreach arch ${universal_archs} {
     64        if {[string match "*86*" ${arch}] == 1} {
     65          # x86
     66          append arch_x86 "-arch ${arch} "
     67        } else {
     68          append arch_ppc "-arch ${arch} "
     69        }
     70      }
     71    } else {
     72      # Guess arch
     73      set arch [exec arch]
     74      if {[string match "*86*" ${arch}] == 1} {
     75        set arch_x86 "-arch ${arch} "
     76      } else {
     77        set arch_ppc "-arch ${arch} "
     78      }
     79    }
     80
     81    # Reinplace in siputils.py
     82   
     83    reinplace "s|-arch ppc -arch i386|${arch_x86}${arch_ppc}|" \
     84        ${worksrcpath}/siputils.py
     85   
     86    # Set default values
     87
     88    if {${arch_x86} == ""} {set arch_intel "-arch i386"}
     89    if {${arch_ppc} == ""} {set arch_ppc "-arch ppc"}
     90   
     91    # Reinplace in specs/macx-g++
     92    reinplace "s|^QMAKE_CFLAGS_PPC.*|QMAKE_CFLAGS_PPC        = ${arch_ppc}|" \
     93        ${worksrcpath}/specs/macx-g++
     94       
     95    reinplace "s|^QMAKE_LFLAGS_PPC.*|QMAKE_LFLAGS_PPC        = ${arch_ppc}|" \
     96        ${worksrcpath}/specs/macx-g++
     97   
     98    reinplace "s|^QMAKE_CFLAGS_X86.*|QMAKE_CFLAGS_X86        = ${arch_x86}|" \
     99        ${worksrcpath}/specs/macx-g++
     100       
     101    reinplace "s|^QMAKE_LFLAGS_X86.*|QMAKE_LFLAGS_X86        = ${arch_x86}|" \
     102        ${worksrcpath}/specs/macx-g++
     103}
     104
     105pre-build {
     106  if {[variant_isset universal]} {
     107    # Apparently we need to enforce universal flags
     108    set uarchs [portconfigure::configure_get_universal_archflags]
     109   
     110    reinplace -E "s|^(CFLAGS.*)|\\1 ${uarchs}|" ${worksrcpath}/sipgen/Makefile
     111    reinplace -E "s|^(CXXFLAGS.*)|\\1 ${uarchs}|" ${worksrcpath}/sipgen/Makefile
     112    reinplace -E "s|^(LFLAGS.*)|\\1 ${uarchs}|" ${worksrcpath}/sipgen/Makefile
     113
     114    reinplace -E "s|^(CFLAGS.*)|\\1 ${uarchs}|" ${worksrcpath}/siplib/Makefile
     115    reinplace -E "s|^(CXXFLAGS.*)|\\1 ${uarchs}|" ${worksrcpath}/siplib/Makefile
     116    reinplace -E "s|^(LFLAGS.*)|\\1 ${uarchs}|" ${worksrcpath}/siplib/Makefile
     117  }
    54118}
    55119
    56120# By default, everything gets installed in the Python Frameworks directory