source: trunk/dports/databases/oracle-instantclient/Portfile @ 107821

Last change on this file since 107821 was 107821, checked in by ryandesign@…, 6 years ago

mongodb, oracle-instantclient, curl, VillainousStyle, pure-gen, MyPaint, keybinder, fontconfig, graphviz-oldgui, openni, ttf2eot: use eq and ne for string comparisons

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 8.5 KB
RevLine 
[71090]1# -*- 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
[31834]2# $Id: Portfile 107821 2013-07-06 08:26:24Z ryandesign@macports.org $
3
4PortSystem              1.0
5
6name                    oracle-instantclient
7categories              databases
8platforms               macosx
9maintainers             ryandesign
[88228]10homepage                http://www.oracle.com/technetwork/database/features/instant-client/
[31834]11use_zip                 yes
12
13description \
14    Oracle database connection libraries
15
16long_description \
17    Oracle Instant Client allows you to run your applications without installing the standard Oracle client or having an ORACLE_HOME.
18
[107821]19if {${os.arch} eq "powerpc"} {
[104521]20    epoch               1
21    version             10.1.0.3
[104770]22    if {${os.major} > 8} {
23        revision        1
24    }
[104521]25    set library_version 10.1
26    supported_archs     ppc
27    universal_variant   no
28   
29    # The distfiles mirror has been configured not to mirror this port's files.
30    master_sites        http://cmsrep.cern.ch/cmssw/cms/SOURCES/external/oracle/10.2.0.2/
31   
32    checksums           [suffix instantclient-basic-macosx-${version}] \
33                        rmd160  d1f056f8f1b308c5493f4938b29b55fcb32452cf \
34                        sha256  55dafdab1b7387b05226fd7eb0d86d52225a702a5e690fc82af42073f49e7725 \
35                        [suffix instantclient-sdk-macosx-${version}] \
36                        rmd160  c819db7f739b8ca468c8059dfbac31a6a6965938 \
37                        sha256  350052656466cc2daecbb8b1c162ff444365def151636ba704f28ae5f05ca411
38   
39    set my_worksrcdir_format        instantclient%s
40    set my_distname_format(ppc)     instantclient-%s-macosx-${version}
41    set my_library_prefix(ppc)      /b/729
42   
43    livecheck.type      none
[57018]44} else {
[104521]45    version             11.2.0.3.0
[104770]46    revision            1
[104521]47    set library_version 11.1
48    supported_archs     x86_64 i386
[57018]49    variant universal {}
[104521]50   
51    # MacPorts won't be able to download these files.
52    master_sites        http://download.oracle.com/otn/mac/instantclient/[join [lrange [split ${version} .] 0 3] {}]/
53   
54    checksums           [suffix instantclient-basic-macos.x32-${version}] \
55                        rmd160  0ce640465611e0f5d3b9c3d421caa8c9531e573c \
56                        sha256  ee11e57f03dd2a8b92abe09f28b1796a8956cb89d19dd015c9e9cd01701d3021 \
57                        [suffix instantclient-sdk-macos.x32-${version}] \
58                        rmd160  632bdd9998ca0b8d56965544ac3020b28a213086 \
59                        sha256  2ad01e3fc2bcb0c1c4285a9b89037058b74039f6450d4b88176e8180ef2be763 \
60                        [suffix instantclient-basic-macos.x64-${version}] \
61                        rmd160  68edc03040258f5b8e7ccd4aa3c0f553d639ccf1 \
62                        sha256  b86be0d924ec44d5d86ab212cc25b010f0b813ae0f3f22fd0cb0716e27c2d6ea \
63                        [suffix instantclient-sdk-macos.x64-${version}] \
64                        rmd160  934639cbc90b29eb1649bf31c2685870ffedd498 \
65                        sha256  c2ddc7c6d93cd4e0f113362b642741d36d9e9052a9a0282ac583d086c191afcf
66   
67    set my_worksrcdir_format        instantclient_%s
68    set my_distname_format(i386)    instantclient-%s-macos.x32-${version}
69    set my_distname_format(x86_64)  instantclient-%s-macos.x64-${version}
70    set my_library_prefix(i386)     /ade/b/233679120
71    set my_library_prefix(x86_64)   /ade/b/2649109290
72   
[107821]73    if {${os.platform} eq "darwin" && ${os.major} < 9} {
[104521]74        pre-fetch {
75            ui_error "${name} on Intel requires OS X 10.5 or greater."
76            return -code error "incompatible OS X version"
77        }
78    }
79   
80    livecheck.type          regex
81    livecheck.url           http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
82    livecheck.regex         instantclient-basic-macos.x64-(\[0-9.\]+)${extract.suffix}
[36833]83}
[31834]84
[70340]85# merge() requires universal_archs to be set correctly. Since we use merge()
86# even when not building universal we must always set universal_archs correctly.
[104521]87if {![variant_exists universal] || ![variant_isset universal]} {
[70340]88    configure.universal_archs ${configure.build_arch}
[31834]89}
90
[57018]91distfiles
[104521]92foreach my_arch ${configure.universal_archs} {
[104771]93    if {[info exists my_distname_format(${my_arch})]} {
94        foreach my_distfile_type {basic sdk} {
95            distfiles-append [suffix [format $my_distname_format(${my_arch}) ${my_distfile_type}]]
96        }
[39289]97    }
98}
99
[93529]100post-fetch {
101    set bad_distfiles {}
[57018]102    foreach distfile ${distfiles} {
[93529]103        set distfile [strsed ${distfile} {/:.*$//}]
[107821]104        if {![catch {strsed [exec [findBinary file $portutil::autoconf::file_path] ${distpath}/${distfile} --brief --mime] {s/;.*$//}} mimetype] && ${mimetype} eq "text/html"} {
[93529]105            lappend bad_distfiles ${distfile}
106            file delete ${distpath}/${distfile}
107        }
[57018]108    }
[93529]109    if {[llength ${bad_distfiles}] > 0} {
110        ui_error "MacPorts was not able to download the necessary distfiles for ${name}."
111        ui_error "Please visit this URL:"
112        ui_error ""
113        ui_error "    ${homepage}"
114        ui_error ""
115        ui_error "and download these files manually:"
116        ui_error ""
117        foreach distfile ${bad_distfiles} {
118            ui_error "    ${distfile}"
119        }
120        ui_error ""
121        ui_error "and place them in this directory:"
122        ui_error ""
123        ui_error "    ${distpath}"
124        return -code error "missing distfiles"
125    }
[57018]126}
127
128extract {
129    set my_build_dir ${extract.dir}/build
130    xinstall -d ${my_build_dir}
[104521]131    foreach my_arch ${configure.universal_archs} {
132        foreach my_distfile_type {basic sdk} {
133            system "${extract.cmd} ${extract.pre_args} ${extract.post_args} ${distpath}/[suffix [format $my_distname_format(${my_arch}) ${my_distfile_type}]]"
[57018]134        }
[104521]135        move ${extract.dir}/[format ${my_worksrcdir_format} [join [lrange [split ${version} .] 0 1] "_"]] ${my_build_dir}/${my_arch}
[57018]136    }
137}
138
[31834]139use_configure           no
140
[104521]141set lib_dir             ${prefix}/lib/oracle
[31834]142
143build {
[104521]144    foreach my_arch ${configure.universal_archs} {
[104770]145        # Oracle builds the libraries with strange install_names; fix them.
[104521]146        # For each dylib, change the directory of its install_name to ${lib_dir}.
147        foreach lib [glob -directory ${workpath}/build/${my_arch} *.dylib*] {
148            system "install_name_tool -id ${lib_dir}/[strsed ${lib} /^.*\\///] ${lib}"
149           
150            # Then for each dependent dylib with a strange install_name that
151            # this dylib references, fix the reference to use ${lib_dir}.
152            foreach dep [exec otool -L ${lib}] {
153                if [string match "$my_library_prefix(${my_arch})/*" ${dep}] {
154                    system "install_name_tool -change ${dep} ${lib_dir}/[strsed ${dep} /^.*\\///] ${lib}"
[57018]155                }
[31834]156            }
[104770]157           
158            # libociei is special: it's not linked to; it's dynamically loaded at
159            # runtime by libclntsh. Oracle says you have to set DYLD_LIBRARY_PATH
160            # to include ${lib_dir}, but adding an rpath works too—but rpath only
161            # exists on Leopard and newer.
162            if {${os.major} > 8 && [string match "*/libclntsh.dylib*" ${lib}]} {
163                system "install_name_tool -add_rpath ${lib_dir} ${lib}"
164            }
[31834]165        }
166    }
167}
168
169destroot {
[104521]170    foreach my_arch ${configure.universal_archs} {
171        set my_destroot ${workpath}/pre-dest/${my_arch}
172        set my_worksrcpath ${workpath}/build/${my_arch}
173        xinstall -d ${my_destroot}${lib_dir}
174        eval xinstall \
175            [glob -directory ${my_worksrcpath} *.dylib*] \
176            [glob -directory ${my_worksrcpath} *.jar] \
177            ${my_destroot}${lib_dir}
178       
179        # You would think the includes should go in ${prefix}/include/oracle, but
180        # the "instantclient layout" dictates they must be in ${lib_dir}/sdk/include;
181        # ports like php-oracle will expect them there.
182        xinstall -d ${my_destroot}${lib_dir}/sdk
183        copy ${my_worksrcpath}/sdk/include ${my_destroot}${lib_dir}/sdk
[57018]184    }
[57022]185   
[57018]186    merge ${workpath}/pre-dest
[57022]187   
[104521]188    # php-oracle complains without a libclntsh.dylib symlink.
189    ln -s libclntsh.dylib.${library_version} ${destroot}${lib_dir}/libclntsh.dylib
[57022]190   
191    # Add a libocci.dylib symlink too for good measure.
[104521]192    ln -s libocci.dylib.${library_version} ${destroot}${lib_dir}/libocci.dylib
[31834]193}
[31890]194
[104770]195if {${os.major} > 8} {
196    notes-append "
197If you previously set DYLD_LIBRARY_PATH=${lib_dir} in your environment,\
198you can remove it\; it is no longer needed with this version of ${name}.
199"
200} else {
201    notes-append "
[104521]202To use ${name}, add this command to your environment:
203
204export DYLD_LIBRARY_PATH=${lib_dir}
[70341]205"
[104770]206}
Note: See TracBrowser for help on using the repository browser.