source: extras/do_ica_prep@ 6753ff7

experimental
Last change on this file since 6753ff7 was 5bcccc1, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Clean-up.

  • Property mode set to 100755
File size: 1.9 KB
RevLine 
[ed0a142]1#!/bin/bash
2# $Id$
[d057075]3
4# Acknowledgment:
5# The following code is a modified version of an original work written by
6# Greg Schafer for the "DIY Linux" project and is included here with his
7# permission.
8# ref: http://www.diy-linux.org
9#
10
[ed0a142]11set -e
12
[5bcccc1]13local CMP_DIR=$1
14local F L BN
[d057075]15
[5bcccc1]16# Run ica_prep if it hasn't been done already
17if [ ! -f "$CMP_DIR/icaprep" ]; then
[d057075]18
[5bcccc1]19 echo -n "Removing symbolic links in ${CMP_DIR}... "
20 find $CMP_DIR -type l | xargs rm -f
21 echo "done."
[d057075]22
[5bcccc1]23 echo -n "Gunzipping \".gz\" files in ${CMP_DIR}... "
24 find $CMP_DIR -name '*.gz' | xargs gunzip
25 echo "done."
[d057075]26
[5bcccc1]27 #echo -n "Bunzipping \".bz2\" files in ${CMP_DIR}... "
28 #find $CMP_DIR -name '*.bz2' | xargs bunzip2
29 #echo "done."
[d057075]30
[5bcccc1]31 # ar archives contain date & time stamp info that causes us
32 # grief when trying to find differences. Here we perform some
33 # hackery to allow easy diffing. Essentially, replace each
34 # archive with a dir of the same name and extract the object
35 # files from the archive into this dir. Despite their names,
36 # libieee.a & libmcheck.a are not actual ar archives.
37 echo -n "Extracting object files from \".a\" files in ${CMP_DIR}... "
38 L=$(find $CMP_DIR -name '*.a' ! -name 'libieee.a' ! -name 'libmcheck.a')
39 for F in $L; do
40 mv $F ${F}.XX
41 mkdir $F
42 cd $F
43 BN=${F##*/}
44 ar x ../${BN}.XX || {
45 echo -e "\nError: ar archive extraction failed!\n" >&2
46 exit 1
47 }
48 rm -f ../${BN}.XX
49 done
50 echo "done."
[d057075]51
[5bcccc1]52 echo -n "Stripping (debug) symbols from \".o\" files in ${CMP_DIR}... "
53 find $CMP_DIR -name '*.o' | xargs strip -p -g 2>/dev/null
54 echo "done."
[d057075]55
[5bcccc1]56 echo -n "Stripping (all) symbols from files OTHER THAN \".o\" files in ${CMP_DIR}... "
57 find $CMP_DIR ! -name '*.o' | xargs strip -p 2>/dev/null || :
58 echo "done."
[d057075]59
[5bcccc1]60 # We're all done
61 echo -en "\nSuccess: ICA preparation for "
62 echo -e "${CMP_DIR} complete.\n"
63 touch $CMP_DIR/icaprep
64else
65 echo -e "\n$CMP_DIR was already processed\n"
66fi
[ed0a142]67
Note: See TracBrowser for help on using the repository browser.