File: arstrip

package info (click to toggle)
fox 1.0.52-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 10,788 kB
  • ctags: 13,384
  • sloc: cpp: 96,482; sh: 8,338; ansic: 1,935; makefile: 1,010; perl: 32
file content (33 lines) | stat: -rw-r--r-- 573 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#! /bin/sh

set -e 

# Strip a static library by extracting it, stripping of the symbols and 
# building the archive again. The library must be given with full path.

lib=$1
dir=${lib%%.a}.cont
savedpath=`pwd`

mkdir $dir
cd $dir
echo -n Extracting static lib...
ar x $lib
echo done
echo -n Stripping object files...
for i in *; do
  strip --strip-unneeded $i
done
echo done
rm $lib
echo -n Building new archive...
ar qS $lib *
echo done
echo -n Rebuilding archive index...
ranlib $lib
echo done

echo -n Removing temporary directory...
cd $savedpath
rm -Rf $dir
echo done