[102945] trunk/base/src/port1.0/portdestroot.tcl

jmr at macports.org jmr at macports.org
Sun Feb 10 19:30:34 PST 2013


Revision: 102945
          https://trac.macports.org/changeset/102945
Author:   jmr at macports.org
Date:     2013-02-10 19:30:34 -0800 (Sun, 10 Feb 2013)
Log Message:
-----------
prevent overlinking due to dependency_libs in glibtool .la files (#38010)

Modified Paths:
--------------
    trunk/base/src/port1.0/portdestroot.tcl

Modified: trunk/base/src/port1.0/portdestroot.tcl
===================================================================
--- trunk/base/src/port1.0/portdestroot.tcl	2013-02-11 03:14:58 UTC (rev 102944)
+++ trunk/base/src/port1.0/portdestroot.tcl	2013-02-11 03:30:34 UTC (rev 102945)
@@ -48,7 +48,7 @@
 
 # define options
 options destroot.target destroot.destdir destroot.clean destroot.keepdirs destroot.umask
-options destroot.violate_mtree destroot.asroot
+options destroot.violate_mtree destroot.asroot destroot.delete_la_files
 options startupitem.create startupitem.requires startupitem.init
 options startupitem.name startupitem.start startupitem.stop startupitem.restart
 options startupitem.type startupitem.executable
@@ -69,6 +69,7 @@
 default destroot.clean no
 default destroot.keepdirs ""
 default destroot.violate_mtree no
+default destroot.delete_la_files no
 
 default startupitem.name        {${subport}}
 default startupitem.uniquename  {org.macports.${startupitem.name}}
@@ -149,7 +150,7 @@
 
 proc portdestroot::destroot_finish {args} {
     global UI_PREFIX destroot prefix subport startupitem.create destroot.violate_mtree
-    global applications_dir frameworks_dir destroot.keepdirs
+    global applications_dir frameworks_dir destroot.keepdirs destroot.delete_la_files
     global os.platform os.version
     variable oldmask
 
@@ -166,6 +167,28 @@
         }
     }
 
+    # Prevent overlinking due to glibtool .la files: https://trac.macports.org/ticket/38010
+    ui_debug "Fixing glibtool .la files in destroot for ${subport}"
+    fs-traverse -depth fullpath ${destroot} {
+        if {[file extension $fullpath] == ".la" && [file type $fullpath] == "file"} {
+            # Make sure it is from glibtool ... "a libtool library file" will appear in the first line
+            if {![catch {set fp [open $fullpath]}]} {
+                if {[gets $fp line] > 0 && [string first "a libtool library file" $line] != -1} {
+                    if {${destroot.delete_la_files}} {
+                        ui_debug "Removing [file tail $fullpath]"
+                        file delete -force ${fullpath}
+                    } else {
+                        ui_debug "Clearing dependency_libs in [file tail $fullpath]"
+                        reinplace "/dependency_libs/ s/'.*'/''/" ${fullpath}
+                    }
+                }
+            } else {
+                ui_debug "Failed to open $fullpath"
+            }
+            catch {close $fp}
+        }
+    }
+
     # Prune empty directories in ${destroot}
     foreach path ${destroot.keepdirs} {
         if {![file isdirectory ${path}]} {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130210/eb1976d1/attachment.html>


More information about the macports-changes mailing list