def _symlink_library(
        repository_ctx,
        library_path,
        target):
    """Symlink a library into the bazel building directory. If library path
       is 'some_path/library.ext' and target is 'tgt', the library will be
       symlinked into 'tgt/library.ext'.

    Args:
        repository_ctx: the repository_ctx object.
        library_path: full path to the library file.
        target: the symlink target.
    Returns:
        True if the library is found or False otherwise.
    """

    if repository_ctx.path(library_path).exists:
        file_name = library_path[library_path.rfind("/") + 1:]
        repository_ctx.symlink(library_path, "%s/%s" % (target, file_name))
        return True
    else:
        return False