Subject: FIX_RPATH Magic Fails on Darwin Because _OPSYS_RPATH_NAME is Empty
To: None <tech-pkg@netbsd.org>
From: Tim Preston <tdp@demon.net>
List: tech-pkg
Date: 04/01/2003 10:27:14
The recently added FIX_RPATH magic is failing on Darwin 6.4 because
_OPSYS_RPATH_NAME is empty.

defs.Darwin.mk
=============================
_OPSYS_RPATH_NAME=              # no name of symbol in rpath directive to linker
=============================

As a result RPATH_FLAG also gets set to empty.

As a reult bsd.pkg.mk ends up inserting a partially formed set of flags
in lines like these

bsd.pkg.mk
=============================
LDFLAGS+= -Wl,${RPATH_FLAG}${LOCALBASE}/lib
=============================

On my system that will add "-Wl,/Volumes/NetBSD/pkg/lib" to LDFLAGS


This sort of breaks this cleverness because the match fails because
RPATH_FLAG is empty.

bsd.pkg.mk
============================
# FIX_RPATH will remove compiler or linker settings related to run-time
# library search path settings if _USE_RPATH is "no".
#
.if !empty(_USE_RPATH:M[nN][oO])
.  if defined(FIX_RPATH) && !empty(FIX_RPATH)
.    for var in ${FIX_RPATH}
.      for _rpath_flag in ${RPATH_FLAG} -R -rpath -rpath-link
${var}:=        ${${var}:N-Wl,${_rpath_flag}*:N${_rpath_flag}*}
.      endfor
.    endfor
.  endif
.endif
============================

I would suggest that _OPSYS_RPATH_NAME should be set to some sort of
'dummy' value in defs.Darwin.mk as a solution to this problem, although
there may be a better way. I've really lost track of a lot of the
subtleties in the packages system. It's all rather complex if you don't
have enough free time to keep up with the increasing cleverness =(



My current local workaround is this line in mk.conf

mk.conf
============================
RPATH_FLAG=haddock
============================

I expect there is a more sensible value that could be used for this, but
'haddock' seems fairly unlikely to clash with anything likely to be
found in things like LDFLAGS, at least on my systems =)


-- 
Tim Preston                                  Data Network Design Engineer
             "I turn my back to the wind
                 To catch my breath,
                     Before I start off again"