WIP: cross compiling

This is far from complete and I might have broken non-crosscompile in one or two places (didn't test yet), but I wanted to get your opinion on it - and if possible, avoid more rebases from hell :)