Hi,

attached is my profiles/default-sunos/profile.bashrc with descriptions
why things are done. Thanks for comments!

Using this one, I'm very happy to have successfully emerged system and a
working vim now :-)

/haubi/ -> weekend
-- 
Michael Haubenwallner                    SALOMON Automation GmbH
Forschung & Entwicklung                  A-8114 Friesach bei Graz
mailto:[EMAIL PROTECTED]  http://www.salomon.at
No HTML/MIME please, see http://expita.com/nomime.html
# for as long as our tree isn't sane yet, prevent from having files
# installed into the live filesystem for non-sandbox people
export EDEST=${D}/fix/your/EDEST

# The linker in a prefixed system should look first in the prefix
# directories (search path), then the (foreign) system directories

# Doing it once in 'setup' phase is enough.
if [[ ${EBUILD_PHASE} == setup ]]; then

        # Ensure that we have a leading and trailing separator, see below.
        LD_RUN_PATH=:${LD_RUN_PATH}:

        # Modify LD_LIBRARY_PATH if it is set, because we do not need it,
        # but it has the power to break our binaries, as it is searched before
        # builtin DT_RUNPATH's.
        # LD_LIBRARY_PATH would be searched after DT_RPATH, but DT_RPATH is
        # ignored if DT_RUNPATH is set, and the linker always sets both
        # DT_RPATH _and_ DT_RUNPATH.
        [[ ${LD_LIBRARY_PATH:+1} ]] &&
        LD_LIBRARY_PATH=:${LD_LIBRARY_PATH}:

        # reversed order, because of prepending to LD_x_PATH:
        # in the end, lib64 is searched first, usr/lib last
        for dir in usr/lib usr/lib64 lib lib64
        do
                dir=${EPREFIX}/${dir}
                # It makes sense to add them only if we can find them.
                if [[ -d ${dir} ]] ; then
                        # as we search for :${dir}: here, the leading and 
trailing
                        # separators set above are required to match if 
LD_RUN_PATH
                        # contains ${dir} only.
                        LD_RUN_PATH=${dir}:${LD_RUN_PATH//:${dir}:/:}

                        # remember: modify LD_LIBRARY_PATH only if already set.
                        [[ ${LD_LIBRARY_PATH:+1} ]] &&
                        LD_LIBRARY_PATH=${dir}:${LD_LIBRARY_PATH//:${dir}:/:}
                fi
        done

        # clean up duplicate separators
        while [[ ${LD_RUN_PATH} = *::* ]]; do
                LD_RUN_PATH=${LD_RUN_PATH//::/:}
        done
        # clean up leading and trailing separators
        LD_RUN_PATH=${LD_RUN_PATH#:}
        LD_RUN_PATH=${LD_RUN_PATH%:}

        if [[ ${LD_LIBRARY_PATH:+1} ]]; then
                # same here
                while [[ ${LD_LIBRARY_PATH} = *::* ]]; do
                        LD_LIBRARY_PATH=${LD_LIBRARY_PATH//::/:}
                done
                LD_LIBRARY_PATH=${LD_LIBRARY_PATH#:}
                LD_LIBRARY_PATH=${LD_LIBRARY_PATH%:}
        fi

        # We cannot set LDFLAGS in general to contain "-Wl,-R,${LD_RUN_PATH}",
        # because some packages (ncurses fex) use the linker directly, which
        # doesn't understand "-Wl,".
        # OTOH ncurses does not pass -rpath itself,
        # so setting LD_RUN_PATH suffices for ncurses.
        #
        # This is also true for every other package currently ([EMAIL 
PROTECTED]) installed
        # by 'emerge system' on x86-solaris, although they are not keyworded 
yet.
        # This is why I need to ACCEPT_KEYWORDS="x86-solaris ~x86 x86 
~x86-macos ~x86-solaris"
        #
        # Maybe we should patch the linker to listen to LD_RUN_PATH 
independently
        # of having -R or -rpath or -rpath-link on the link line.

        # I'm sure this 'case ${P}' is a hack, but I don't know yet how to do 
it better,
        # except doing that in the ebuilds directly.

        # note "-R" is Solaris linker specific, but GNU-ld supports it (make
        # sure ${dir} is a directory!)
        case "${P}" in
        binutils-*)
                # binutils itself passes -rpath, and ignores env-LDFLAGS 
somehow.
                # So we need to pass LDFLAGS as explicit make variable.
                # Don't know yet how this affects cross-compiling binutils.
                EXTRA_EMAKE="${EXTRA_EMAKE} LDFLAGS=-Wl,-R,${LD_RUN_PATH}"
                ;;
        python-*)
                # python passes -rpath itself, and uses gcc to link, so we have
                # to use LDFLAGS to pass LD_RUN_PATH to python.
                LDFLAGS="${LDFLAGS} -Wl,-R,${LD_RUN_PATH}"
                ;;
        esac

fi # ${EBUILD_PHASE} == setup

export LD_RUN_PATH LD_LIBRARY_PATH EXTRA_EMAKE LDFLAGS

Reply via email to