From: Benjamin Gordon <bmgor...@chromium.org>

When building the Chrome OS Android container, we need to build copies
of mesa that don't conflict with the Android system-supplied libraries.
This adds options to create suffixed versions of EGL and GLES libraries:

libEGL.so -> libEGL${egl-lib-suffix}.so
libGLESv1_CM.so -> libGLESv1_CM${gles-lib-suffix}.so
libGLESv2.so -> libGLES${gles-lib-suffix}.so

This is similar to what happens when --enable-libglvnd is specified, but
without the side effects of linking against libglvnd.  To avoid
unexpected clashes with the suffixed appended by libglvnd, make it an
error to specify both --enable-libglvnd and --with-egl-lib-suffix.

Signed-off-by: Benjamin Gordon <bmgor...@chromium.org>
Reviewed-by: Eric Engestrom <eric.engest...@intel.com>
---
 configure.ac                | 18 ++++++++++++++++++
 meson.build                 |  3 +++
 meson_options.txt           | 12 ++++++++++++
 src/egl/Makefile.am         |  8 ++++----
 src/egl/meson.build         |  2 +-
 src/mapi/Makefile.am        | 28 ++++++++++++++--------------
 src/mapi/es1api/meson.build |  2 +-
 src/mapi/es2api/meson.build |  2 +-
 8 files changed, 54 insertions(+), 21 deletions(-)

diff --git a/configure.ac b/configure.ac
index 35ade986d1..95ec47266f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1511,14 +1511,30 @@ AC_ARG_WITH([gl-lib-name],
     [specify GL library name @<:@default=GL@:>@])],
   [GL_LIB=$withval],
   [GL_LIB="$DEFAULT_GL_LIB_NAME"])
+AC_ARG_WITH([egl-lib-suffix],
+  [AS_HELP_STRING([--with-egl-lib-suffix@<:@=NAME@:>@],
+    [specify EGL library suffix @<:@default=none@:>@])],
+  [EGL_LIB_SUFFIX=$withval],
+  [EGL_LIB_SUFFIX=""])
+AC_ARG_WITH([gles-lib-suffix],
+  [AS_HELP_STRING([--with-gles-lib-suffix@<:@=NAME@:>@],
+    [specify GLES library suffix @<:@default=none@:>@])],
+  [GLES_LIB_SUFFIX=$withval],
+  [GLES_LIB_SUFFIX=""])
 AC_ARG_WITH([osmesa-lib-name],
   [AS_HELP_STRING([--with-osmesa-lib-name@<:@=NAME@:>@],
     [specify OSMesa library name @<:@default=OSMesa@:>@])],
   [OSMESA_LIB=$withval],
   [OSMESA_LIB=OSMesa])
 AS_IF([test "x$GL_LIB" = xyes], [GL_LIB="$DEFAULT_GL_LIB_NAME"])
+AS_IF([test "x$EGL_LIB_SUFFIX" = xyes], [EGL_LIB_SUFFIX=""])
+AS_IF([test "x$GLES_LIB_SUFFIX" = xyes], [GLES_LIB_SUFFIX=""])
 AS_IF([test "x$OSMESA_LIB" = xyes], [OSMESA_LIB=OSMesa])
 
