From b30aad552cde507a70c6bf3bc2ce40ed69e0ecf2 Mon Sep 17 00:00:00 2001 From: Benjamin Gordon Date: Wed, 13 Jun 2018 16:17:32 -0600 Subject: [PATCH] configure.ac/meson.build: Add options for library suffixes 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. Reviewed-by: Eric Engestrom --- configure.ac | 19 +++++++++++++++++++ meson.build | 3 +++ meson_options.txt | 11 +++++++++++ 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 d8124479c76..073ffc508d5 100644 --- a/configure.ac +++ b/configure.ac @@ -1557,6 +1557,23 @@ AC_ARG_WITH([osmesa-lib-name], GL_LIB="$DEFAULT_GL_LIB_NAME" OSMESA_LIB=OSMesa +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=""]) +AS_IF([test "x$EGL_LIB_SUFFIX" = xyes], [EGL_LIB_SUFFIX=""]) +AS_IF([test "x$GLES_LIB_SUFFIX" = xyes], [GLES_LIB_SUFFIX=""]) + +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 @@ -1575,6 +1592,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]) dnl HACK when building glx + glvnd we ship gl.pc, despite that glvnd should do it diff --git a/meson.build b/meson.build index 7a536982da6..7b337755544 100644 --- a/meson.build +++ b/meson.build @@ -375,6 +375,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 if with_vulkan_icd_dir == '' diff --git a/meson_options.txt b/meson_options.txt index 6c14fd503b9..45faa341e79 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -336,3 +336,14 @@ option( value : false, description : 'Allow work-in-progress freedreno vulkan driver to be enabled', ) +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 4383cca1e00..349779feb4e 100644 --- a/src/egl/Makefile.am +++ b/src/egl/Makefile.am @@ -190,12 +190,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 abc3695d6d4..38ffb512f1c 100644 --- a/src/egl/meson.build +++ b/src/egl/meson.build @@ -143,7 +143,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 69978e7a468..23735ded1a5 100644 --- a/src/mapi/Makefile.am +++ b/src/mapi/Makefile.am @@ -191,24 +191,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 # HAVE_OPENGL_ES1 endif # USE_LIBGLVND @@ -238,24 +238,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 # HAVE_OPENGL_ES2 endif # USE_LIBGLVND diff --git a/src/mapi/es1api/meson.build b/src/mapi/es1api/meson.build index 016090dac91..47f0f8bd0b9 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 c6e9261bcc8..5b2c52b024d 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.30.2