[gh-2658] Add support for "doc_dir" to PEAR compatibilty layer.

Composer's PEAR legacy support silently ignored any "doc" role items,
which break certain packages, notably pman.

I have also upgraded the baseinstalldir support to be more conforming to
the spec. According to http://pear.php.net/manual/en/guide.users.concepts.filerole.php
only php,script,www honor baseinstalldir; all other roles should ignore it.