gl-renderer: Build as a loadable module

The time spent loading EGL and GLES libraries from disk can be a
considerable hit in some embedded use cases. If Weston is compiled
with EGL support, the binary will depend on those libraries, even if
a software renderer is in use.

This patch splits the GL renderer into a separate loadable module,
and moves the dependency on EGL and GLES to it. The backends still
need the EGL headers for the native types and EGLint. The function
load_module() is renamed to weston_load_module() and exported, so
that it can be used by the backends.

The gl renderer interface is changed so that there is only one symbol
that needs to be dlsym()'d. This symbol contains pointers to all the
functions and data necessary to interact with the renderer. As a side
effect, this change simplifies gl-renderer.h a great deal.
diff --git a/src/gl-renderer.c b/src/gl-renderer.c
index ae69f22..f02445b 100644
--- a/src/gl-renderer.c
+++ b/src/gl-renderer.c
@@ -170,7 +170,7 @@
 #undef MYERRCODE
 }
 
-WL_EXPORT void
+static void
 gl_renderer_print_egl_error_state(void)
 {
 	EGLint code;
@@ -1440,7 +1440,7 @@
 	output->border.right = gr->border.right;
 }
 
-WL_EXPORT void
+static void
 gl_renderer_set_border(struct weston_compositor *ec, int32_t width, int32_t height, void *data,
 			  int32_t *edges)
 {
@@ -1475,7 +1475,7 @@
 static int
 gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface);
 
-WL_EXPORT int
+static int
 gl_renderer_output_create(struct weston_output *output,
 				    EGLNativeWindowType window)
 {
@@ -1514,7 +1514,7 @@
 	return 0;
 }
 
-WL_EXPORT void
+static void
 gl_renderer_output_destroy(struct weston_output *output)
 {
 	struct gl_renderer *gr = get_renderer(output->compositor);
@@ -1529,7 +1529,7 @@
 	free(go);
 }
 
-WL_EXPORT EGLSurface
+static EGLSurface
 gl_renderer_output_surface(struct weston_output *output)
 {
 	return get_output_state(output)->egl_surface;
@@ -1602,7 +1602,7 @@
 	return -1;
 }
 
-WL_EXPORT const EGLint gl_renderer_opaque_attribs[] = {
+static const EGLint gl_renderer_opaque_attribs[] = {
 	EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
 	EGL_RED_SIZE, 1,
 	EGL_GREEN_SIZE, 1,
@@ -1612,7 +1612,7 @@
 	EGL_NONE
 };
 
-WL_EXPORT const EGLint gl_renderer_alpha_attribs[] = {
+static const EGLint gl_renderer_alpha_attribs[] = {
 	EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
 	EGL_RED_SIZE, 1,
 	EGL_GREEN_SIZE, 1,
@@ -1622,7 +1622,7 @@
 	EGL_NONE
 };
 
-WL_EXPORT int
+static int
 gl_renderer_create(struct weston_compositor *ec, EGLNativeDisplayType display,
 	const EGLint *attribs, const EGLint *visual_id)
 {
@@ -1673,7 +1673,7 @@
 	return -1;
 }
 
-WL_EXPORT EGLDisplay
+static EGLDisplay
 gl_renderer_display(struct weston_compositor *ec)
 {
 	return get_renderer(ec)->egl_display;
@@ -1863,3 +1863,16 @@
 
 	return 0;
 }
+
+WL_EXPORT struct gl_renderer_interface gl_renderer_interface = {
+	.opaque_attribs = gl_renderer_opaque_attribs,
+	.alpha_attribs = gl_renderer_alpha_attribs,
+
+	.create = gl_renderer_create,
+	.display = gl_renderer_display,
+	.output_create = gl_renderer_output_create,
+	.output_destroy = gl_renderer_output_destroy,
+	.output_surface = gl_renderer_output_surface,
+	.set_border = gl_renderer_set_border,
+	.print_egl_error_state = gl_renderer_print_egl_error_state
+};