On Sun, Jun 03, 2007, Anders F Björklund wrote:

> > I don't know of any linker option to have it look for static libs
> > (other than explicitly listing them by name), but either a wrapper
> > to the binary or even patching the source of the binary is doable.
>
>  Reading through the source code I realize I didn't look *that* hard:
>
>  "-search_paths_first
>         By default when the -dynamic flag is  in  effect,  the  -lx  and
>         -weak-lx   options   first   search  for  a  file  of  the  form
>         `libx.dylib' in each directory in the library search path,  then
>         a  file  of  the  form  `libx.a'  is searched for in the library
>         search paths.  This option changes  it  so  that  in  each  path
>         `libx.dylib'  is searched for then `libx.a' before the next path
>         in the library search path is searched."
>
>  So appending "-Wl,-search_paths_first" to the LDFLAGS should work too.

Cool, that's it! If we now override the cc, gcc and ld commands under
Mac OS X and enfore this option, the various linking problems you have
observed should be gone. What about the following (untested) patch?

Index: openpkg.spec
===================================================================
RCS file: /v/openpkg/cvs/openpkg-src/openpkg/openpkg.spec,v
retrieving revision 1.589
diff -u -d -u -d -u -d -r1.589 openpkg.spec
--- openpkg.spec        3 Jun 2007 09:47:55 -0000       1.589
+++ openpkg.spec        3 Jun 2007 21:02:49 -0000
@@ -2437,6 +2437,29 @@
                 chmod 775 %{l_prefix}/lib/openpkg/override/install-info
             fi
             ;;
+        *-*-macos10.* | *-*-darwin* )
+            gcc="`%{l_prefix}/lib/openpkg/shtool path gcc`"
+            cc="`%{l_prefix}/lib/openpkg/shtool path cc`"
+            ld="`%{l_prefix}/lib/openpkg/shtool path ld`"
+            if [ ".$gcc" != . -a ! -f %{l_prefix}/lib/openpkg/override/gcc ]; 
then
+                ( echo "#!/bin/sh"
+                  echo "$gcc -Wl,-search_paths_first \"[EMAIL PROTECTED]""
+                ) >%{l_prefix}/lib/openpkg/override/gcc
+                chmod 775 %{l_prefix}/lib/openpkg/override/gcc
+            fi
+            if [ ".$cc" != . -a ! -f %{l_prefix}/lib/openpkg/override/cc ]; 
then
+                ( echo "#!/bin/sh"
+                  echo "$cc -Wl,-search_paths_first \"[EMAIL PROTECTED]""
+                ) >%{l_prefix}/lib/openpkg/override/cc
+                chmod 775 %{l_prefix}/lib/openpkg/override/cc
+            fi
+            if [ ".$ld" != . -a ! -f %{l_prefix}/lib/openpkg/override/ld ]; 
then
+                ( echo "#!/bin/sh"
+                  echo "$ld -search_paths_first \"[EMAIL PROTECTED]""
+                ) >%{l_prefix}/lib/openpkg/override/ld
+                chmod 775 %{l_prefix}/lib/openpkg/override/ld
+            fi
+            ;;
     esac

     #   FIXME: hack to workaround problems in environments with too few

                                       Ralf S. Engelschall
                                       [EMAIL PROTECTED]
                                       www.engelschall.com

______________________________________________________________________
OpenPKG                                             http://openpkg.org
Developer Communication List                   openpkg-dev@openpkg.org

Reply via email to