Subject: Re: How to specify variable ending on whitespace?
To: None <tech-pkg@netbsd.org>
From: Jan Schaumann <jschauma@netmeister.org>
List: tech-pkg
Date: 04/25/2004 11:45:19
--AhhlLboLdkugWU4S
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Georg Schwarz <geos@epost.de> wrote:
> How can I specify a variable that ends on a whitespace character (e.g.
> in /etc/mk.conf or some other bmake script)?
> Background: on IRIX 5.3 the linker syntax is not -rpath,dirname but
> -rpath dirname. Consequently _OPSYS_RPATH_NAME should be something like
> "-rpath ".

Well, I also noticed a problem with this, and while I don't have a
solution, I do at least have another data point:

_OPSYS_RPATH_NAME is used in several ways.  On the one hand, it's used
to specify the flags to the *compiler* which flags are to be passed on
to the linker, ie '-Wl,${_OPSYS_RPATH_NAME}'.  In this instance, the
correct flags for MIPSPro compilers would be '-Wl,-rpath,/path'.
Setting _OPSYS_RPATH_NAME to "-rpath " would not work, in this scenario
(nor did using two '-Wl' flags (as "-Wl,-rpath -Wl,/path"), which is why
we set _OPSYS_RPATH_NAME to "-rpath," for Irix to begin with).

The problem occurs if we are not calling the compiler but the linker
directly.  The "-Wl,foo,bar" should be turned into "-foo bar" for the
linker, but we end up with "-foo,bar".

Buildlink3's ld-post-logic should take care of this.  Oddly, though, it
doesn't.  I had had to add the diff below to make this work:

Index: ld-post-cache
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/pkgsrc/mk/buildlink3/ld-post-cache,v
retrieving revision 1.2
diff -b -u -r1.2 ld-post-cache
--- ld-post-cache	2 Sep 2003 06:59:55 -0000	1.2
+++ ld-post-cache	25 Apr 2004 15:35:54 -0000
@@ -8,4 +8,7 @@
 -Wl,*)
 	skipcache=3Dyes
 	;;
+-rpath,*)
+	skipcache=3Dyes
+	;;
 esac
Index: ld-post-logic
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/pkgsrc/mk/buildlink3/ld-post-logic,v
retrieving revision 1.2
diff -b -u -r1.2 ld-post-logic
--- ld-post-logic	2 Sep 2003 06:59:55 -0000	1.2
+++ ld-post-logic	25 Apr 2004 15:35:54 -0000
@@ -11,4 +11,8 @@
 	arg=3D`$echo "X$arg" | $Xsed -e "s|^-Wl,||g" -e "s|,| |g"`
 	addtoprivatecache=3Dyes
 	;;
+-rpath,*)
+	arg=3D`$echo "X$arg" | $Xsed -e "s|,| |g"`
+	addtoprivatecache=3Dyes
+	;;
 esac


-Jan

--=20
Information wants to be free.

--AhhlLboLdkugWU4S
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iD8DBQFAi90PfFtkr68iakwRAumsAKDmz9dDh34B1Jo0sjpFhQVAP0calACfS2iK
fc7AuVzPdeMOa3EhrlBw8bY=
=UMFs
-----END PGP SIGNATURE-----

--AhhlLboLdkugWU4S--