# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 PortSystem 1.0 name oracle-instantclient categories databases platforms macosx maintainers {ryandesign @ryandesign} license Restrictive Nomirror homepage https://www.oracle.com/database/technologies/instant-client.html use_zip yes configure.cxx_stdlib libstdc++ description \ Oracle database connection libraries long_description \ Oracle Instant Client allows you to run your applications without installing the standard Oracle client or having an ORACLE_HOME. if {${os.arch} eq "powerpc"} { epoch 1 version 10.1.0.3 revision 2 set library_version 10.1 supported_archs ppc universal_variant no master_sites http://cmsrep.cern.ch/cmssw/cms/SOURCES/external/oracle/10.2.0.2/ checksums instantclient-basic-macosx-${version}${extract.suffix} \ rmd160 d1f056f8f1b308c5493f4938b29b55fcb32452cf \ sha256 55dafdab1b7387b05226fd7eb0d86d52225a702a5e690fc82af42073f49e7725 \ instantclient-sdk-macosx-${version}${extract.suffix} \ rmd160 c819db7f739b8ca468c8059dfbac31a6a6965938 \ sha256 350052656466cc2daecbb8b1c162ff444365def151636ba704f28ae5f05ca411 set my_worksrcdir_format instantclient%s set my_distname_format(ppc) instantclient-%s-macosx-${version} set my_library_prefix(ppc) /b/729 livecheck.type none } else { version 11.2.0.4.0 revision 1 set library_version 11.1 supported_archs x86_64 i386 variant universal {} #master_sites http://astro-wise.org/instantclient/ master_sites http://download.oracle.com/otn/mac/instantclient/[join [lrange [split ${version} .] 0 3] ""]/ checksums instantclient-basic-macos.x32-${version}${extract.suffix} \ rmd160 a34edfd79dc3a34026b755bba64499ca74f72f56 \ sha256 c1d59a284d7ed8a65fc38c1df08b4ab632aebeb27420f7892e38e0725f1325b4 \ instantclient-sdk-macos.x32-${version}${extract.suffix} \ rmd160 350790b2c08c84e03a645bef6dcc72864d5c4bfc \ sha256 4d4af789e471ea393ec019c16a3731abea9d384cdde8fce562f34406e79c6d13 \ instantclient-basic-macos.x64-${version}${extract.suffix} \ rmd160 a1ab486f91a1a648cafaa6ff77b4e7f0a4dcdb62 \ sha256 6c079713ab0a65193f7bfcbad6c90e7806fa6634a3828052f8428e1533bb89d3 \ instantclient-sdk-macos.x64-${version}${extract.suffix} \ rmd160 dd54cc83c54bd9d702c0de6cd2219370ca98d2e2 \ sha256 aead0663c206a811cf1f61d3b2a533ff81e6e6109dd31544ad850a7ef6eb5d19 set my_worksrcdir_format instantclient_%s set my_distname_format(i386) instantclient-%s-macos.x32-${version} set my_distname_format(x86_64) instantclient-%s-macos.x64-${version} set my_library_prefix(i386) /ade set my_library_prefix(x86_64) /ade if {${os.platform} eq "darwin" && ${os.major} < 9} { known_fail yes pre-fetch { ui_error "${name} on Intel requires Mac OS X 10.5 or greater." return -code error "incompatible Mac OS X version" } } livecheck.type regex livecheck.url http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html livecheck.regex instantclient-basic-macos.x64-(\[0-9.\]+)${extract.suffix} } platform darwin 9 { depends_build-append port:cctools } # merge() requires universal_archs to be set correctly. Since we use merge() # even when not building universal we must always set universal_archs correctly. if {![variant_exists universal] || ![variant_isset universal]} { configure.universal_archs ${configure.build_arch} } distfiles foreach my_arch ${configure.universal_archs} { if {[info exists my_distname_format(${my_arch})]} { foreach my_distfile_type {basic sdk} { distfiles-append [format $my_distname_format(${my_arch}) ${my_distfile_type}]${extract.suffix} } } } post-fetch { set bad_distfiles {} foreach distfile ${distfiles} { set distfile [strsed ${distfile} {/:.*$//}] if {![catch {strsed [exec [findBinary file $portutil::autoconf::file_path] ${distpath}/${distfile} --brief --mime] {s/;.*$//}} mimetype] && ${mimetype} eq "text/html"} { lappend bad_distfiles ${distfile} file delete ${distpath}/${distfile} } } if {[llength ${bad_distfiles}] > 0} { ui_error "MacPorts was not able to download the necessary distfiles for ${name}." ui_error "Please visit this URL:" ui_error "" ui_error " ${homepage}" ui_error "" ui_error "and download these files manually:" ui_error "" foreach distfile ${bad_distfiles} { ui_error " ${distfile}" } ui_error "" ui_error "and place them in this directory:" ui_error "" ui_error " ${distpath}" return -code error "missing distfiles" } } extract { set my_build_dir ${extract.dir}/build xinstall -d ${my_build_dir} foreach my_arch ${configure.universal_archs} { foreach my_distfile_type {basic sdk} { system "${extract.cmd} ${extract.pre_args} ${extract.post_args} [shellescape ${distpath}/[format $my_distname_format(${my_arch}) ${my_distfile_type}]${extract.suffix}]" } move ${extract.dir}/[format ${my_worksrcdir_format} [join [lrange [split ${version} .] 0 1] "_"]] ${my_build_dir}/${my_arch} } # Fix permissions. fs-traverse f ${my_build_dir} { if {[string match "*.dylib.*" ${f}]} { set ext .dylib } else { set ext [file extension ${f}] } switch ${ext} { .dylib - .jar { file attributes ${f} -permissions 0755 } .h { file attributes ${f} -permissions 0644 } } } } use_configure no set lib_dir ${prefix}/lib/oracle build { foreach my_arch ${configure.universal_archs} { # Oracle builds the libraries with strange install_names; fix them. # For each dylib, change the directory of its install_name to ${lib_dir}. foreach lib [glob -directory ${workpath}/build/${my_arch} *.dylib*] { system "install_name_tool -id ${lib_dir}/[strsed ${lib} /^.*\\///] ${lib}" # Then for each dependent dylib with a strange install_name that # this dylib references, fix the reference to use ${lib_dir}. foreach dep [exec otool -L ${lib}] { if {[string match "$my_library_prefix(${my_arch})/*" ${dep}]} { system "install_name_tool -change ${dep} ${lib_dir}/[strsed ${dep} /^.*\\///] ${lib}" } } # libociei is special: it's not linked to; it's dynamically loaded at # runtime by libclntsh. Oracle says you have to set DYLD_LIBRARY_PATH # to include ${lib_dir}, but adding an rpath works too—but rpath only # exists on Leopard and newer. if {${os.major} > 8 && [string match "*/libclntsh.dylib*" ${lib}]} { system "install_name_tool -add_rpath ${lib_dir} ${lib}" } } } } destroot { foreach my_arch ${configure.universal_archs} { set my_destroot ${workpath}/pre-dest/${my_arch} set my_worksrcpath ${workpath}/build/${my_arch} xinstall -d ${my_destroot}${lib_dir} xinstall \ {*}[glob -directory ${my_worksrcpath} *.dylib*] \ {*}[glob -directory ${my_worksrcpath} *.jar] \ ${my_destroot}${lib_dir} # You would think the includes should go in ${prefix}/include/oracle, but # the "instantclient layout" dictates they must be in ${lib_dir}/sdk/include; # ports like php-oracle will expect them there. xinstall -d ${my_destroot}${lib_dir}/sdk copy ${my_worksrcpath}/sdk/include ${my_destroot}${lib_dir}/sdk } merge ${workpath}/pre-dest # php-oracle complains without a libclntsh.dylib symlink. ln -s libclntsh.dylib.${library_version} ${destroot}${lib_dir}/libclntsh.dylib # Add a libocci.dylib symlink too for good measure. ln -s libocci.dylib.${library_version} ${destroot}${lib_dir}/libocci.dylib } if {${os.major} > 8} { notes-append " If you previously set DYLD_LIBRARY_PATH=${lib_dir} in your environment,\ you can remove it\; it is no longer needed with this version of ${name}. " } else { notes-append " To use ${name}, add this command to your environment: export DYLD_LIBRARY_PATH=${lib_dir} " }