Revision
104770
Author
ryandesign@macports.org
Date
2013-04-02 05:21:34 -0700 (Tue, 02 Apr 2013)

Log Message

oracle-instantclient: add rpath on Leopard and up so that setting DYLD_LIBRARY_PATH is no longer necessary (#38626)

Modified Paths

Diff

Modified: trunk/dports/databases/oracle-instantclient/Portfile (104769 => 104770)


--- trunk/dports/databases/oracle-instantclient/Portfile	2013-04-02 12:14:25 UTC (rev 104769)
+++ trunk/dports/databases/oracle-instantclient/Portfile	2013-04-02 12:21:34 UTC (rev 104770)
@@ -19,6 +19,9 @@
 if {"powerpc" == ${os.arch}} {
     epoch               1
     version             10.1.0.3
+    if {${os.major} > 8} {
+        revision        1
+    }
     set library_version 10.1
     supported_archs     ppc
     universal_variant   no
@@ -40,6 +43,7 @@
     livecheck.type      none
 } else {
     version             11.2.0.3.0
+    revision            1
     set library_version 11.1
     supported_archs     x86_64 i386
     variant universal {}
@@ -135,11 +139,8 @@
 set lib_dir             ${prefix}/lib/oracle
 
 build {
-    # Oracle builds the libraries with strange install_names, which we fix, for
-    # neatness. Unfortunately users must still set DYLD_LIBRARY_PATH in their
-    # environment because one of the libraries, libociei, is dynamically loaded
-    # at runtime rather than being linked to.
     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}"
@@ -151,6 +152,14 @@
                     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}"
+            }
         }
     }
 }
@@ -181,8 +190,15 @@
     ln -s libocci.dylib.${library_version} ${destroot}${lib_dir}/libocci.dylib
 }
 
-notes "
+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}
 "
+}