Ticket #15033: openssl-universal_archs.diff
File openssl-universal_archs.diff, 5.3 KB (added by jmroot (Joshua Root), 16 years ago) |
---|
-
Portfile
50 50 livecheck.url ${master_sites} 51 51 livecheck.regex ${name}-(0.9.8\[a-z\]) 52 52 53 #make 4-way universal build ready 53 if { ![info exists universal_archs] } { 54 set universal_archs {i386 ppc} 55 #set universal_archs {i386 x86_64 ppc ppc64} 56 } 57 set first_arch [lindex ${universal_archs} 0] 58 54 59 variant universal { 55 60 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 } 59 67 } 60 68 } 61 69 62 70 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}" 65 82 } 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}"68 83 } 69 84 70 85 build { 71 # foreach arch {i386 x86_64 ppc ppc64} 72 foreach arch {i386 ppc} { 86 foreach arch ${universal_archs} { 73 87 system "cd ${workpath}/${arch} && make all" 74 88 } 75 89 } … … 78 92 # in port 1.7, just call: 79 93 # merge "${workpath}/pre-dest" 80 94 # till then, do this: 81 # foreach arch {i386 x86_64 ppc ppc64} 82 foreach arch {i386 ppc} { 95 foreach arch ${universal_archs} { 83 96 xinstall -d ${workpath}/pre-dest/${arch} 84 97 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}" 85 110 } 86 111 87 112 set basepath "${workpath}/pre-dest/i386" … … 109 134 Mach-O.* { 110 135 # Mach-O binaries get lipo-ed 111 136 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} 114 143 } 115 144 current\ ar\ archive { 116 145 # ar archives get lipo-ed 117 146 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} 120 153 } 121 154 default { 122 155 # unknown file types are copied IF they do not differ across ALL architectures -- if they do: This is an error! 123 156 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" 129 169 } else { 130 170 ui_debug "files match, just copying" 131 171 file copy "${basepath}${fpath}" "${destroot}${fpath}"