| 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 | |
| 105 | pre-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 | } |