Fix SDL build and port to SDL2