Subject: Re: mk/wrapper/logic problem
To: None <tech-pkg@netbsd.org>
From: Georg Schwarz <georg.schwarz@freenet.de>
List: tech-pkg
Date: 10/24/2004 18:13:28
I am still not 100% sure how the wrapper path rewriting works in detail.
It seems indeed that path lists concatenated by :s are split up in
mk/wrapper/arg-source (and if they were not, they would later be
mangled).
When I compile devel/glib2, for example, on IRIX 5.3, I get, as an input
to the wrapper logic, among others:

cc -O2 -I/usr/people/schwarz/pkgsrc/devel/glib2/work/.buildlink/include
-Wl,-rpath -Wl,/usr/local/pkg/lib -o .libs/gobject-query gobject-query.o
./.libs/libgobject-2.0.so
-L/usr/people/schwarz/pkgsrc/devel/glib2/work/glib-2.4.7/glib/.libs
/usr/people/schwarz/pkgsrc/devel/glib2/work/glib-2.4.7/glib/.libs/libgli
b-2.0.so -L/usr/people/schwarz/pkgsrc/devel/glib2/work/.buildlink/lib
../glib/.libs/libglib-2.0.so
/usr/people/schwarz/pkgsrc/devel/glib2/work/.buildlink/lib/libintl.so
-lc
/usr/people/schwarz/pkgsrc/devel/glib2/work/.buildlink/lib/libiconv.so
-Wl,-rpath
-Wl,/usr/local/pkg/lib:/usr/people/schwarz/pkgsrc/devel/glib2/work/.buil
dlink/lib

note the last argument. It spells -Wl,path1:path2. It seems to be
created by the libtool script which is part of the glib2 source
distribution. However, it is not caught by the logic in
mk/wrapper/arg-source, which leads to the path being mangled later on by
the wrapper (by transform.sed, to be precise). Therefore I would like to
propose the following patch:

--- arg-source.orig     2004-10-24 13:32:41.000000000 +0100
+++ arg-source  2004-10-24 13:35:32.000000000 +0100
@@ -60,16 +60,19 @@
                ;;
        ##############################################################
        # Split "-Wl,-R/dir1:/dir2" into "-Wl,-R/dir1 -Wl,-R/dir2".
-       # Same for -Wl,-rpath and -Wl,-rpath-link.
+       # Same for -Wl,-rpath, -Wl,-rpath-link, -Wl,--rpath, and
+       # -Wl,.
        ##############################################################
        -R*:*|-Wl,-R*:*|\
-       -Wl,-rpath,*:*|-Wl,-rpath-link,*:*|-Wl,--rpath,*:*)     
+       -Wl,-rpath,*:*|-Wl,-rpath-link,*:*|-Wl,--rpath,*:*|\
+       -Wl,*:*)     
                case $arg in  
                -R*)                    R="-R" ;;
                -Wl,-R*)                R="-Wl,-R" ;;
                -Wl,-rpath,*)           R="-Wl,-rpath," ;;      
                -Wl,-rpath-link,*)      R="-Wl,-rpath-link," ;; 
                -Wl,--rpath,*)          R="-Wl,--rpath," ;;
+               -Wl,*)                  R="-Wl," ;;
                esac
                list="${arg#$R}"
                save_IFS="${IFS}"; IFS=":"


(the first condition could be somewhat simplified to -R*:*|-Wl,*:*),
because the rest is matched anyway).
Do you think this is a feasible solution, or is this rather a libtool
script bug which should be corrected?

Georg  

-- 
Georg Schwarz    http://home.pages.de/~schwarz/
 georg.schwarz@freenet.de   +49 177 8811442