Ticket #33821: base-debug-debug_opt.patch

File base-debug-debug_opt.patch, 4.0 KB (added by seanfarley (Sean Farley), 12 years ago)

rename the no_opt variant to debug_opt; also use the find command more efficiently

  • base/src/macports1.0/macports.tcl

    # HG changeset patch
    # User Sean Farley <sean@mcs.anl.gov>
    # Date 1333862096 18000
    # Node ID e5741fc3a391447ac00b7f8e7051f0b50f30c1ab
    # Parent  10f91f7bb6f07f23a6ec736222d9e7e6a78e8666
    base: add a default +debug and +debug_opt variant
    
    This change adds a default +debug variant that will build packages
    with -g and, more importantly, run the dsymutil tool to keep the
    debugging symbols. Additionally, there is a +debug_opt variant that will
    try to delete all -O{1,2,3} flags and add -O0. Of course, individual
    packages can override what +debug and +debug_opt will do, but as a base
    default, this seems sensible to have so that a user can get debugging
    symbols for gdb easily without having to edit a package's Portfile.
    
    diff --git a/base/src/macports1.0/macports.tcl b/base/src/macports1.0/macports.tcl
    a b  
    16031603    $workername eval source Portfile
    16041604
    16051605    # add the default universal variant if appropriate, and set up flags that
    16061606    # are conditional on whether universal is set
    16071607    $workername eval universal_setup
     1608    $workername eval debug_setup
     1609    $workername eval debug_opt_setup
    16081610
    16091611    # evaluate the variants
    16101612    if {[$workername eval eval_variants variations] != 0} {
    16111613        mportclose $mport
    16121614        error "Error evaluating variants"
  • base/src/port1.0/portutil.tcl

    diff --git a/base/src/port1.0/portutil.tcl b/base/src/port1.0/portutil.tcl
    a b  
    19991999        ui_debug "adding the default universal variant"
    20002000        variant universal {}
    20012001    }
    20022002}
    20032003
     2004# add the default debug variant if appropriate
     2005proc debug_setup {args} {
     2006    if {[variant_exists debug]} {
     2007        ui_debug "debug variant already exists, so not adding the default one"
     2008    } else {
     2009        ui_debug "adding the default debug variant"
     2010        variant debug description {Enable debug flags and symbols} {
     2011            configure.cflags-append     -g
     2012            configure.cxxflags-append   -g
     2013            configure.fflags-append     -g
     2014            configure.f90flags-append   -g
     2015
     2016            post-destroot {
     2017                ui_debug "Generating debug symbols: find ${destroot}${prefix} -type f -name '*.dylib' -exec dsymutil {} +"
     2018                system -W ${destroot}${prefix} "find . -type f -name *.dylib -exec dsymutil {} +"
     2019            }
     2020        }
     2021    }
     2022}
     2023
     2024# add the default debug_opt variant if appropriate
     2025proc debug_opt_setup {args} {
     2026    if {[variant_exists debug_opt]} {
     2027        ui_debug "debug_opt variant already exists, so not adding the default one"
     2028    } else {
     2029        ui_debug "adding the default debug_opt variant"
     2030        variant debug_opt description {Add -O0 optimization flags} {
     2031            configure.cflags-delete     -O1 -O2 -O3 -mtune=native
     2032            configure.cxxflags-delete   -O1 -O2 -O3 -mtune=native
     2033            configure.fflags-delete     -O1 -O2 -O3 -mtune=native
     2034            configure.f90flags-delete   -O1 -O2 -O3 -mtune=native
     2035
     2036            configure.cflags-append     -O0
     2037            configure.cxxflags-append   -O0
     2038            configure.fflags-append     -O0
     2039            configure.f90flags-append   -O0
     2040        }
     2041    }
     2042}
     2043
    20042044# Target class definition.
    20052045
    20062046# constructor for target object
    20072047proc target_new {name procedure} {
    20082048    global targets
  • dports/_resources/port1.0/group/cmake-1.0.tcl

    diff --git a/dports/_resources/port1.0/group/cmake-1.0.tcl b/dports/_resources/port1.0/group/cmake-1.0.tcl
    a b  
    7272configure.universal_args-delete --disable-dependency-tracking
    7373
    7474variant debug description "Enable debug binaries" {
    7575    configure.args-delete   -DCMAKE_BUILD_TYPE=Release
    7676    configure.args-append   -DCMAKE_BUILD_TYPE=debugFull
     77
     78    post-destroot {
     79        ui_debug "Generating debug symbols: find ${destroot}${prefix} -type f -name '*.dylib' -exec dsymutil {} +"
     80        system -W ${destroot}${prefix} "find . -type f -name *.dylib -exec dsymutil {} +"
     81    }
    7782}