For some reason, portage thinks you have some packages installed which have been removed. In this case, you are missing
x11-proto/inputproto (/usr/include/X11/extensions/XI.h)
If you look at the ebuild for libX11-1.0.3, you will see that x11-proto/inputproto is a DEPEND for libX11, and portage thinks you have it installed, but you don't. One way to get to such a state is to start building pieces of X-modular, then somehow do (the equivalent of)
emerge -C =x11-base/xorg-x11-6.8.2-r8
which as a side effect can remove files which belong to X-modular.

You can try to force it by looking at the dependencies for libX11, and merging them all by hand (especially the x11-proto/xxx ones, which are just header files). Or, you can try
emerge -pv =x11-base/xorg-x11-6.8.2-r8
Any blockers, such as:
[blocks B ] x11-proto/inputproto (is blocking x11-base/xorg-x11-6.8.2-r8 )
are most likely pieces of X-modular which portage thinks you have installed. You should be able to build each such piece by hand.

Not sure exactly how this happen, other than I had looked into migrating earlier, but decided to hold off until modular began stable on sparc. I must have went a little too far in some areas. I unmerged X11-proto/inputproto and then remerge xorg which should fix it. Which it did, but failed on another file, Xdmcp.h, so I am unmerging x11-libs/libXdmcp. Probably going to have to do this several times to clear this out.