Revision
70880
Author
michaelld@macports.org
Date
2010-08-24 12:28:35 -0700 (Tue, 24 Aug 2010)

Log Message

More robust post-destroot fixing of installed library and plugin.
Addresses ticket #26228.

Modified Paths

Diff

Modified: trunk/dports/graphics/qwt/Portfile (70879 => 70880)


--- trunk/dports/graphics/qwt/Portfile	2010-08-24 19:04:58 UTC (rev 70879)
+++ trunk/dports/graphics/qwt/Portfile	2010-08-24 19:28:35 UTC (rev 70880)
@@ -56,8 +56,21 @@
 destroot.destdir    INSTALL_ROOT="${destroot}"
 
 post-destroot {
-    # fix install-name of dynamic library
-    system "install_name_tool -id ${prefix}/lib/libqwt.${version}.dylib ${destroot}${prefix}/lib/libqwt.${version}.dylib"
-    system "install_name_tool -change libqwt.5.dylib ${prefix}/lib/libqwt.5.dylib ${destroot}${qt_dir}/plugins/designer/libqwt_designer_plugin.dylib"
+    # fix install-name of dynamic library & plugin in generic ways
+
+    # (1) fix the install name of the dynamic library
+    set libqwt_file [exec find ${destroot}${prefix}/lib -type f | \
+                         sed -e "s@${destroot}@@g"]
+    system "install_name_tool -id ${libqwt_file} ${destroot}${libqwt_file}"
+
+    # (2) fix the install name of the plugin
+    set plugin_file [exec find ${destroot}${qt_dir}/plugins/designer -type f | \
+                         sed -e "s@${destroot}@@g"]
+    system "install_name_tool -id ${plugin_file} ${destroot}${plugin_file}"
+
+    # (3) fix the plugin dependency on the dynamic library
+    set plugin_qwt [exec otool -L ${destroot}${plugin_file} | \
+                        grep "${version}" | awk "{ print \$1 }"]
+    system "install_name_tool -change ${plugin_qwt} \
+        ${prefix}/lib/${plugin_qwt} ${destroot}${plugin_file}"
 }
-

Modified: trunk/dports/graphics/qwt52/Portfile (70879 => 70880)


--- trunk/dports/graphics/qwt52/Portfile	2010-08-24 19:04:58 UTC (rev 70879)
+++ trunk/dports/graphics/qwt52/Portfile	2010-08-24 19:28:35 UTC (rev 70880)
@@ -57,9 +57,23 @@
 destroot.destdir    INSTALL_ROOT="${destroot}"
 
 post-destroot {
-    # fix install-name of dynamic library
-    system "install_name_tool -id ${prefix}/lib/libqwt.${version}.dylib ${destroot}${prefix}/lib/libqwt.${version}.dylib"
-    system "install_name_tool -change libqwt.5.dylib ${prefix}/lib/libqwt.5.dylib ${destroot}${qt_dir}/plugins/designer/libqwt_designer_plugin.dylib"
+    # fix install-name of dynamic library & plugin in generic ways
+
+    # (1) fix the install name of the dynamic library
+    set libqwt_file [exec find ${destroot}${prefix}/lib -type f | \
+                         sed -e "s@${destroot}@@g"]
+    system "install_name_tool -id ${libqwt_file} ${destroot}${libqwt_file}"
+
+    # (2) fix the install name of the plugin
+    set plugin_file [exec find ${destroot}${qt_dir}/plugins/designer -type f | \
+                         sed -e "s@${destroot}@@g"]
+    system "install_name_tool -id ${plugin_file} ${destroot}${plugin_file}"
+
+    # (3) fix the plugin dependency on the dynamic library
+    set plugin_qwt [exec otool -L ${destroot}${plugin_file} | \
+                        grep "${version}" | awk "{ print \$1 }"]
+    system "install_name_tool -change ${plugin_qwt} \
+        ${prefix}/lib/${plugin_qwt} ${destroot}${plugin_file}"
 }
 
 livecheck.url           http://sourceforge.net/api/file/index/project-id/13693/mtime/desc/rss?path=%2Fqwt