libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Darwin status


From: Ralf Wildenhues
Subject: Re: Darwin status
Date: Mon, 6 Dec 2004 09:47:43 +0100
User-agent: Mutt/1.4.1i

* Peter O'Gorman wrote on Sun, Dec 05, 2004 at 03:42:21PM CET:
> Peter O'Gorman wrote:
> >Peter O'Gorman wrote:
> >
> >>The problem is that ar on darwin has no N flag, so
> >>I haven't found a way to rename the .o's on extraction.
> >>
> >>If it works shared, then do that.
> >
> >
> >I am currently testing a solution to this....
> >
> >ar, if it accepts files with the same name at all in the archive (this 
> >behavior is not required) is meant to only extract the first named file 
> >if it is asked to extract a named file, so I can copy the archive, 
> >extract named foo.o ; mv foo.o foo-1.o, delete named foo.o from the 
> >archive copy, rinse and repeat.
> >
> >I'm crossing fingers :)
> 
> Okay, this works for me, okay to apply to branch-1-5 and eventually get 
> around to forward porting to 2.0 and HEAD?

Only minor issues (apart from the fact that I can't test the patch
myself):

> --- ltmain.in 1 Dec 2004 18:00:58 -0000 1.334.2.41
> +++ ltmain.in 5 Dec 2004 14:39:05 -0000
> @@ -242,6 +242,45 @@ func_infer_tag () {
>  }
>  
>  
> +# func_extract_an_archive dir oldlib
> +func_extract_an_archive () {
> +
> +func_extract_an_archive_dir="$1"; shift

I know the long variable names are ugly, and long lines are, too.
Still: can we keep indentation, please?

Maybe we should consider using local variables.  In the sense of:
If this function itself does not call another function, you can use
$my_*?

Maybe Gary's m4-fu will also attack this (I don't know).

> +func_extract_an_archive_oldlib="$1"
> +func_extract_an_archive_lib=`$echo "X$func_extract_an_archive_oldlib" | 
> $Xsed -e 's%^.*/%%'`
> +
> +cp $func_extract_an_archive_oldlib 
> $func_extract_an_archive_dir/$func_extract_an_archive_lib

Won't this copy break -dry-run?

> +$show "(cd $func_extract_an_archive_dir && $AR x 
> $func_extract_an_archive_oldlib)"
> +$run eval "(cd \$func_extract_an_archive_dir && $AR x 
> \$func_extract_an_archive_oldlib)" || exit $?
> +if ($AR t "$func_extract_an_archive_oldlib" | sort | sort -uc >/dev/null 
> 2>&1); then
> +  :
> +else
> +  $echo "$modename: warning: object name conflicts; renaming object files" 
> 1>&2
> +  $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
> +  $show "cp $func_extract_an_archive_oldlib 
> $func_extract_an_archive_dir/$func_extract_an_archive_lib"
> +  $run eval "cp \$func_extract_an_archive_oldlib 
> \$func_extract_an_archive_dir/\$func_extract_an_archive_lib"
> +  $AR t "$func_extract_an_archive_oldlib" | sort | uniq -c | $EGREP -v '^[   
> ]*1[    ]' | while read -r count name
> +  do
> +     i=1
> +     while test "$i" -le "$count"
> +     do
> +       # Put our $i before any first dot (extension)
> +       # Never overwrite any file
> +       name_to="$name"
> +       while test "X$name_to" = "X$name" || test -f 
> "$func_extract_an_archive_dir/$name_to"
> +       do
> +     name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
> +       done
> +       $show "(cd $func_extract_an_archive_dir && $AR x  
> $func_extract_an_archive_lib '$name' && $mv '$name' '$name_to')"
> +       $run eval "(cd \$func_extract_an_archive_dir && $AR x 
> \$func_extract_an_archive_lib '$name' && $mv '$name' '$name_to' && $AR -d 
> \$func_extract_an_archive_lib '$name')" || exit $?
> +       i=`expr $i + 1`
> +     done
> +  done
> +  $show "${rm}r $func_extract_an_archive_dir/$func_extract_an_archive_lib"
> +  $run eval "${rm}r 
> \$func_extract_an_archive_dir/\$func_extract_an_archive_lib"
> +fi
> +}
> +
>  # func_extract_archives gentop oldlib ...
>  func_extract_archives () {
>      my_gentop="$1"; shift
> @@ -287,7 +326,7 @@ func_extract_archives () {
>         cd $my_xdir || exit $?
>         darwin_archive=$my_xabs
>         darwin_curdir=`pwd`
> -       darwin_base_archive=`basename $darwin_archive`
> +       darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
>         darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP 
> Architectures 2>/dev/null`
>         if test -n "$darwin_arches"; then 
>           darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`

Oh, I'll have to put this place in my next $func_basename patch then (on
HEAD).

The rest looks ok to me (without doing any testing).
Could you state how the test fails before patching ltmain.in?
Does the test succeed on other systems, before and after patching
ltmain.in?

Please show proposed branch-2-0/HEAD patches before integrating,
because many of the variable usages changed ($echo -> $ECHO and so on).

Regards,
Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]