This introduces a new CMake option - WITH_LEGACY_OPENGL. Without this option things may not draw perfectly, however, we should soon be able to build with OpenGL core profile.
There are still a few calls missing for the patch, but the core is here (ignoring code outside //source/blender for now).
Also, the matrix-related api calls are (still) not handled here (glTranslate, ...).