# HG changeset patch
# User Sean Farley <sean@mcs.anl.gov>
# Date 1333952858 18000
# Node ID afc3c11a37c50ea232d70aa62c323dd141423ce0
# Parent 3d98ad9aef44c290da4d0684854926cb548d80c2
base: add a default +debug 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, it will try to delete all -O{1,2,3}
flags and add -O0. Of course, individual packages can override what
+debug 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
|
|
1603 | 1603 | $workername eval source Portfile |
1604 | 1604 | |
1605 | 1605 | # add the default universal variant if appropriate, and set up flags that |
1606 | 1606 | # are conditional on whether universal is set |
1607 | 1607 | $workername eval universal_setup |
| 1608 | $workername eval debug_setup |
1608 | 1609 | |
1609 | 1610 | # evaluate the variants |
1610 | 1611 | if {[$workername eval eval_variants variations] != 0} { |
1611 | 1612 | mportclose $mport |
1612 | 1613 | error "Error evaluating variants" |
diff --git a/base/src/port1.0/portutil.tcl b/base/src/port1.0/portutil.tcl
a
|
b
|
|
1999 | 1999 | ui_debug "adding the default universal variant" |
2000 | 2000 | variant universal {} |
2001 | 2001 | } |
2002 | 2002 | } |
2003 | 2003 | |
| 2004 | # add the default debug variant if appropriate |
| 2005 | proc 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-delete -O1 -O2 -O3 -mtune=native |
| 2012 | configure.cxxflags-delete -O1 -O2 -O3 -mtune=native |
| 2013 | configure.cppflags-delete -O1 -O2 -O3 -mtune=native |
| 2014 | configure.fflags-delete -O1 -O2 -O3 -mtune=native |
| 2015 | configure.f90flags-delete -O1 -O2 -O3 -mtune=native |
| 2016 | |
| 2017 | configure.cflags-append -g -O0 |
| 2018 | configure.cxxflags-append -g -O0 |
| 2019 | configure.fflags-append -g -O0 |
| 2020 | configure.f90flags-append -g -O0 |
| 2021 | |
| 2022 | post-destroot { |
| 2023 | ui_debug "Generating debug symbols: find ${destroot}${prefix} -type f -name '*.dylib' -exec dsymutil {} +" |
| 2024 | system -W ${destroot}${prefix} "find . -type f -name *.dylib -exec dsymutil {} +" |
| 2025 | } |
| 2026 | } |
| 2027 | } |
| 2028 | } |
| 2029 | |
2004 | 2030 | # Target class definition. |
2005 | 2031 | |
2006 | 2032 | # constructor for target object |
2007 | 2033 | proc target_new {name procedure} { |
2008 | 2034 | global targets |
diff --git a/dports/_resources/port1.0/group/cmake-1.0.tcl b/dports/_resources/port1.0/group/cmake-1.0.tcl
a
|
b
|
|
72 | 72 | configure.universal_args-delete --disable-dependency-tracking |
73 | 73 | |
74 | 74 | variant debug description "Enable debug binaries" { |
75 | 75 | configure.args-delete -DCMAKE_BUILD_TYPE=Release |
76 | 76 | 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 | } |
77 | 82 | } |