docs: def find_lib_dir(root):
      """search for lib dir under root."""
      root = path(root)
      log.debug('files in dir: %s', root)
      for x in root.walkfiles():
          log.debug('  %s', x)
  
      # only 1 dir in root? (example: github)
      if not len(root.files()) and len(root.dirs()) == 1:
          log.debug('go inside root')
          root = root.dirs()[0]
  
      if len(root.files('keywords.txt')):
          root = rename_root(root)
          return root, root
  
      keywords = list(root.walkfiles('keywords.txt'))
      if len(keywords):
          if len(keywords) > 1:
              log.warning('more keywords.txt found. Installing only one.  %s', keywords)  
  
          lib_dir = keywords[0].parent
          lib_dir = fix_libdir(lib_dir)
          return root, lib_dir
  
      header_only = len(list(noexample(root.walkfiles('*.cpp')))) == 0
      log.debug('header_only: %s', header_only)
      lib_dir = None
  
      headers = list(noexample(root.walkfiles('*.h')))
  
      for h in headers:
          cpp = h.stripext() + '.cpp'
          if (header_only or cpp.exists()) and h.parent.name.lower() == h.namebase.lower():
              assert not lib_dir
              lib_dir = h.parent
              log.debug('found lib: %s', lib_dir)
  
      if not lib_dir:
          if len(headers) == 1 and len(list(root.files('*.h'))) == 0:
              log.debug('only 1 header, not in root')
              lib_dir = headers[0].parent
              lib_dir = rename_root(lib_dir)
  
      if not lib_dir:
          # xxx.cpp and xxx.h in root? -> rename root dir
          root = rename_root(root)
          return root, root
  #        for h in root.files('*.h'):
  #            cpp = h.stripext() + '.cpp'
  #            if  header_only or cpp.exists():
  #                assert not lib_dir
  #                root.rename(root.parent / h.namebase)
  #                root = lib_dir = root.parent / h.namebase
      assert lib_dir
      return root, lib_dir