+if test "x$enable_libglvnd" = xyes -a "x$EGL_LIB_SUFFIX" != x; then
+    AC_MSG_ERROR([EGL lib suffix can't be used with libglvnd])
+fi
+
 dnl
 dnl Mangled Mesa support
 dnl
@@ -1534,6 +1550,8 @@ if test "x${enable_mangling}" = "xyes" ; then
   OSMESA_LIB="Mangled${OSMESA_LIB}"
 fi
 AC_SUBST([GL_LIB])
+AC_SUBST([EGL_LIB_SUFFIX])
+AC_SUBST([GLES_LIB_SUFFIX])
 AC_SUBST([OSMESA_LIB])
 
 # Check for libdrm
diff --git a/meson.build b/meson.build
index e52b4a5109..ca081b1e0b 100644
--- a/meson.build
+++ b/meson.build
@@ -373,6 +373,9 @@ if with_glvnd
   elif with_glx == 'disabled' and not with_egl
     error('glvnd requires DRI based GLX and/or EGL')
   endif
+  if get_option('egl-lib-suffix') != ''
+    error('''EGL lib suffix can't be used with libglvnd''')
+  endif
 endif
 
 # TODO: toggle for this
diff --git a/meson_options.txt b/meson_options.txt
index ce7d87f1eb..9d84c3b5bb 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -298,3 +298,15 @@ option(
   choices : ['freedreno', 'glsl', 'intel', 'nir', 'nouveau', 'all'],
   description : 'List of tools to build.',
 )
+option(
+  'egl-lib-suffix',
+  type : 'string',
+  value : '',
+  description : 'Suffix to append to EGL library name.  Default: none.'
+)
+option(
+  'gles-lib-suffix',
+  type : 'string',
+  value : '',
+  description : 'Suffix to append to GLES library names.  Default: none.'
+)
diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
index 086a4a1e63..c3aeeea007 100644
--- a/src/egl/Makefile.am
+++ b/src/egl/Makefile.am
@@ -184,12 +184,12 @@ libEGL_mesa_la_LDFLAGS = \
 
 else # USE_LIBGLVND
 
-lib_LTLIBRARIES = libEGL.la
-libEGL_la_SOURCES =
-libEGL_la_LIBADD = \
+lib_LTLIBRARIES = libEGL@EGL_LIB_SUFFIX@.la
+libEGL@EGL_LIB_SUFFIX@_la_SOURCES =
+libEGL@EGL_LIB_SUFFIX@_la_LIBADD = \
        libEGL_common.la \
        $(top_builddir)/src/mapi/shared-glapi/libglapi.la
-libEGL_la_LDFLAGS = \
+libEGL@EGL_LIB_SUFFIX@_la_LDFLAGS = \
        -no-undefined \
        -version-number 1:0 \
        $(BSYMBOLIC) \
diff --git a/src/egl/meson.build b/src/egl/meson.build
index 6537e4bdee..b833fd1729 100644
--- a/src/egl/meson.build
+++ b/src/egl/meson.build
@@ -148,7 +148,7 @@ if cc.has_function('mincore')
 endif
 
 if not with_glvnd
-  egl_lib_name = 'EGL'
+  egl_lib_name = 'EGL' + get_option('egl-lib-suffix')
   egl_lib_version = '1.0.0'
 else
   egl_lib_name = 'EGL_mesa'
diff --git a/src/mapi/Makefile.am b/src/mapi/Makefile.am
index 3da1a193d2..a2b108adc9 100644
--- a/src/mapi/Makefile.am
+++ b/src/mapi/Makefile.am
@@ -178,24 +178,24 @@ GLES_include_HEADERS = \
        $(top_srcdir)/include/GLES/glext.h \
        $(top_srcdir)/include/GLES/glplatform.h
 
-lib_LTLIBRARIES += es1api/libGLESv1_CM.la
+lib_LTLIBRARIES += es1api/libGLESv1_CM@GLES_LIB_SUFFIX@.la
 
-es1api_libGLESv1_CM_la_SOURCES = entry.c es1api/glapi_mapi_tmp.h
-es1api_libGLESv1_CM_la_CFLAGS = \
+es1api_libGLESv1_CM@GLES_LIB_SUFFIX@_la_SOURCES = entry.c 
es1api/glapi_mapi_tmp.h
+es1api_libGLESv1_CM@GLES_LIB_SUFFIX@_la_CFLAGS = \
        $(AM_CFLAGS) \
        $(VISIBILITY_CFLAGS)
-es1api_libGLESv1_CM_la_CPPFLAGS = \
+es1api_libGLESv1_CM@GLES_LIB_SUFFIX@_la_CPPFLAGS = \
        $(AM_CPPFLAGS) \
        -DMAPI_MODE_BRIDGE \
        -DMAPI_ABI_HEADER=\"es1api/glapi_mapi_tmp.h\"
-es1api_libGLESv1_CM_la_LIBADD = $(GLESv1_CM_LIB_DEPS)
-es1api_libGLESv1_CM_la_LDFLAGS = \
+es1api_libGLESv1_CM@GLES_LIB_SUFFIX@_la_LIBADD = $(GLESv1_CM_LIB_DEPS)
+es1api_libGLESv1_CM@GLES_LIB_SUFFIX@_la_LDFLAGS = \
        -no-undefined \
        -version-number 1:1 \
        $(GC_SECTIONS) \
        $(LD_NO_UNDEFINED)
 
-es1api_libGLESv1_CM_la_LIBADD += shared-glapi/libglapi.la
+es1api_libGLESv1_CM@GLES_LIB_SUFFIX@_la_LIBADD += shared-glapi/libglapi.la
 endif
 
 es1api/glapi_mapi_tmp.h: glapi/gen/gl_and_es_API.xml $(glapi_gen_mapi_deps)
@@ -223,24 +223,24 @@ GLES3_include_HEADERS = \
        $(top_srcdir)/include/GLES3/gl3ext.h \
        $(top_srcdir)/include/GLES3/gl3platform.h
 
-lib_LTLIBRARIES += es2api/libGLESv2.la
+lib_LTLIBRARIES += es2api/libGLESv2@GLES_LIB_SUFFIX@.la
 
-es2api_libGLESv2_la_SOURCES = entry.c es2api/glapi_mapi_tmp.h
-es2api_libGLESv2_la_CFLAGS = \
+es2api_libGLESv2@GLES_LIB_SUFFIX@_la_SOURCES = entry.c es2api/glapi_mapi_tmp.h
+es2api_libGLESv2@GLES_LIB_SUFFIX@_la_CFLAGS = \
        $(AM_CFLAGS) \
        $(VISIBILITY_CFLAGS)
-es2api_libGLESv2_la_CPPFLAGS = \
+es2api_libGLESv2@GLES_LIB_SUFFIX@_la_CPPFLAGS = \
        $(AM_CPPFLAGS) \
        -DMAPI_MODE_BRIDGE \
        -DMAPI_ABI_HEADER=\"es2api/glapi_mapi_tmp.h\"
-es2api_libGLESv2_la_LIBADD = $(GLESv2_LIB_DEPS)
-es2api_libGLESv2_la_LDFLAGS = \
+es2api_libGLESv2@GLES_LIB_SUFFIX@_la_LIBADD = $(GLESv2_LIB_DEPS)
+es2api_libGLESv2@GLES_LIB_SUFFIX@_la_LDFLAGS = \
        -no-undefined \
        -version-number 2 \
        $(GC_SECTIONS) \
        $(LD_NO_UNDEFINED)
 
-es2api_libGLESv2_la_LIBADD += shared-glapi/libglapi.la
+es2api_libGLESv2@GLES_LIB_SUFFIX@_la_LIBADD += shared-glapi/libglapi.la
 endif
 
 es2api/glapi_mapi_tmp.h: glapi/gen/gl_and_es_API.xml $(glapi_gen_mapi_deps)
diff --git a/src/mapi/es1api/meson.build b/src/mapi/es1api/meson.build
index 657dc2d9ef..14a1a6b4e0 100644
--- a/src/mapi/es1api/meson.build
+++ b/src/mapi/es1api/meson.build
@@ -28,7 +28,7 @@ es1_glapi_mapi_tmp_h = custom_target(
 )
 
 libglesv1_cm = shared_library(
-  'GLESv1_CM',
+  'GLESv1_CM' + get_option('gles-lib-suffix'),
   ['../entry.c', es1_glapi_mapi_tmp_h],
   c_args : [
     c_msvc_compat_args, c_vis_args, '-DMAPI_MODE_BRIDGE',
diff --git a/src/mapi/es2api/meson.build b/src/mapi/es2api/meson.build
index da5198ed6e..35ea3ccf71 100644
--- a/src/mapi/es2api/meson.build
+++ b/src/mapi/es2api/meson.build
@@ -28,7 +28,7 @@ es2_glapi_mapi_tmp_h = custom_target(
 )
 
 libgles2 = shared_library(
-  'GLESv2',
+  'GLESv2' + get_option('gles-lib-suffix'),
   ['../entry.c', es2_glapi_mapi_tmp_h],
   c_args : [
     c_msvc_compat_args, c_vis_args, '-DMAPI_MODE_BRIDGE',
-- 
2.18.0.rc1.242.g61856ae69a-goog

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to