diff options
author | joey <joey> | 2000-03-02 21:23:22 +0000 |
---|---|---|
committer | joey <joey> | 2000-03-02 21:23:22 +0000 |
commit | 67b74298f08a3e2b30e43cbcd7cdaccc2e1b1614 (patch) | |
tree | 3ce180eedb8c91f9371456f3fb40336b4c7c34dd /dh_strip | |
parent | c7f541bd2bc869c366e8242baf1faa6856cd2e39 (diff) |
r338: * Patch from Jorgen `forcer' Schaefer <forcer at mindless.com> (much
modified)to make dh_installwm use new window manager registration method,
update-alternatives. Closes: #52156, #34684 (latter bug is obsolete)
* Fixed $dh{flavor} to be upper-case.
* Deprecated dh_installemavcsen --number; use --priority instead. Also,
the option parser requires the parameter be a number now. And,
dh_installwm now accepts --priority, and window manager packages should
start using it.
* dh_installwm now behaves like a proper debhelper command, and reads
debian/<package>.wm too. This is a small behavior change; filenames
specified on the command line no longer apply to all packages it acts
on. I can't belive this program existed for 2 years with such a glaring
problem; I guess most people don't need ot register 5 wm's in 3
sub-packages. Anyway, it can handle such things now. :-)
* Moved Dh_*.pm to /usr/lib/perl5/Debian/Debhelper. *big* change.
Diffstat (limited to 'dh_strip')
-rwxr-xr-x | dh_strip | 90 |
1 files changed, 65 insertions, 25 deletions
@@ -1,30 +1,70 @@ -#!/bin/sh -e +#!/usr/bin/perl -w # # Strip files. -PATH=debian:$PATH:/usr/lib/debhelper -source dh_lib +use File::Find; +use Debian::Debhelper::Dh_Lib; +init(); -for PACKAGE in $DH_DOPACKAGES; do - TMP=`tmpdir $PACKAGE` +# Check if a file is an elf binary, shared library, or static library, +# for use by File::Find. It'll fill the following 3 arrays with anything +# it finds: +my (@shared_libs, @executables, @static_libs); +sub testfile { + return if -l $_ or -d $_; # Skip directories and symlinks always. + + # See if we were asked to exclude this file. + # Note that we have to test on the full filename, including directory. + $fn="$File::Find::dir/$_"; + foreach $f (@{$dh{EXCLUDE}}) { + return if ($fn=~m/\Q$f\E/); + } + + # Does its filename look like a shared library? + if (m/.*\.so.*?/) { + # Ok, do the expensive test. + my $type=`file $_`; + if ($type=~m/.*ELF.*shared.*/) { + push @shared_libs, $fn; + return; + } + } + + # Is it executable? -x isn't good enough, so we need to use stat. + (undef,undef,$mode,undef)=stat(_); + if ($mode & 0111) { + # Ok, expensive test. + my $type=`file $_`; + if ($type=~m/.*ELF.*executable.*/) { + push @executables, $fn; + return; + } + } + + # Is it a static library, and not a debug library? + if (m/lib.*\.a/ && ! m/.*_g\.a/) { + push @static_libs, $fn; + return; + } +} + +foreach $PACKAGE (@{$dh{DOPACKAGES}}) { + $TMP=tmpdir($PACKAGE); + + @shared_libs=@executables=@static_libs=(); + find(\&testfile,$TMP); + + foreach (@shared_libs) { + # Note that all calls to strip on shared libs + # *must* inclde the --strip-unneeded. + doit("strip","--remove-section=.comment","--remove-section=.note","--strip-unneeded",$_); + } - # Handle executables and shared libraries. - for file in `find debian/$TMP -type f \( -perm +111 -or -name "*.so*" \) 2>/dev/null` ; do - case "`file $file`" in - *ELF*shared*) - doit "strip --strip-unneeded $file" - ;; - *ELF*executable*) - doit "strip --remove-section=comment --remove-section=note $file" - ;; - esac - done - - # Handle static libraries. - for file in `find debian/$TMP -type f -name "lib*.a" 2>/dev/null` ; do - # Don't strip debug libraries. - if ! expr "$file" : ".*_g\.a" >/dev/null ; then - doit "strip --strip-debug $file" - fi - done -done + foreach (@executables) { + doit("strip","--remove-section=.comment","--remove-section=.note",$_); + } + + foreach (@static_libs) { + doit("strip","--strip-debug",$_); + } +} |