[Mesa-dev] [PATCH] configure.ac/meson.build: Add options for library suffixes
Eric Engestrom
eric.engestrom at intel.com
Wed Jun 13 10:03:25 UTC 2018
On Tuesday, 2018-06-12 11:19:40 -0600, bmgordon at chromium.org wrote:
> From: Benjamin Gordon <bmgordon at 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.
This seems reasonable, and the meson side of this patch is correct,
but we need to document or prevent the interaction between
--enable-libglvnd and --with-egl-lib-suffix.
I can't think of a use-case for having both, so I suggest "if both are
enabled, error out"; scroll down for what this could look like in meson.
With that (and the corresponding autotools hunk):
Reviewed-by: Eric Engestrom <eric.engestrom at intel.com>
>
> Change-Id: I0a534d3921a24c031e2532ee7d5ba9813740b33b
(Note to whoever merges this patch: drop this line ^)
> Signed-off-by: Benjamin Gordon <bmgordon at chromium.org>
> ---
> configure.ac | 14 ++++++++++++++
> 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 +-
> 7 files changed, 47 insertions(+), 21 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 35ade986d1..6070a2146b 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1511,12 +1511,24 @@ 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])
>
> dnl
> @@ -1534,6 +1546,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_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 at EGL_LIB_SUFFIX@.la
> +libEGL at EGL_LIB_SUFFIX@_la_SOURCES =
> +libEGL at EGL_LIB_SUFFIX@_la_LIBADD = \
> libEGL_common.la \
> $(top_builddir)/src/mapi/shared-glapi/libglapi.la
> -libEGL_la_LDFLAGS = \
> +libEGL at 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 with_glvnd and get_option('egl-lib-suffix') != ''
error('''EGL lib suffix can't be used with libglvnd''')
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 at GLES_LIB_SUFFIX@.la
>
> -es1api_libGLESv1_CM_la_SOURCES = entry.c es1api/glapi_mapi_tmp.h
> -es1api_libGLESv1_CM_la_CFLAGS = \
> +es1api_libGLESv1_CM at GLES_LIB_SUFFIX@_la_SOURCES = entry.c es1api/glapi_mapi_tmp.h
> +es1api_libGLESv1_CM at GLES_LIB_SUFFIX@_la_CFLAGS = \
> $(AM_CFLAGS) \
> $(VISIBILITY_CFLAGS)
> -es1api_libGLESv1_CM_la_CPPFLAGS = \
> +es1api_libGLESv1_CM at 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 at GLES_LIB_SUFFIX@_la_LIBADD = $(GLESv1_CM_LIB_DEPS)
> +es1api_libGLESv1_CM at 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 at 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 at GLES_LIB_SUFFIX@.la
>
> -es2api_libGLESv2_la_SOURCES = entry.c es2api/glapi_mapi_tmp.h
> -es2api_libGLESv2_la_CFLAGS = \
> +es2api_libGLESv2 at GLES_LIB_SUFFIX@_la_SOURCES = entry.c es2api/glapi_mapi_tmp.h
> +es2api_libGLESv2 at GLES_LIB_SUFFIX@_la_CFLAGS = \
> $(AM_CFLAGS) \
> $(VISIBILITY_CFLAGS)
> -es2api_libGLESv2_la_CPPFLAGS = \
> +es2api_libGLESv2 at 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 at GLES_LIB_SUFFIX@_la_LIBADD = $(GLESv2_LIB_DEPS)
> +es2api_libGLESv2 at 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 at 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 at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list