Refactor build system

This basically copies mpv’s build system, with a few modifications
to get build dependencies right. Hopefully makes things less fragile
and painful to maintain by reducing code duplication and making
dependency checks declarative. It should also improve compatibility
with cross toolchains (just set the TARGET environment variable).

Hasn’t been tested on non-Linux platforms yet.

TODO: Generate HTML docs with sphinx-build
Bump waf version requirement

Fixes some issues with Python 3
waf: fix Python 3 check
waf: implement Sphinx HTML documentation task

This actually uses the Sphinx Python module, but it’s still pretty
damn ugly. Seems to be impossible to know the output files in advance
without poking Sphinx builder internals.
.gitignore: add Python cache stuff
Update INSTALL
Merge pull request #80 from vapoursynth/waf_refactor

Refactor the build system