diff options
author | Stig Bakken <ssb@php.net> | 1999-04-21 20:30:47 +0000 |
---|---|---|
committer | Stig Bakken <ssb@php.net> | 1999-04-21 20:30:47 +0000 |
commit | 8335a61d74c4e9da833633ace7ab638ddc70bf12 (patch) | |
tree | dfc9d7f5bf8b0cf18bd000f902cfb8c088aa1aad /scripts | |
parent | 1ee30e61fc5dc6099bbd4d89b26c95011668e305 (diff) | |
download | php-git-8335a61d74c4e9da833633ace7ab638ddc70bf12.tar.gz |
merge the object files in a temporary directory
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/armerge | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/scripts/armerge b/scripts/armerge index 2c4df55e83..2b9f4b61a0 100755 --- a/scripts/armerge +++ b/scripts/armerge @@ -37,6 +37,11 @@ # $Id$ # +die() { + echo $@ + exit 1 +} + if test "$#" -lt "2"; then echo "Usage: "`basename $0`" <out-archive> <in-archives...>" exit 1 @@ -44,12 +49,18 @@ fi out_archive=$1; shift in_archives=$@ +cwd=`pwd` +tmpdir=/tmp/armerge$$ rm -f $out_archive +mkdir $tmpdir || die "can not create temporary directory $tmpdir" + +( cd $tmpdir; + for archive in $in_archives; do - files=`ar t $archive` - ar x $archive + files=`ar t $cwd/$archive` + ar x $cwd/$archive dir=`dirname $archive` if test "$dir" = "."; then ext_files=$files @@ -58,10 +69,15 @@ for archive in $in_archives; do prefix=`echo $prefix | sed -e 's#^\.\._##g'` ext_files="" for file in $files; do - mv "$file" "$prefix$file" + if test "$file" != "$prefix$file"; then + mv "$file" "$prefix$file" + fi ext_files="$ext_files $prefix$file" done fi - ar r $out_archive $ext_files - rm -f $ext_files -done + ar r out.a $ext_files +done ) + +mv $tmpdir/out.a $out_archive || die "can not create $out_archive" +rm -rf $tmpdir + |