support for FEATURES=debug-build
authorMike Frysinger <vapier@gentoo.org>
Wed, 7 Jun 2006 13:20:42 +0000 (13:20 -0000)
committerMike Frysinger <vapier@gentoo.org>
Wed, 7 Jun 2006 13:20:42 +0000 (13:20 -0000)
svn path=/main/trunk/; revision=3468

pym/portage.py

index 79271d36ae3275d1f989e88f9cfea009886a6d47..d222e1c85bede6ad43ba3e6a35b28b0caf76c8dd 100644 (file)
@@ -1336,6 +1336,23 @@ class config:
                        if "usersandbox" in self.features:
                                self.features.remove("usersandbox")
 
+               if "debug-build" in self.features:
+                       # the profile should be setting these, but just in case ...
+                       if not len(self["DEBUG_CFLAGS"]):
+                               self["DEBUG_CFLAGS"] = "-g -O"
+                               self.backup_changes("DEBUG_CFLAGS")
+                       if not len(self["DEBUG_CXXFLAGS"]):
+                               self["DEBUG_CXXFLAGS"] = self["DEBUG_CFLAGS"]
+                               self.backup_changes("DEBUG_CXXFLAGS")
+                       # replace user vars with debug version
+                       for var in ["CFLAGS","CXXFLAGS","LDFLAGS"]:
+                               self[var]=self["DEBUG_"+var]
+                               self.backup_changes(var)
+                       # if user has splitdebug, the debug info will be auto saved for
+                       # gdb, otherwise we want to keep the binaries from being stripped
+                       if not "splitdebug" in self.features:
+                               self.features.append("nostrip")
+
                self.features.sort()
                self["FEATURES"] = " ".join(self.features)
                self.backup_changes("FEATURES")