Strip --strip-debug --strip-unneeded recursively

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
stemsee

Strip --strip-debug --strip-unneeded recursively

#1 Post by stemsee »

How to strip self compiled libs/apps for puppy.

Is there a magic script already in existence?

I have got this;


recursive strip command

Code: Select all

find . -type f -print -exec strip --strip-debug {} \;
determine executale

Code: Select all

 [ `stat -c %A someFile | sed 's/...\(.\).\+/\1/'` == "x" ]  
I need to add code to find executables and strip unneeded, other files strip debug.

I guess

Code: Select all

find . -type f -name '*' |  [ `stat -c %A * | sed 's/...\(.\).\+/\1/'` == "x" ] | $strip
case $strip in
         x) strip --strip-unneeded
         *) strip --strip-debug
esac
Any advice welcome?

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#2 Post by jamesbond »

I strip --strip-unneeded all files. I don't bother to check for filetypes - strip does it anyway :D
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

stemsee

#3 Post by stemsee »

ok cheers!

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#4 Post by Karl Godt »

Somehow
strip --debug
on libs as
new2dir
script does,
does not work for me since a longer while .

I use strip on both exes and libs . No problem with that .
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal :P

Ibidem
Posts: 549
Joined: Wed 26 May 2010, 03:31
Location: State of Jefferson

Re: Strip --strip-debug --strip-unneeded recursively

#5 Post by Ibidem »

stemsee wrote:How to strip self compiled libs/apps for puppy.
Is there a magic script already in existence?
I have got this;

recursive strip command

Code: Select all

find . -type f -print -exec strip --strip-debug {} \;
determine executale

Code: Select all

 [ `stat -c %A someFile | sed 's/...\(.\).\+/\1/'` == "x" ]  
I need to add code to find executables and strip unneeded, other files strip debug.

I guess

Code: Select all

find . -type f -name '*' |  [ `stat -c %A * | sed 's/...\(.\).\+/\1/'` == "x" ] | $strip
case $strip in
         x) strip --strip-unneeded
         *) strip --strip-debug
esac
Any advice welcome?
I suppose the following isn't needed, since --strip-unneeded works everywhere. But it may be interesting for shell scripts.

find also supports -perm [-]mode.
-name '*' is always implied.
This lets you implement the above as

Code: Select all

find . -type f -exec strip --strip-debug '{}' \;
find . -type f -mode -u+x -exec strip --strip-unneeded '{}' \;
(note that --strip-debug is a subset of --strip-unneeded, so it isn't harmful to do both).

Another option is using a shell script that calls 'test' (the [ ] in so many shell scripts).
Eg:

Code: Select all

#!/bin/sh
test  -w "$1" -a  -s "$1" || exit 1 #no strip if readonly or empty
if test -x "$1"
  then
     strip --strip-unneeded "$1"
  else
     strip --strip-debug "$1"
fi
Above is to be called by

Code: Select all

find -exec scriptname '{}' \;

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#6 Post by don570 »

I use Iguleder's tools which require devx package to be installed.

http://www.murga-linux.com/puppy/viewtopic.php?t=58331
________________________________________________________

stemsee

#7 Post by stemsee »

Thanks for everyone's input. With all of these options available it seems time for a unifying script to implement various combinations of these stripping commands.

Post Reply