add support for compressing debug sections to save space
authorMike Frysinger <vapier@gentoo.org>
Fri, 13 Jan 2012 19:34:58 +0000 (14:34 -0500)
committerMike Frysinger <vapier@gentoo.org>
Sat, 14 Jan 2012 21:37:24 +0000 (16:37 -0500)
Since binutils/gdb can compress the .debug* sections with zlib into
.zdebug*, we should be able to save quite a bit of space -- on my
system, I saw /usr/lib/debug/ go from ~20GB to ~7.5GB.

This requires binutils/gdb to be built with USE=zlib which is why
this defaults to off.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
bin/ebuild-helpers/prepstrip
man/make.conf.5
pym/_emerge/EbuildPhase.py
pym/portage/const.py

index ee547f2358ea6b2f5f99b973a9eee5dcfd1384c3..daaa25250d8977b2fbc28d0d6c2bd9bf9fdf3fb7 100755 (executable)
@@ -15,7 +15,7 @@ exp_tf() {
                eval ${var}_${flag}=$(tf has ${flag} ${!var})
        done
 }
-exp_tf FEATURES installsources nostrip splitdebug
+exp_tf FEATURES compressdebug installsources nostrip splitdebug
 exp_tf RESTRICT binchecks installsources strip
 
 [[ " ${FEATURES} " == *" force-prefix "* ]] || \
@@ -121,7 +121,9 @@ save_elf_debug() {
                if [[ -e ${T}/prepstrip.split.debug ]] ; then
                        mv "${T}"/prepstrip.split.debug "${y}"
                else
-                       ${OBJCOPY} --only-keep-debug "${x}" "${y}"
+                       local objcopy_flags="--only-keep-debug"
+                       ${FEATURES_compressdebug} && objcopy_flags+=" --compress-debug-sections"
+                       ${OBJCOPY} ${objcopy_flags} "${x}" "${y}"
                        ${OBJCOPY} --add-gnu-debuglink="${y}" "${x}"
                fi
                local args="a-x,o-w"
index f7491a9498c92ec7c63a4ebb88cf13c8d7fa7c42..e5a9ae1ed57bb0c57515b5dfffe846681cd277d7 100644 (file)
@@ -260,6 +260,12 @@ Log file names have an extension that is appropriate for the compression
 type. Currently, only \fBgzip\fR(1) compression is supported, so build
 logs will have a '.gz' extension when this feature is enabled.
 .TP
+.B compressdebug
+Compress the debug sections in the split debug files with zlib to save
+space.  Make sure you have built both binutils and gdb with USE=zlib
+support for this to work.  See \fBsplitdebug\fR for general split debug
+information (upon which this feature depends).
+.TP
 .B config\-protect\-if\-modified
 This causes the \fBCONFIG_PROTECT\fR behavior to be skipped for files
 that have not been modified since they were installed.
@@ -476,7 +482,9 @@ instead of using \fBPORT_LOGDIR\fR directly.
 .B splitdebug
 Prior to stripping ELF etdyn and etexec files, the debugging info is 
 stored for later use by various debuggers.  This feature is disabled by
-\fBnostrip\fR.  For installation of source code, see \fBinstallsources\fR.
+\fBnostrip\fR.  You should also consider setting \fBcompressdebug\fR so
+the files don't suck up a lot of space.  For installation of source code,
+see \fBinstallsources\fR.
 .TP
 .B strict
 Have portage react strongly to conditions that have the potential to be 
index ed0be0b0e8d35ecb1f5382b7ea51e4a185e6b776..27944f413d55c67a313676508fe9b99388eaf93d 100644 (file)
@@ -33,11 +33,13 @@ class EbuildPhase(CompositeTask):
                ("_ebuild_lock",)
 
        # FEATURES displayed prior to setup phase
-       _features_display = ("ccache", "distcc", "distcc-pump", "fakeroot",
+       _features_display = (
+               "ccache", "compressdebug", "distcc", "distcc-pump", "fakeroot",
                "installsources", "keeptemp", "keepwork", "nostrip",
                "preserve-libs", "sandbox", "selinux", "sesandbox",
                "splitdebug", "suidctl", "test", "userpriv",
-               "usersandbox")
+               "usersandbox"
+       )
 
        # Locked phases
        _locked_phases = ("setup", "preinst", "postinst", "prerm", "postrm")
index 5fcb24f7379d52406706ba73ded42535d6ce8eea..bebb9220377b0ee67c717fd60b6a98d32fc1009e 100644 (file)
@@ -88,7 +88,7 @@ EBUILD_PHASES            = ("pretend", "setup", "unpack", "prepare", "configure"
 SUPPORTED_FEATURES       = frozenset([
                            "assume-digests", "binpkg-logs", "buildpkg", "buildsyspkg", "candy",
                            "ccache", "chflags", "clean-logs",
-                           "collision-protect", "compress-build-logs",
+                           "collision-protect", "compress-build-logs", "compressdebug",
                            "config-protect-if-modified",
                            "digest", "distcc", "distcc-pump", "distlocks", "ebuild-locks", "fakeroot",
                            "fail-clean", "force-mirror", "force-prefix", "getbinpkg",