None of us are really sure about the state of your system, how it was modified, really you chose to do something unsupported and for that reason you're on your own with the fix.
The easiest method would be a reinstall, it is difficult for remote system, you may want to schedule a date to get physical access.. otherwise, you could try using the yaifo project.
It is unofficial but it works over SSH vs glass (..real) or serial consoles, it will allow a clean reinstall so that you can use packages (..which are built from ports) instead of manually compiling everything.
http://erdelynet.com/?s=yaifo