aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-21 12:36:39 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-21 12:36:39 +0000
commitd43dd52a4ff52ecd0fc4773aa65c09532d83bc68 (patch)
treec50f4613f599285fbc308d1cd308467881926128
parentb3aa89002259a774b767e6bc267f126a8acd0e45 (diff)
downloadpaludis-d43dd52a4ff52ecd0fc4773aa65c09532d83bc68.tar.gz
paludis-d43dd52a4ff52ecd0fc4773aa65c09532d83bc68.tar.xz
Add --debug-build to paludis. Split debug based partially upon a patch by Bo ├śrsted Andresen.
-rw-r--r--ebuild/builtin_strip.bash34
-rw-r--r--paludis/ebuild.cc23
-rw-r--r--paludis/ebuild.sr1
-rw-r--r--paludis/repositories/portage/ebuild_entries.cc1
-rw-r--r--paludis/repository.hh7
-rw-r--r--paludis/repository.sr1
-rw-r--r--paludis/tasks/install_task.cc8
-rw-r--r--paludis/tasks/install_task.hh1
-rw-r--r--paludis/tasks/uninstall_task.cc2
-rw-r--r--src/adjutrix/Makefile.am4
-rw-r--r--src/paludis/command_line.cc6
-rw-r--r--src/paludis/command_line.hh3
-rw-r--r--src/paludis/install.cc12
13 files changed, 94 insertions, 9 deletions
diff --git a/ebuild/builtin_strip.bash b/ebuild/builtin_strip.bash
index 29223c1..cd22079 100644
--- a/ebuild/builtin_strip.bash
+++ b/ebuild/builtin_strip.bash
@@ -26,18 +26,42 @@ builtin_strip()
fi
PALUDIS_STRIP_FLAGS=${PALUDIS_STRIP_FLAGS:---strip-unneeded}
- for fn in $(find "${D}" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 -or -name '*.so' -or -name '*.so.*' \)); do
+ if [[ "${PALUDIS_DEBUG_BUILD}" == "split" ]] ; then
+ OBJCOPY=${OBJCOPY:-${CHOST}-objcopy}
+ if ! type -p -- "${OBJCOPY}" &>/dev/null ; then
+ OBJCOPY=objcopy
+ fi
+ if ! type -p -- "${OBJCOPY}" &>/dev/null ; then
+ die "Can't work out what OBJCOPY should be"
+ fi
+ fi
+
+ for fn in $(find "${D}" -type f \
+ \( -perm -0100 -or -perm -0010 -or -perm -0001 -or -name '*.so' -or -name '*.so.*' \)); do
local ft=$(file "${fn}")
if [[ $? != 0 || -z ${ft} ]]; then
return 1
fi
if [[ ${ft} == *"current ar archive"* ]]; then
- echo ${STRIP} -g "${fn}"
- ${STRIP} -g "${fn}"
+ if [[ "${PALUDIS_DEBUG_BUILD}" != "internal" ]] ; then
+ echo ${STRIP} -g "${fn}"
+ ${STRIP} -g "${fn}"
+ fi
elif [[ ${ft} == *"SB executable"* || ${ft} == *"SB shared object"* ]]; then
- echo ${STRIP} ${PALUDIS_STRIP_FLAGS} "${fn}"
- ${STRIP} ${PALUDIS_STRIP_FLAGS} "${fn}"
+ if [[ "${PALUDIS_DEBUG_BUILD}" == "split" ]] ; then
+ local fd="${D}usr/lib/debug/${fn:${#D}}.debug"
+ mkdir -p "$(dirname "${fd}" )"
+ echo ${OBJCOPY} --only-keep-debug "${fn}" "${fd}"
+ ${OBJCOPY} --only-keep-debug "${fn}" "${fd}"
+ echo ${OBJCOPY} --add-gnu-debuglink="${fd}" "${fn}"
+ ${OBJCOPY} --add-gnu-debuglink="${fd}" "${fn}"
+ chmod a-x,o-w "${fd}"
+ fi
+ if [[ "${PALUDIS_DEBUG_BUILD}" != "internal" ]] ; then
+ echo ${STRIP} ${PALUDIS_STRIP_FLAGS} "${fn}"
+ ${STRIP} ${PALUDIS_STRIP_FLAGS} "${fn}"
+ fi
fi
done
}
diff --git a/paludis/ebuild.cc b/paludis/ebuild.cc
index cfabc99..8ddfdc1 100644
--- a/paludis/ebuild.cc
+++ b/paludis/ebuild.cc
@@ -313,6 +313,28 @@ EbuildInstallCommand::failure()
MakeEnvCommand
EbuildInstallCommand::extend_command(const MakeEnvCommand & cmd)
{
+ std::string debug_build;
+ do
+ {
+ switch (install_params.debug_build)
+ {
+ case ido_none:
+ debug_build = "none";
+ continue;
+
+ case ido_split:
+ debug_build = "split";
+ continue;
+
+ case ido_internal:
+ debug_build = "internal";
+ continue;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Bad debug_build value");
+ }
+ while (false);
+
MakeEnvCommand result(cmd
("A", install_params.a)
("AA", install_params.aa)
@@ -321,6 +343,7 @@ EbuildInstallCommand::extend_command(const MakeEnvCommand & cmd)
("ROOT", install_params.root)
("PALUDIS_EBUILD_OVERRIDE_CONFIG_PROTECT_MASK",
install_params.disable_cfgpro ? "/" : "")
+ ("PALUDIS_DEBUG_BUILD", debug_build)
("PALUDIS_PROFILE_DIR", stringify(*install_params.profiles->begin()))
("PALUDIS_PROFILE_DIRS", join(install_params.profiles->begin(),
install_params.profiles->end(), " "))
diff --git a/paludis/ebuild.sr b/paludis/ebuild.sr
index 8cb99db..24f85a6 100644
--- a/paludis/ebuild.sr
+++ b/paludis/ebuild.sr
@@ -60,6 +60,7 @@ make_class_EbuildInstallCommandParams()
key profiles FSEntryCollection::ConstPointer
key expand_vars "AssociativeCollection<std::string, std::string>::ConstPointer"
key disable_cfgpro bool
+ key debug_build InstallDebugOption
key slot SlotName
doxygen_comment << "END"
diff --git a/paludis/repositories/portage/ebuild_entries.cc b/paludis/repositories/portage/ebuild_entries.cc
index fa1eab4..4acb081 100644
--- a/paludis/repositories/portage/ebuild_entries.cc
+++ b/paludis/repositories/portage/ebuild_entries.cc
@@ -482,6 +482,7 @@ EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
.root(stringify(_imp->params.root) + "/")
.profiles(_imp->params.profiles)
.disable_cfgpro(o.no_config_protect)
+ .debug_build(o.debug_build)
.slot(SlotName(metadata->slot)));
install_cmd();
diff --git a/paludis/repository.hh b/paludis/repository.hh
index 452b288..281e94e 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -61,6 +61,13 @@ namespace paludis
class RepositoryProvidesInterface;
class RepositoryVirtualsInterface;
+ enum InstallDebugOption
+ {
+ ido_none,
+ ido_split,
+ ido_internal
+ };
+
#include <paludis/repository-sr.hh>
/**
diff --git a/paludis/repository.sr b/paludis/repository.sr
index a1972b1..09d3cde 100644
--- a/paludis/repository.sr
+++ b/paludis/repository.sr
@@ -5,6 +5,7 @@ make_class_InstallOptions()
{
key no_config_protect bool
key fetch_only bool
+ key debug_build InstallDebugOption
doxygen_comment << "END"
/**
diff --git a/paludis/tasks/install_task.cc b/paludis/tasks/install_task.cc
index 8249ddd..a8c6473 100644
--- a/paludis/tasks/install_task.cc
+++ b/paludis/tasks/install_task.cc
@@ -49,7 +49,7 @@ namespace paludis
env(e),
dep_list(e, o),
current_dep_list_entry(dep_list.begin()),
- install_options(false, false),
+ install_options(false, false, ido_none),
targets(new AllDepAtom),
pretend(false),
preserve_world(false),
@@ -400,6 +400,12 @@ InstallTask::set_preserve_world(const bool value)
_imp->preserve_world = value;
}
+void
+InstallTask::set_debug_mode(const InstallDebugOption value)
+{
+ _imp->install_options.debug_build = value;
+}
+
InstallTask::TargetsIterator
InstallTask::begin_targets() const
{
diff --git a/paludis/tasks/install_task.hh b/paludis/tasks/install_task.hh
index 98bedcb..2ad34e3 100644
--- a/paludis/tasks/install_task.hh
+++ b/paludis/tasks/install_task.hh
@@ -86,6 +86,7 @@ namespace paludis
void set_fetch_only(const bool value);
void set_pretend(const bool value);
void set_preserve_world(const bool value);
+ void set_debug_mode(const InstallDebugOption value);
///\}
diff --git a/paludis/tasks/uninstall_task.cc b/paludis/tasks/uninstall_task.cc
index 4871022..b01ec51 100644
--- a/paludis/tasks/uninstall_task.cc
+++ b/paludis/tasks/uninstall_task.cc
@@ -45,7 +45,7 @@ namespace paludis
Implementation<UninstallTask>(Environment * const e) :
env(e),
- install_options(false, false),
+ install_options(false, false, ido_none),
pretend(false),
preserve_world(false),
with_unused_dependencies(false),
diff --git a/src/adjutrix/Makefile.am b/src/adjutrix/Makefile.am
index d1e967d..ce21e42 100644
--- a/src/adjutrix/Makefile.am
+++ b/src/adjutrix/Makefile.am
@@ -38,12 +38,12 @@ adjutrix_SOURCES = \
adjutrix.cc
adjutrix_LDADD = \
+ $(top_builddir)/paludis/environment/no_config/libpaludisnoconfigenvironment.la \
+ $(top_builddir)/paludis/repositories/portage/libpaludisportagerepository.la \
$(top_builddir)/paludis/tasks/libpaludistasks.a \
$(top_builddir)/paludis/libpaludis.la \
$(top_builddir)/paludis/args/libpaludisargs.la \
$(top_builddir)/paludis/util/libpaludisutil.la \
- $(top_builddir)/paludis/environment/no_config/libpaludisnoconfigenvironment.la \
- $(top_builddir)/paludis/repositories/portage/libpaludisportagerepository.la \
$(top_builddir)/src/libcolour.a \
$(DYNAMIC_LD_LIBS)
diff --git a/src/paludis/command_line.cc b/src/paludis/command_line.cc
index 4cd6d57..2a947e4 100644
--- a/src/paludis/command_line.cc
+++ b/src/paludis/command_line.cc
@@ -76,6 +76,12 @@ CommandLine::CommandLine() :
a_pretend(&install_args, "pretend", 'p', "Pretend only"),
a_preserve_world(&install_args, "preserve-world", '1', "Don't modify the world file"),
a_no_config_protection(&install_args, "no-config-protection", '\0', "Disable config file protection (dangerous)"),
+ a_debug_build(&install_args, "debug-build", '\0', "What to do with debug information",
+ paludis::args::EnumArg::EnumArgOptions
+ ("none", "Discard debug information")
+ ("split", "Split debug information")
+ ("internal", "Keep debug information with binaries"),
+ "none"),
a_fetch(&install_args, "fetch", 'f', "Only fetch sources; don't install anything"),
a_show_install_reasons(&install_args, "show-install-reasons", '\0', "Show why packages are being installed",
paludis::args::EnumArg::EnumArgOptions
diff --git a/src/paludis/command_line.hh b/src/paludis/command_line.hh
index 363b16f..1c8ee73 100644
--- a/src/paludis/command_line.hh
+++ b/src/paludis/command_line.hh
@@ -179,6 +179,9 @@ class CommandLine :
/// --no-config-protection
paludis::args::SwitchArg a_no_config_protection;
+ /// --debug-build
+ paludis::args::EnumArg a_debug_build;
+
/// --fetch
paludis::args::SwitchArg a_fetch;
diff --git a/src/paludis/install.cc b/src/paludis/install.cc
index dd3ed0c..f606187 100644
--- a/src/paludis/install.cc
+++ b/src/paludis/install.cc
@@ -759,6 +759,18 @@ do_install()
task.set_pretend(CommandLine::get_instance()->a_pretend.specified());
task.set_preserve_world(CommandLine::get_instance()->a_preserve_world.specified());
+ if (CommandLine::get_instance()->a_debug_build.specified())
+ {
+ if (CommandLine::get_instance()->a_debug_build.argument() == "none")
+ task.set_debug_mode(ido_none);
+ else if (CommandLine::get_instance()->a_debug_build.argument() == "split")
+ task.set_debug_mode(ido_split);
+ else if (CommandLine::get_instance()->a_debug_build.argument() == "internal")
+ task.set_debug_mode(ido_internal);
+ else
+ throw DoHelp("bad value for --debug-build");
+ }
+
InstallKilledCatcher install_killed_catcher(task);
try