libtool-patches
[Top][All Lists]
Advanced

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

Re: darwin fat archive support


From: Albert Chin
Subject: Re: darwin fat archive support
Date: Tue, 20 Jul 2004 17:14:34 -0500
User-agent: Mutt/1.5.6i

On Mon, Jul 19, 2004 at 12:03:40AM +0900, Peter O'Gorman wrote:
> Okay to apply?

grep -> $GREP
sed -> $SED

More comments below.

> Peter
> -- 
> Peter O'Gorman - http://www.pogma.com

> Index: ChangeLog
> 2004-07-18  Peter O'Gorman  <address@hidden>
> 
>       * ltmain.in [darwin](func_extract_archives): Because fat archives
>       on darwin can not be extracted using ar, we need to use lipo to
>       extract the thin archives and then use lipo again to generate the
>       individual fat objects. This should allow people to run configure
>       with CC set to "cc -arch ppc -arch ppc64" or "cc -arch ppc -arch
>       i386" or whatever to match the toolchain they have available.
> 
> from  Greg Eisenhauer  <address@hidden>
> Index: ltmain.in
> ===================================================================
> RCS file: /cvsroot/libtool/libtool/ltmain.in,v
> retrieving revision 1.400
> diff -u -3 -p -u -r1.400 ltmain.in
> --- ltmain.in 15 Jul 2004 12:14:44 -0000 1.400
> +++ ltmain.in 18 Jul 2004 14:55:59 -0000
> @@ -515,36 +515,76 @@ func_extract_archives () {
>        if test "$status" -ne 0 && test ! -d "$my_xdir"; then
>       exit $status
>        fi
> -
> -      # We will extract separately just the conflicting names and we will
> -      # no longer touch any unique names. It is faster to leave these
> -      # extract automatically by $AR in one run.
> -      $show "(cd $my_xdir && $AR x $my_xabs)"
> -      $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $?
> -      if ($AR t "$my_xabs" | 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
> -     $AR t "$my_xabs" | sort | uniq -cd | while read -r count name
> -     do
> -       i=1
> -       while test "$i" -le "$count"
> +      case $host in
> +      *-darwin*)
> +        darwin_orig_dir=`pwd`
> +     $show "cd $my_xdir"
        ^^^ what's up with indentation?

> +     $run eval "cd \$my_xdir" || exit $?
> +     darwin_archive=$my_xabs
> +     darwin_curdir=`pwd`
> +     darwin_base_archive=`basename $darwin_archive`
> +     darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | grep 
> Architectures 2>/dev/null`
> +     if test -n "$darwin_arches"; then 
> +       darwin_arches=`echo "$darwin_arches" | sed -e 's/.*are://'`
> +       darwin_arch=
> +       for darwin_arch in  $darwin_arches ; do
                            ^^ why?

> +           mkdir -p ./unfat-$$/${darwin_base_archive}-${darwin_arch}
                       ^^ why? on the next line you don't use "./"

> +           lipo -thin $darwin_arch -output 
> unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive} 
> ${darwin_archive}
> +      # Remove the table of contents from the thin files.
> +           $run eval "$AR -d 
> unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive} 
> __.SYMDEF 2>/dev/null|| true"
                                           ^^ no space before || like
                                              in your while loop?
> +           $run eval "$AR -d 
> unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive} 
> __.SYMDEF\ SORTED 2>/dev/null|| true"
                                                   ^^ ditto
> +           cd unfat-$$/${darwin_base_archive}-${darwin_arch}
> +           $run eval "$AR -xo ${darwin_base_archive}"
> +           $run eval "rm ${darwin_base_archive}"
> +           cd $darwin_curdir
> +       done
> +      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
> +       darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | 
> $NL2SP`
> +       darwin_file=
> +       darwin_files=
> +       for darwin_file in $darwin_filelist; do
> +           darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
> +           eval "lipo -create -output $darwin_file $darwin_files"
              ^^^^ $run eval?
> +       done
> +       rm -rf unfat-$$
> +       cd $darwin_orig_dir
> +     else
> +       cd $darwin_orig_dir
> +       $show "(cd $my_xdir && $AR x $my_xabs)"
          ^^^^^ why don't you $show anything above?

> +       $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $?
> +     fi
> +      ;;
> +      *)
> +     # We will extract separately just the conflicting names and we will
> +     # no longer touch any unique names. It is faster to leave these
> +     # extract automatically by $AR in one run.
> +     $show "(cd $my_xdir && $AR x $my_xabs)"
> +     $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $?
> +     if ($AR t "$my_xabs" | 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
> +       $AR t "$my_xabs" | sort | uniq -cd | while read -r count name
>         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 "$my_xdir/$name_to"
> +         i=1
> +         while test "$i" -le "$count"
>           do
> -           name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
> +           # Put our $i before any first dot (extension)
> +           # Never overwrite any file
> +           name_to="$name"
> +           while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to"
> +           do
> +             name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
> +           done
> +           $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' 
> '$name_to')"
> +           $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv 
> '$name' '$name_to')" || exit $?
> +           i=`expr $i + 1`
>           done
> -         $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' 
> '$name_to')"
> -         $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv 
> '$name' '$name_to')" || exit $?
> -         i=`expr $i + 1`
>         done
> -     done
> -      fi
> -
> +     fi
> +     ;;
> +      esac
>        my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o 
> -name \*.lo -print | $NL2SP`
>      done

-- 
albert chin (address@hidden)




reply via email to

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