New Ticket     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #15033: openssl-universal_archs.diff

File openssl-universal_archs.diff, 5.3 KB (added by jmr@…, 4 years ago)
  • Portfile

     
    5050livecheck.url   ${master_sites} 
    5151livecheck.regex ${name}-(0.9.8\[a-z\]) 
    5252 
    53 #make 4-way universal build ready 
     53if { ![info exists universal_archs] } { 
     54        set universal_archs {i386 ppc} 
     55        #set universal_archs {i386 x86_64 ppc ppc64} 
     56} 
     57set first_arch [lindex ${universal_archs} 0] 
     58 
    5459variant universal { 
    5560        post-patch { 
    56 #               foreach arch {i386 x86_64 ppc ppc64} 
    57                 foreach arch {i386 ppc} { 
    58                         file copy ${worksrcpath} ${workpath}/${arch} 
     61                foreach arch ${universal_archs} { 
     62                        if {[string equal ${arch} ${first_arch}]} { 
     63                                move ${worksrcpath} ${workpath}/${first_arch} 
     64                        } else { 
     65                                copy ${workpath}/${first_arch} ${workpath}/${arch} 
     66                        } 
    5967                } 
    6068        } 
    6169 
    6270        configure { 
    63                 foreach arch {i386 ppc} { 
    64                         system "cd ${workpath}/${arch} && ./Configure darwin-${arch}-cc ${configure.pre_args} ${configure.args}" 
     71                foreach arch ${universal_archs} { 
     72                        if { [string first 64 $arch] == -1 } { 
     73                                set my_cc "darwin-${arch}-cc" 
     74                        } else { 
     75                                if {[string first ppc $arch] != -1} { 
     76                                        set my_cc "darwin64-ppc-cc" 
     77                                } else { 
     78                                        set my_cc "darwin64-${arch}-cc" 
     79                                } 
     80                        } 
     81                        system "cd ${workpath}/${arch} && ./Configure ${my_cc} ${configure.pre_args} ${configure.args}" 
    6582                } 
    66 #               system "cd ${workpath}/x86_64 && ./Configure darwin64-x86_64-cc ${configure.pre_args} ${configure.args}" 
    67 #               system "cd ${workpath}/ppc64 && ./Configure darwin64-ppc-cc ${configure.pre_args} ${configure.args}" 
    6883        } 
    6984 
    7085        build { 
    71 #               foreach arch {i386 x86_64 ppc ppc64} 
    72                 foreach arch {i386 ppc} { 
     86                foreach arch ${universal_archs} { 
    7387                        system "cd ${workpath}/${arch} && make all" 
    7488                } 
    7589        } 
     
    7892# in port 1.7, just call: 
    7993#               merge "${workpath}/pre-dest" 
    8094# till then, do this: 
    81 #               foreach arch {i386 x86_64 ppc ppc64} 
    82                 foreach arch {i386 ppc} { 
     95                foreach arch ${universal_archs} { 
    8396                        xinstall -d ${workpath}/pre-dest/${arch} 
    8497                        system "cd ${workpath}/${arch} && make install INSTALL_PREFIX=${workpath}/pre-dest/${arch} MANDIR=${prefix}/share/man" 
     98                         
     99                        # opensslconf.h will differ between 32- and 64-bit, so patch it so it doesn't 
     100                        if { [string first 64 $arch] != -1 } { 
     101                                if { [string first ppc $arch] != -1 } { 
     102                                        set configpatch ${filespath}/patch-opensslconf.h-ppc64.diff 
     103                                } else { 
     104                                        set configpatch ${filespath}/patch-opensslconf.h-x86_64.diff 
     105                                } 
     106                        } else { 
     107                                set configpatch ${filespath}/patch-opensslconf.h-32.diff 
     108                        } 
     109                        system "cd ${workpath}/pre-dest/${arch}${prefix} && patch --no-backup-if-mismatch -p0 < ${configpatch}" 
    85110                } 
    86111 
    87112                set basepath "${workpath}/pre-dest/i386" 
     
    109134                                                        Mach-O.* { 
    110135                                                                # Mach-O binaries get lipo-ed 
    111136                                                                ui_debug "Mach-O file -- lipo-ing" 
    112 #                                                               system "lipo -arch i386 ${workpath}/pre-dest/i386/${fpath} -arch x86_64 ${workpath}/pre-dest/x86_64/${fpath} -arch ppc ${workpath}/pre-dest/ppc/${fpath} -arch ppc64 ${workpath}/pre-dest/ppc64/${fpath} -create -output ${destroot}${fpath}" 
    113                                                                 system "lipo -arch i386 ${workpath}/pre-dest/i386/${fpath} -arch ppc ${workpath}/pre-dest/ppc/${fpath} -create -output ${destroot}${fpath}" 
     137                                                                set machocmd "lipo" 
     138                                                                foreach arch ${universal_archs} { 
     139                                                                        set machocmd "${machocmd} -arch $arch ${workpath}/pre-dest/${arch}/${fpath}" 
     140                                                                } 
     141                                                                set machocmd "${machocmd} -create -output ${destroot}${fpath}" 
     142                                                                system ${machocmd} 
    114143                                                        } 
    115144                                                        current\ ar\ archive { 
    116145                                                                # ar archives get lipo-ed 
    117146                                                                ui_debug "ar archive -- lipo-ing" 
    118 #                                                               system "lipo -arch i386 ${workpath}/pre-dest/i386/${fpath} -arch x86_64 ${workpath}/pre-dest/x86_64/${fpath} -arch ppc ${workpath}/pre-dest/ppc/${fpath} -arch ppc64 ${workpath}/pre-dest/ppc64/${fpath} -create -output ${destroot}${fpath}" 
    119                                                                 system "lipo -arch i386 ${workpath}/pre-dest/i386/${fpath} -arch ppc ${workpath}/pre-dest/ppc/${fpath} -create -output ${destroot}${fpath}" 
     147                                                                set arcmd "lipo" 
     148                                                                foreach arch ${universal_archs} { 
     149                                                                        set arcmd "${arcmd} -arch $arch ${workpath}/pre-dest/${arch}/${fpath}" 
     150                                                                } 
     151                                                                set arcmd "${arcmd} -create -output ${destroot}${fpath}" 
     152                                                                system ${arcmd} 
    120153                                                        } 
    121154                                                        default { 
    122155                                                                # unknown file types are copied IF they do not differ across ALL architectures -- if they do: This is an error! 
    123156                                                                ui_debug "unknown filetype: ${filetype}" 
    124                                                                 set differ1 [exec "/usr/bin/diff" "-q" "${workpath}/pre-dest/i386/${fpath}" "${workpath}/pre-dest/ppc/${fpath}"] 
    125 #                                                               set differ2 [exec "/usr/bin/diff" "-q" "${workpath}/pre-dest/i386/${fpath}" "${workpath}/pre-dest/x86_64/${fpath}"] 
    126 #                                                               set differ3 [exec "/usr/bin/diff" "-q" "${workpath}/pre-dest/i386/${fpath}" "${workpath}/pre-dest/ppc64/${fpath}"] 
    127                                                                 if {${differ1} != ""} { 
    128                                                                         ui_debug "ERROR" 
     157                                                                 
     158                                                                set any_difference no 
     159                                                                foreach arch ${universal_archs} { 
     160                                                                        if {![string equal ${arch} ${first_arch}]} { 
     161                                                                                set differ1 [exec "/usr/bin/diff" "-q" "${workpath}/pre-dest/${first_arch}/${fpath}" "${workpath}/pre-dest/${arch}/${fpath}"] 
     162                                                                                if {![string equal ${differ1} ""]} { 
     163                                                                                        set any_difference yes 
     164                                                                                } 
     165                                                                        } 
     166                                                                } 
     167                                                                if {${any_difference}} { 
     168                                                                        ui_debug "ERROR: files differ" 
    129169                                                                } else { 
    130170                                                                        ui_debug "files match, just copying" 
    131171                                                                        file copy "${basepath}${fpath}" "${destroot}${fpath}"