# HG changeset patch
# User Sean Farley <sean@mcs.anl.gov>
# Date 1333047643 18000
# Node ID ca79513e19c1b80706754c181ec21260ef640d66
# Parent 90e8ddbc29ba190e66262274720ed29416d7f325
base: add a default +debug and +no_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 +no_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 +no_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
|
|
1602 | 1602 | $workername eval source Portfile |
1603 | 1603 | |
1604 | 1604 | # add the default universal variant if appropriate, and set up flags that |
1605 | 1605 | # are conditional on whether universal is set |
1606 | 1606 | $workername eval universal_setup |
| 1607 | $workername eval debug_setup |
| 1608 | $workername eval no_opt_setup |
1607 | 1609 | |
1608 | 1610 | # evaluate the variants |
1609 | 1611 | if {[$workername eval eval_variants variations] != 0} { |
1610 | 1612 | mportclose $mport |
1611 | 1613 | error "Error evaluating variants" |
diff --git a/base/src/port1.0/portutil.tcl b/base/src/port1.0/portutil.tcl
a
|
b
|
|
2003 | 2003 | ui_debug "adding the default universal variant" |
2004 | 2004 | variant universal {} |
2005 | 2005 | } |
2006 | 2006 | } |
2007 | 2007 | |
| 2008 | # add the default debug variant if appropriate |
| 2009 | proc debug_setup {args} { |
| 2010 | if {[variant_exists debug]} { |
| 2011 | ui_debug "debug variant already exists, so not adding the default one" |
| 2012 | } else { |
| 2013 | ui_debug "adding the default debug variant" |
| 2014 | variant debug description {Enable debug flags and symbols} { |
| 2015 | configure.cflags-append -g |
| 2016 | configure.cxxflags-append -g |
| 2017 | configure.fflags-append -g |
| 2018 | configure.f90flags-append -g |
| 2019 | |
| 2020 | post-destroot { |
| 2021 | foreach f [exec find ${destroot}${prefix} -type f -name "*.dylib"] { |
| 2022 | eval exec dsymutil ${f} |
| 2023 | } |
| 2024 | } |
| 2025 | } |
| 2026 | } |
| 2027 | } |
| 2028 | |
| 2029 | # add the default no_opt variant if appropriate |
| 2030 | proc no_opt_setup {args} { |
| 2031 | if {[variant_exists no_opt]} { |
| 2032 | ui_debug "no_opt variant already exists, so not adding the default one" |
| 2033 | } else { |
| 2034 | ui_debug "adding the default no_opt variant" |
| 2035 | variant no_opt description {Disable optimization flags} { |
| 2036 | configure.cflags-delete -O1 -O2 -O3 -mtune=native |
| 2037 | configure.cxxflags-delete -O1 -O2 -O3 -mtune=native |
| 2038 | configure.fflags-delete -O1 -O2 -O3 -mtune=native |
| 2039 | configure.f90flags-delete -O1 -O2 -O3 -mtune=native |
| 2040 | |
| 2041 | configure.cflags-append -O0 |
| 2042 | configure.cxxflags-append -O0 |
| 2043 | configure.fflags-append -O0 |
| 2044 | configure.f90flags-append -O0 |
| 2045 | } |
| 2046 | } |
| 2047 | } |
| 2048 | |
2008 | 2049 | # Target class definition. |
2009 | 2050 | |
2010 | 2051 | # constructor for target object |
2011 | 2052 | proc target_new {name procedure} { |
2012 | 2053 | 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 | foreach f [exec find ${destroot}${prefix} -type f -name "*.dylib"] { |
| 80 | eval exec dsymutil ${f} |
| 81 | } |
| 82 | } |
77 | 83 | } |