Changeset 102945


Ignore:
Timestamp:
Feb 11, 2013, 3:30:34 AM (7 years ago)
Author:
jmr@…
Message:

prevent overlinking due to dependency_libs in glibtool .la files (#38010)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port1.0/portdestroot.tcl

    r101987 r102945  
    4949# define options
    5050options destroot.target destroot.destdir destroot.clean destroot.keepdirs destroot.umask
    51 options destroot.violate_mtree destroot.asroot
     51options destroot.violate_mtree destroot.asroot destroot.delete_la_files
    5252options startupitem.create startupitem.requires startupitem.init
    5353options startupitem.name startupitem.start startupitem.stop startupitem.restart
     
    7070default destroot.keepdirs ""
    7171default destroot.violate_mtree no
     72default destroot.delete_la_files no
    7273
    7374default startupitem.name        {${subport}}
     
    150151proc portdestroot::destroot_finish {args} {
    151152    global UI_PREFIX destroot prefix subport startupitem.create destroot.violate_mtree
    152     global applications_dir frameworks_dir destroot.keepdirs
     153    global applications_dir frameworks_dir destroot.keepdirs destroot.delete_la_files
    153154    global os.platform os.version
    154155    variable oldmask
     
    164165            ui_debug "Deleting stray ${fileToDelete} file."
    165166            file delete "${destroot}${prefix}/${fileToDelete}"
     167        }
     168    }
     169
     170    # Prevent overlinking due to glibtool .la files: https://trac.macports.org/ticket/38010
     171    ui_debug "Fixing glibtool .la files in destroot for ${subport}"
     172    fs-traverse -depth fullpath ${destroot} {
     173        if {[file extension $fullpath] == ".la" && [file type $fullpath] == "file"} {
     174            # Make sure it is from glibtool ... "a libtool library file" will appear in the first line
     175            if {![catch {set fp [open $fullpath]}]} {
     176                if {[gets $fp line] > 0 && [string first "a libtool library file" $line] != -1} {
     177                    if {${destroot.delete_la_files}} {
     178                        ui_debug "Removing [file tail $fullpath]"
     179                        file delete -force ${fullpath}
     180                    } else {
     181                        ui_debug "Clearing dependency_libs in [file tail $fullpath]"
     182                        reinplace "/dependency_libs/ s/'.*'/''/" ${fullpath}
     183                    }
     184                }
     185            } else {
     186                ui_debug "Failed to open $fullpath"
     187            }
     188            catch {close $fp}
    166189        }
    167190    }
Note: See TracChangeset for help on using the changeset viewer.