Fixed a bug in which check_opengl() would add extraneous -opengl flags

Also, moved the libretro gl ports to the end of the build script so that check_opengl() modifies FORMAT_COMPILER_TARGET after the other libretro ports are built to ensure that the platform flag passed to the non-gl libetro cores are correct