Subject: Re: pkg/28647 devel/SDL on darwin needs -framework support in libtool
To: None <gnats-bugs@netbsd.org>
From: Darrin B.Jewell <dbj@netbsd.org>
List: pkgsrc-bugs
Date: 01/20/2005 23:12:41
--=-=-=


Here's an updated patch to solve this problem with
libtool on the 2004Q4 branch.

I think this patch probably will also apply to current
since the libtool pkg has not had a major upgrade.

It would be nice to get this pr resolved for the next pkgsrc branch
so I don't have to manually patch my tree.

Let me know if you'd like me to commit this and bump
libtool's PKGREVISION.

Thanks,
Darrin


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=libtool.sdl.2004Q4.patch

Index: pkgsrc/devel/libtool/patches/patch-ac
===================================================================
RCS file: /u3/n/rsync/cvsroot/pkgsrc/devel/libtool/patches/patch-ac,v
retrieving revision 1.14.2.1
diff -u -r1.14.2.1 patch-ac
--- pkgsrc/devel/libtool/patches/patch-ac	23 Dec 2004 03:35:47 -0000	1.14.2.1
+++ pkgsrc/devel/libtool/patches/patch-ac	21 Jan 2005 03:18:34 -0000
@@ -1,6 +1,6 @@
 $NetBSD: patch-ac,v 1.14.2.1 2004/12/23 03:35:47 snj Exp $
 
---- ltmain.sh.orig	2004-09-19 22:34:44.000000000 +1000
+--- ltmain.sh.orig	Thu Jan 20 22:15:23 2005
 +++ ltmain.sh
 @@ -184,6 +184,31 @@ func_win32_libid () {
  # command doesn't match the default compiler.
@@ -85,7 +85,27 @@
  	  if test "$prev" = rpath; then
  	    case "$rpath " in
  	    *" $arg "*) ;;
-@@ -1466,7 +1519,7 @@ EOF
+@@ -1348,6 +1401,19 @@ EOF
+ 	  prev=
+ 	  continue
+ 	  ;;
++	framework)
++	  case $host in
++	  *-*-darwin*)
++	    case "$deplibs " in
++	    *" $qarg.framework "*) ;;
++	    *) deplibs="$deplibs $qarg.framework" # this is fixed later
++	      ;;
++	    esac
++	    ;;
++	  esac
++	  prev=
++	  continue
++	  ;;
+ 	*)
+ 	  eval "$prev=\"\$arg\""
+ 	  prev=
+@@ -1466,7 +1532,7 @@ EOF
  	    # These systems don't actually have a C library (as such)
  	    test "X$arg" = "X-lc" && continue
  	    ;;
@@ -94,7 +114,7 @@
  	    # Do not include libc due to us having libc/libc_r.
  	    test "X$arg" = "X-lc" && continue
  	    ;;
-@@ -1477,7 +1530,7 @@ EOF
+@@ -1477,7 +1543,7 @@ EOF
  	  esac
  	elif test "X$arg" = "X-lc_r"; then
  	 case $host in
@@ -103,7 +123,68 @@
  	   # Do not include libc_r directly, use -pthread flag.
  	   continue
  	   ;;
-@@ -3063,7 +3116,7 @@ EOF
+@@ -1669,6 +1735,11 @@ EOF
+ 	continue
+ 	;;
+ 
++      -framework)
++	prev=framework
++	continue
++	;;
++
+       # Some other compiler flag.
+       -* | +*)
+ 	# Unknown arguments in both finalize_command and compile_command need
+@@ -2052,6 +2123,18 @@ EOF
+ 	    fi
+ 	  fi
+ 	  ;; # -l
++	*.framework)
++	  if test "$linkmode,$pass" = "prog,link"; then
++	    compile_deplibs="$deplib $compile_deplibs"
++	    finalize_deplibs="$deplib $finalize_deplibs"
++	  else
++	    deplibs="$deplib $deplibs"
++	    if test "$linkmode" = lib ; then
++	      newdependency_libs="$deplib $newdependency_libs"
++	    fi
++	  fi
++	  continue
++	  ;;
+ 	-L*)
+ 	  case $linkmode in
+ 	  lib)
+@@ -2195,6 +2278,13 @@ EOF
+ 	*) . ./$lib ;;
+ 	esac
+ 
++	case $host in
++	*-*-darwin*)
++	  # Convert "-framework foo" to "foo.framework" in dependency_libs
++	  test -n "$dependency_libs" && dependency_libs=`$echo "X$dependency_libs" | $Xsed -e 's/-framework \([^ $]*\)/\1.framework/g'`
++	  ;;
++	esac
++
+ 	if test "$linkmode,$pass" = "lib,link" ||
+ 	   test "$linkmode,$pass" = "prog,scan" ||
+ 	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+@@ -2811,6 +2901,15 @@ EOF
+ 		*) continue ;;
+ 		esac
+ 		;;
++
++              *.framework)
++                case $host in
++                  *-*-darwin*)
++                    depdepl="$deplib"
++                    ;;
++                esac
++                ;;
++
+ 	      *) continue ;;
+ 	      esac
+ 	      case " $deplibs " in
+@@ -3063,7 +3162,7 @@ EOF
  	    age="$number_minor"
  	    revision="$number_revision"
  	    ;;
@@ -112,7 +193,7 @@
  	    current="$number_major"
  	    revision="$number_minor"
  	    age="0"
-@@ -3143,6 +3196,11 @@ EOF
+@@ -3143,6 +3242,11 @@ EOF
  	  versuffix=".$current";
  	  ;;
  
@@ -124,7 +205,7 @@
  	irix | nonstopux)
  	  major=`expr $current - $age + 1`
  
-@@ -3168,6 +3226,7 @@ EOF
+@@ -3168,6 +3272,7 @@ EOF
  	linux)
  	  major=.`expr $current - $age`
  	  versuffix="$major.$age.$revision"
@@ -132,7 +213,7 @@
  	  ;;
  
  	osf)
-@@ -3336,7 +3395,7 @@ EOF
+@@ -3336,7 +3441,7 @@ EOF
  	  *-*-netbsd*)
  	    # Don't link with libc until the a.out ld.so is fixed.
  	    ;;
@@ -141,7 +222,38 @@
  	    # Do not include libc due to us having libc/libc_r.
  	    test "X$arg" = "X-lc" && continue
  	    ;;
-@@ -5364,8 +5423,16 @@ relink_command=\"$relink_command\""
+@@ -3670,6 +3775,13 @@ EOF
+ 	    fi
+ 	  fi
+ 	fi
++	# Time to change all our "foo.framework" stuff back to "-framework foo"
++	case $host in
++	*-*-darwin*)
++	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
++	  dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).framework%%g'`
++	  ;;
++	esac
+ 	# Done checking deplibs!
+ 	deplibs=$newdeplibs
+       fi
+@@ -4157,12 +4269,15 @@ EOF
+       esac
+ 
+       case $host in
+-      *darwin*)
++      *-*-darwin*)
+         # Don't allow lazy linking, it breaks C++ global constructors
+         if test "$tagname" = CXX ; then
+         compile_command="$compile_command ${wl}-bind_at_load"
+         finalize_command="$finalize_command ${wl}-bind_at_load"
+         fi
++	# Time to change all our "foo.framework" stuff back to "-framework foo"
++	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
++	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
+         ;;
+       esac
+ 
+@@ -5364,8 +5479,16 @@ relink_command=\"$relink_command\""
        exit $EXIT_FAILURE
      fi
  

--=-=-=--