# $Id: Portfile 45258 2009-01-12 09:13:25Z blb@macports.org $ PortSystem 1.0 name openssl version 0.9.8j platforms darwin freebsd categories devel security maintainers mww homepage http://www.openssl.org/ description OpenSSL SSL/TLS cryptography library long_description \ The OpenSSL Project is a collaborative effort to develop a robust, \ commercial-grade, full-featured, and Open Source toolkit implementing \ the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security \ (TLS v1) protocols as well as a full-strength general purpose \ cryptography library. master_sites http://www.openssl.org/source/ checksums md5 a5cb5f6c3d11affb387ecf7a997cac0c \ sha1 f70f7127a26e951e8a0d854c0c9e6b4c24df78e4 \ rmd160 d60417e0fd943fbffc6dae8391a21dcf5d97e967 depends_lib port:zlib platform darwin { patchfiles patch-Makefile.org.diff patch-crypto-Makefile.diff } configure.cmd ./config configure.args -L${prefix}/lib --openssldir=${prefix}/etc/openssl zlib no-asm no-krb5 shared platform darwin 6 { depends_lib-append port:dlcompat } variant rfc3779 description {enable RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers} { configure.args-append enable-rfc3779 } use_parallel_build no destroot.destdir INSTALL_PREFIX=${destroot} destroot.args MANDIR=${prefix}/share/man test.run yes livecheck.check regex livecheck.url ${master_sites} livecheck.regex ${name}-(0.9.8\[a-z\]) if { ![info exists universal_archs] } { set universal_archs {i386 ppc} #set universal_archs {i386 x86_64 ppc ppc64} } set first_arch [lindex ${universal_archs} 0] variant universal { patchfiles-append patch-Configure-sysroot.diff post-patch { reinplace "s|__UNIVERSAL_SYSROOT__|${universal_sysroot}|" ${worksrcpath}/Configure foreach arch ${universal_archs} { if {[string equal ${arch} ${first_arch}]} { move ${worksrcpath} ${workpath}/${first_arch} } else { copy ${workpath}/${first_arch} ${workpath}/${arch} } } } configure { foreach arch ${universal_archs} { if { [string first 64 $arch] == -1 } { set my_cc "darwin-${arch}-cc" } else { if {[string first ppc $arch] != -1} { set my_cc "darwin64-ppc-cc" } else { set my_cc "darwin64-${arch}-cc" } } system "cd ${workpath}/${arch} && ./Configure ${my_cc} ${configure.pre_args} ${configure.args}" } } build { foreach arch ${universal_archs} { system "cd ${workpath}/${arch} && make all" } } destroot { # in port 1.7, just call: # merge "${workpath}/pre-dest" # till then, do this: foreach arch ${universal_archs} { xinstall -d ${workpath}/pre-dest/${arch} system "cd ${workpath}/${arch} && make install INSTALL_PREFIX=${workpath}/pre-dest/${arch} MANDIR=${prefix}/share/man" # opensslconf.h will differ between 32- and 64-bit, so patch it so it doesn't if { [string first 64 $arch] != -1 } { if { [string first ppc $arch] != -1 } { set configpatch ${filespath}/patch-opensslconf.h-ppc64.diff } else { set configpatch ${filespath}/patch-opensslconf.h-x86_64.diff } } else { set configpatch ${filespath}/patch-opensslconf.h-32.diff } system "cd ${workpath}/pre-dest/${arch}${prefix} && patch --no-backup-if-mismatch -p0 < ${configpatch}" } set basepath "${workpath}/pre-dest/i386" fs-traverse file "${basepath}" { set fpath [string range "${file}" [string length "${basepath}"] [string length "${file}"]] if {${fpath} != ""} { ui_debug ":: ${fpath}" switch -exact [file type "${basepath}${fpath}"] { directory { # just create directories ui_debug "-- dir:: ${fpath}" file mkdir "${destroot}${fpath}" } link { # copy symlinks (TODO: check if target matches) ui_debug "-- lnk:: ${fpath}" file copy "${basepath}${fpath}" "${destroot}${fpath}" } file { # treat files depending on their filetype ui_debug "-- file:: ${fpath}" set filetype [exec "/usr/bin/file" "-b" "${basepath}${fpath}"] switch -regexp ${filetype} { Mach-O.* { # Mach-O binaries get lipo-ed ui_debug "Mach-O file -- lipo-ing" set machocmd "lipo" foreach arch ${universal_archs} { set machocmd "${machocmd} -arch $arch ${workpath}/pre-dest/${arch}/${fpath}" } set machocmd "${machocmd} -create -output ${destroot}${fpath}" system ${machocmd} } current\ ar\ archive { # ar archives get lipo-ed ui_debug "ar archive -- lipo-ing" set arcmd "lipo" foreach arch ${universal_archs} { set arcmd "${arcmd} -arch $arch ${workpath}/pre-dest/${arch}/${fpath}" } set arcmd "${arcmd} -create -output ${destroot}${fpath}" system ${arcmd} } default { # unknown file types are copied IF they do not differ across ALL architectures -- if they do: This is an error! ui_debug "unknown filetype: ${filetype}" set any_difference no foreach arch ${universal_archs} { if {![string equal ${arch} ${first_arch}]} { set differ1 [exec "/usr/bin/diff" "-q" "${workpath}/pre-dest/${first_arch}/${fpath}" "${workpath}/pre-dest/${arch}/${fpath}"] if {![string equal ${differ1} ""]} { set any_difference yes } } } if {${any_difference}} { ui_debug "ERROR: files differ" } else { ui_debug "files match, just copying" file copy "${basepath}${fpath}" "${destroot}${fpath}" } } } } default { ui_debug "serious error" } } } } } } # the test suite can only be run *after* destrooting # test.run yes # test.dir ${worksrcpath}/test # test.target alltests