Ticket #15570: Portfile.diff

File Portfile.diff, 5.5 KB (added by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), 15 years ago)
  • Portfile

    old new  
    11# $Id: Portfile 48332 2009-03-19 15:39:02Z jmr@macports.org $
    22
    33PortSystem 1.0
     4PortGroup  muniversal 1.0
    45
    56name                    openssl
    67version                 0.9.8j
     
    5051livecheck.url   ${master_sites}
    5152livecheck.regex ${name}-(0.9.8\[a-z\])
    5253
    53 if { ![info exists universal_archs] } {
    54         set universal_archs {i386 ppc}
    55         #set universal_archs {i386 x86_64 ppc ppc64}
     54post-patch {
     55        # Ensure that the correct compiler is used
     56        reinplace "s|cc:|${configure.cc}:|" ${worksrcpath}/Configure
    5657}
    57 set first_arch [lindex ${universal_archs} 0]
    5858
    59 variant universal {
    60     patchfiles-append patch-Configure-sysroot.diff
     59if { [variant_isset universal] } {
     60        configure.cmd   ./Configure
     61
    6162        post-patch {
    62             reinplace "s|__UNIVERSAL_SYSROOT__|${universal_sysroot}|" ${worksrcpath}/Configure
    63                 foreach arch ${universal_archs} {
    64                         if {[string equal ${arch} ${first_arch}]} {
    65                                 move ${worksrcpath} ${workpath}/${first_arch}
    66                         } else {
    67                                 copy ${workpath}/${first_arch} ${workpath}/${arch}
    68                         }
    69                 }
     63                # For universal builds, add "-isysroot ${universal_sysroot}" to compiler options
     64                reinplace "s|\\(-arch \[_a-zA-Z0-9\]*\\)|\\1 -isysroot ${universal_sysroot}|" ${worksrcpath}/Configure
    7065        }
    7166
    72         configure {
    73                 foreach arch ${universal_archs} {
    74                         if { [string first 64 $arch] == -1 } {
    75                                 set my_cc "darwin-${arch}-cc"
    76                         } else {
    77                                 if {[string first ppc $arch] != -1} {
    78                                         set my_cc "darwin64-ppc-cc"
    79                                 } else {
    80                                         set my_cc "darwin64-${arch}-cc"
    81                                 }
    82                         }
    83                         system "cd ${workpath}/${arch} && ./Configure ${my_cc} ${configure.pre_args} ${configure.args}"
    84                 }
     67        pre-configure {
     68                configure.args-delete  --disable-dependency-tracking
    8569        }
    8670
    87         build {
    88                 foreach arch ${universal_archs} {
    89                         system "cd ${workpath}/${arch} && make all"
     71        pre-destroot {
     72                global merger_dont_diff
     73                if { [llength ${universal_archs_to_use}] > 2 } {
     74                        lappend merger_dont_diff ${prefix}/include/openssl/opensslconf.h
    9075                }
    9176        }
    9277
    93         destroot {
    94 # in port 1.7, just call:
    95 #               merge "${workpath}/pre-dest"
    96 # till then, do this:
    97                 foreach arch ${universal_archs} {
    98                         xinstall -d ${workpath}/pre-dest/${arch}
    99                         system "cd ${workpath}/${arch} && make install INSTALL_PREFIX=${workpath}/pre-dest/${arch} MANDIR=${prefix}/share/man"
    100                        
    101                         # opensslconf.h will differ between 32- and 64-bit, so patch it so it doesn't
    102                         if { [string first 64 $arch] != -1 } {
    103                                 if { [string first ppc $arch] != -1 } {
    104                                         set configpatch ${filespath}/patch-opensslconf.h-ppc64.diff
    105                                 } else {
    106                                         set configpatch ${filespath}/patch-opensslconf.h-x86_64.diff
    107                                 }
    108                         } else {
    109                                 set configpatch ${filespath}/patch-opensslconf.h-32.diff
    110                         }
    111                         system "cd ${workpath}/pre-dest/${arch}${prefix} && patch --no-backup-if-mismatch -p0 < ${configpatch}"
    112                 }
     78        array set merger_configure_args {
     79                ppc     darwin-ppc-cc
     80                i386    darwin-i386-cc
     81                ppc64   darwin64-ppc-cc
     82                x86_64  darwin64-x86_64-cc
     83        }
    11384
    114                 set basepath "${workpath}/pre-dest/${first_arch}"
    115                 fs-traverse file "${basepath}" {
    116                         set fpath [string range "${file}" [string length "${basepath}"] [string length "${file}"]]
    117                         if {${fpath} != ""} {
    118                                 ui_debug ":: ${fpath}"
    119 
    120                                 switch -exact [file type "${basepath}${fpath}"] {
    121                                         directory {
    122                                                 # just create directories
    123                                                 ui_debug "-- dir:: ${fpath}"
    124                                                 file mkdir "${destroot}${fpath}"
    125                                         }
    126                                         link {
    127                                                 # copy symlinks (TODO: check if target matches)
    128                                                 ui_debug "-- lnk:: ${fpath}"
    129                                                 file copy "${basepath}${fpath}" "${destroot}${fpath}"
    130                                         }
    131                                         file {
    132                                                 # treat files depending on their filetype
    133                                                 ui_debug "-- file:: ${fpath}"
    134                                                 set filetype [exec "/usr/bin/file" "-b" "${basepath}${fpath}"]
    135                                                 switch -regexp ${filetype} {
    136                                                         Mach-O.* {
    137                                                                 # Mach-O binaries get lipo-ed
    138                                                                 ui_debug "Mach-O file -- lipo-ing"
    139                                                                 set machocmd "lipo"
    140                                                                 foreach arch ${universal_archs} {
    141                                                                         set machocmd "${machocmd} -arch $arch ${workpath}/pre-dest/${arch}/${fpath}"
    142                                                                 }
    143                                                                 set machocmd "${machocmd} -create -output ${destroot}${fpath}"
    144                                                                 system ${machocmd}
    145                                                         }
    146                                                         current\ ar\ archive {
    147                                                                 # ar archives get lipo-ed
    148                                                                 ui_debug "ar archive -- lipo-ing"
    149                                                                 set arcmd "lipo"
    150                                                                 foreach arch ${universal_archs} {
    151                                                                         set arcmd "${arcmd} -arch $arch ${workpath}/pre-dest/${arch}/${fpath}"
    152                                                                 }
    153                                                                 set arcmd "${arcmd} -create -output ${destroot}${fpath}"
    154                                                                 system ${arcmd}
    155                                                         }
    156                                                         default {
    157                                                                 # unknown file types are copied IF they do not differ across ALL architectures -- if they do: This is an error!
    158                                                                 ui_debug "unknown filetype: ${filetype}"
    159                                                                
    160                                                                 set any_difference no
    161                                                                 foreach arch ${universal_archs} {
    162                                                                         if {![string equal ${arch} ${first_arch}]} {
    163                                                                                 set differ1 [exec "/usr/bin/diff" "-q" "${workpath}/pre-dest/${first_arch}/${fpath}" "${workpath}/pre-dest/${arch}/${fpath}"]
    164                                                                                 if {![string equal ${differ1} ""]} {
    165                                                                                         set any_difference yes
    166                                                                                 }
    167                                                                         }
    168                                                                 }
    169                                                                 if {${any_difference}} {
    170                                                                         ui_debug "ERROR: files differ"
    171                                                                 } else {
    172                                                                         ui_debug "files match, just copying"
    173                                                                         file copy "${basepath}${fpath}" "${destroot}${fpath}"
    174                                                                 }
    175                                                         }
    176                                                 }
    177                                         }
    178                                         default { ui_debug "serious error" }
    179                                 }
    180                         }
    181                 }
     85        # Do not set --host.
     86        array set merger_host {
     87                ppc     ""
     88                i386    ""
     89                ppc64   ""
     90                x86_64  ""
    18291        }
    18392}
    18493