executables, shared libraries, and static libraries that are not used for
debugging.
This program examines your package build directories and works out what
to strip on its own. It uses L<file(1)> and file permissions and filenames
executables, shared libraries, and static libraries that are not used for
debugging.
This program examines your package build directories and works out what
to strip on its own. It uses L<file(1)> and file permissions and filenames
-to figure out what files are shared libraries (*.so), executable binaries,
-and static (lib*.a) and debugging libraries (lib*_g.a, debug/*.so), and
+to figure out what files are shared libraries (F<*.so>), executable binaries,
+and static (F<lib*.a>) and debugging libraries (F<lib*_g.a>, F<debug/*.so>), and
strips each as much as is possible. (Which is not at all for debugging
libraries.) In general it seems to make very good guesses, and will do the
right thing in almost all cases.
Since it is very hard to automatically guess if a file is a
strips each as much as is possible. (Which is not at all for debugging
libraries.) In general it seems to make very good guesses, and will do the
right thing in almost all cases.
Since it is very hard to automatically guess if a file is a
-module, and hard to determine how to strip a module, dh_strip does not
-currently deal with stripping binary modules such as .o files.
+module, and hard to determine how to strip a module, B<dh_strip> does not
+currently deal with stripping binary modules such as F<.o> files.
stripped. You may use this option multiple times to build up a list of
things to exclude.
=item B<--dbg-package=>I<package>
stripped. You may use this option multiple times to build up a list of
things to exclude.
=item B<--dbg-package=>I<package>
as independent files in the package build directory of the specified debugging
package.
For example, if your packages are libfoo and foo and you want to include a
as independent files in the package build directory of the specified debugging
package.
For example, if your packages are libfoo and foo and you want to include a
Note that this option behaves significantly different in debhelper
compatibility levels 4 and below. Instead of specifying the name of a debug
package to put symbols in, it specifies a package (or packages) which
should have separated debug symbols, and the separated symbols are placed
Note that this option behaves significantly different in debhelper
compatibility levels 4 and below. Instead of specifying the name of a debug
package to put symbols in, it specifies a package (or packages) which
should have separated debug symbols, and the separated symbols are placed
=item B<-k>, B<--keep-debug>
Debug symbols will be retained, but split into an independent
=item B<-k>, B<--keep-debug>
Debug symbols will be retained, but split into an independent
# Ok, do the expensive test.
my $type=get_file_type($_);
if ($type=~m/.*ELF.*shared.*/) {
# Ok, do the expensive test.
my $type=get_file_type($_);
if ($type=~m/.*ELF.*shared.*/) {
if (m/lib.*\.a$/ && ! m/.*_g\.a$/) {
# Is it a binary file, or something else (maybe a liner
# script on Hurd, for example? I don't use file, because
if (m/lib.*\.a$/ && ! m/.*_g\.a$/) {
# Is it a binary file, or something else (maybe a liner
# script on Hurd, for example? I don't use file, because
- my $debug_path=$desttmp."/usr/lib/debug/".$base_file;
+ my $debug_path;
+ if (! compat(8) &&
+ `readelf -n $file`=~ /^\s+Build ID: ([0-9a-f]{2})([0-9a-f]+)$/m) {
+ $debug_path=$desttmp."/usr/lib/debug/.build-id/$1/$2.debug"
+ }
+ else {
+ $debug_path=$desttmp."/usr/lib/debug/".$base_file;
+ }
my $debug_dir=dirname($debug_path);
if (! -d $debug_dir) {
doit("install", "-d", $debug_dir);
}
my $debug_dir=dirname($debug_path);
if (! -d $debug_dir) {
doit("install", "-d", $debug_dir);
}
- doit("objcopy", "--only-keep-debug", $file, $debug_path);
+ if (compat(8)) {
+ doit($objcopy, "--only-keep-debug", $file, $debug_path);
+ }
+ else {
+ doit($objcopy, "--only-keep-debug", "--compress-debug-sections", $file, $debug_path);
+ }
# No reason for this to be executable.
doit("chmod", 644, $debug_path);
return $debug_path;
# No reason for this to be executable.
doit("chmod", 644, $debug_path);
return $debug_path;
- doit("objcopy", "--add-gnu-debuglink", $debug_path, $file);
+ doit($objcopy, "--add-gnu-debuglink", $debug_path, $file);
foreach (@shared_libs) {
my $debug_path = make_debug($_, $tmp, $debugtmp) if $keep_debug;
# Note that all calls to strip on shared libs
foreach (@shared_libs) {
my $debug_path = make_debug($_, $tmp, $debugtmp) if $keep_debug;
# Note that all calls to strip on shared libs
- # *must* inclde the --strip-unneeded.
- doit("strip","--remove-section=.comment",
+ # *must* include the --strip-unneeded.
+ doit($strip,"--remove-section=.comment",
"--remove-section=.note","--strip-unneeded",$_);
attach_debug($_, $debug_path) if defined $debug_path;
}
foreach (@executables) {
my $debug_path = make_debug($_, $tmp, $debugtmp) if $keep_debug;
"--remove-section=.note","--strip-unneeded",$_);
attach_debug($_, $debug_path) if defined $debug_path;
}
foreach (@executables) {
my $debug_path = make_debug($_, $tmp, $debugtmp) if $keep_debug;
"--remove-section=.note",$_);
attach_debug($_, $debug_path) if defined $debug_path;
}
foreach (@static_libs) {
"--remove-section=.note",$_);
attach_debug($_, $debug_path) if defined $debug_path;
}
foreach (@static_libs) {