1074a1075,1095
> def add_local_rpath(env, *targets):
> '''Set up an RPATH for a library which lives in the build directory.
>
> The construction environment variable BIN_RPATH_PREFIX should be set to
> the relative path of the build directory starting from the location of the
> binary.'''
> for target in targets:
> target = env.Entry(target)
> if not target.isdir():
> target = target.dir
> relpath = os.path.relpath(target.abspath, env['BUILDDIR'])
> components = [
> '\\$$ORIGIN',
> '${BIN_RPATH_PREFIX}',
> relpath
> ]
> env.Append(RPATH=[env.Literal(os.path.join(*components))])
>
> main.Append(LINKFLAGS=Split('-z origin'))
> main.AddMethod(add_local_rpath, 'AddLocalRPATH')
>