source: extras/do_ica_prep@ d057075

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

Added do_ica_prep code.

  • Property mode set to 100755
File size: 2.1 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
[d057075]13 local CMP_DIR=$1
14 local F L BN
15 local ALL_FILES=/tmp/allfiles.$$
16 local UNIQUE_FILES=/tmp/uniquefiles.$$
17
18 # Run ica_prep if it hasn't been done already
19 if [ ! -f "$CMP_DIR/icaprep" ]; then
20
21 echo -n "Removing symbolic links in ${CMP_DIR}... "
22 find $CMP_DIR -type l | xargs rm -f
23 echo "done."
24
25 echo -n "Gunzipping \".gz\" files in ${CMP_DIR}... "
26 find $CMP_DIR -name '*.gz' | xargs gunzip
27 echo "done."
28
29 #echo -n "Bunzipping \".bz2\" files in ${CMP_DIR}... "
30 #find $CMP_DIR -name '*.bz2' | xargs bunzip2
31 #echo "done."
32
33 # ar archives contain date & time stamp info that causes us
34 # grief when trying to find differences. Here we perform some
35 # hackery to allow easy diffing. Essentially, replace each
36 # archive with a dir of the same name and extract the object
37 # files from the archive into this dir. Despite their names,
38 # libieee.a & libmcheck.a are not actual ar archives.
39 echo -n "Extracting object files from \".a\" files in ${CMP_DIR}... "
40 L=$(find $CMP_DIR -name '*.a' ! -name 'libieee.a' ! -name 'libmcheck.a')
41 for F in $L; do
42 mv $F ${F}.XX
43 mkdir $F
44 cd $F
45 BN=${F##*/}
46 ar x ../${BN}.XX || {
47 echo -e "\nError: ar archive extraction failed!\n" >&2
48 exit 1
49 }
50 rm -f ../${BN}.XX
51 done
52 echo "done."
53
54 echo -n "Stripping (debug) symbols from \".o\" files in ${CMP_DIR}... "
55 find $CMP_DIR -name '*.o' | xargs strip -p -g 2>/dev/null
56 echo "done."
57
58 echo -n "Stripping (all) symbols from files OTHER THAN \".o\" files in ${CMP_DIR}... "
59 find $CMP_DIR ! -name '*.o' | xargs strip -p 2>/dev/null || :
60 echo "done."
61
62 # We're all done
63 echo -en "\nSuccess: ICA preparation for "
64 echo -e "${CMP_DIR} complete.\n"
65 touch $CMP_DIR/icaprep
66 else
67 echo -e "\n$CMP_DIR was already processed\n"
68 fi
[ed0a142]69
Note: See TracBrowser for help on using the repository browser.