[Mesa-dev] [PATCH mesa/mesa] Hardcode the DRI driver extension as .so to match it's current uses.

Emil Velikov emil.l.velikov at gmail.com
Sun Apr 6 09:45:58 PDT 2014


Hi Jon,

Sorry about this breakage. I assumed that the library extensions are handled
consistently across mesa. Seems like I was wrong.

Guessing that you meant to send this to the mesa-dev ?

On 06/04/14 15:59, Jon TURNEY wrote:
> Partially revert bba9c28 "configure: use LIB_EXT rather than hardcoded .so"
> 
This is an interesting (and slightly messy) topic.

List of all dlopen (or equivalent) users

Hard-coded
--------
- src/egl/drivers/dri2/egl_dri2.c		*dri.so, libglapi.so.0
Both extension and version are hard-coded.

- src/gbm/backends/dri/gbm_dri.c		*dri.so

- src/gbm/main/backend.c			gbm_dri.so, gbm_gallium_drm.so
GBM backends, the former is built-in into libgbm.

- src/glx/dri_common.c				*dri.so, libGL.so.1
Both extension and version are hard-coded. The Apple specific glx handles
libGL appropriately.

- src/loader/loader.c				libudev.so.*
Used on platforms that have libudev (i.e. linux) so we should be safe


Platform aware
--------------
- src/egl/main/egldriver.c			egl_dri2, egl_gallium
EGL backends, the former is built-in into libEGL.

- src/gallium/targets/egl-static/egl_st.c	st_GL, libglapi
GLapi providers - the lib prefix in the latter is hard-coded.

- src/mesa/main/texcompress_s3tc.c		DXTN_LIBNAME
Library name is correctly set to Windows and *nix.
NOTE: Apple one is missing.

- src/gallium/auxiliary/pipe-loader/pipe_loader.c pipe_*
Only built via automake. Current users opencl, xa, gallium_gbm.

- src/gallium/auxiliary/util/u_format_s3tc.c:	DXTN_LIBNAME
Library name is correctly set to Windows, *nix and Apple.


Summary
-------
 - all the dri handling uses hard-coded .so library extension and could be
compacted into the src/loader.
 - the rest seems to be on "as needed" basis and with a bug or two lurking in
the code.
 - would be great if a brave soul could clean the remaining hard-coded mayhem.

Mildly related: There are a few pieces in mesa that mention DJGPP which could
be cleaned up.

> Filenames passed to dlopen() don't need to use the platform's default extension
> for shared libraries.
> 
> Using the '.so' extension when dlopen()ing DRI drivers is hardcoded into mesa
> and the X server, so it should be hardcoded here in the Makefile as well.
> 
Interesting, all the xserver modules are correctly* handled while the dri
drivers are not.

* Use .dll for Windows, .so otherwise (including Apple, hmmm)

> A similar fix is probably also needed for gallium DRI drivers.
> 
Currently the only gallium related part is the "compatibility symlinks"
script, that is enabled only for linux. Thanks for the heads up :)

> (Consider that if we were starting from scratch, perhaps we would use a custom
> extension like .dri instead)
> 
IMHO if we're starting from scratch we should use the platform specific
extensions consistently but neither suggestion matter in this case :'(

With that said the patch is
Reviewed-by: Emil Velikov <emil.l.velikov at gmail.com>

> Cc: Emil Velikov <emil.l.velikov at gmail.com>
> Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
> ---
>  src/mesa/drivers/dri/Makefile.am | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/Makefile.am b/src/mesa/drivers/dri/Makefile.am
> index 13127f0..b66c041 100644
> --- a/src/mesa/drivers/dri/Makefile.am
> +++ b/src/mesa/drivers/dri/Makefile.am
> @@ -9,37 +9,37 @@ SUBDIRS+=common
>  if HAVE_I915_DRI
>  SUBDIRS += i915
>  MEGADRIVERS_DEPS += i915/libi915_dri.la
> -MEGADRIVERS += i915_dri. at LIB_EXT@
> +MEGADRIVERS += i915_dri.so
>  endif
>  
>  if HAVE_I965_DRI
>  SUBDIRS += i965
>  MEGADRIVERS_DEPS += i965/libi965_dri.la
> -MEGADRIVERS += i965_dri. at LIB_EXT@
> +MEGADRIVERS += i965_dri.so
>  endif
>  
>  if HAVE_NOUVEAU_DRI
>  SUBDIRS += nouveau
>  MEGADRIVERS_DEPS += nouveau/libnouveau_dri.la
> -MEGADRIVERS += nouveau_vieux_dri. at LIB_EXT@
> +MEGADRIVERS += nouveau_vieux_dri.so
>  endif
>  
>  if HAVE_R200_DRI
>  SUBDIRS += r200
>  MEGADRIVERS_DEPS += r200/libr200_dri.la
> -MEGADRIVERS += r200_dri. at LIB_EXT@
> +MEGADRIVERS += r200_dri.so
>  endif
>  
>  if HAVE_RADEON_DRI
>  SUBDIRS += radeon
>  MEGADRIVERS_DEPS += radeon/libradeon_dri.la
> -MEGADRIVERS += radeon_dri. at LIB_EXT@
> +MEGADRIVERS += radeon_dri.so
>  endif
>  
>  if HAVE_SWRAST_DRI
>  SUBDIRS += swrast
>  MEGADRIVERS_DEPS += swrast/libswrast_dri.la
> -MEGADRIVERS += swrast_dri. at LIB_EXT@
> +MEGADRIVERS += swrast_dri.so
>  endif
>  
>  pkgconfigdir = $(libdir)/pkgconfig
> @@ -51,7 +51,7 @@ driinclude_HEADERS = $(top_srcdir)/include/GL/internal/dri_interface.h
>  nodist_EXTRA_mesa_dri_drivers_la_SOURCES = dummy.cpp
>  mesa_dri_drivers_la_SOURCES =
>  mesa_dri_drivers_la_LDFLAGS = \
> -        -module -avoid-version -shared -no-undefined \
> +        -module -avoid-version -shared -no-undefined -shrext .so \
>          -Wl,-Bsymbolic \
>          $(GC_SECTIONS) \
>          $()
> @@ -76,19 +76,19 @@ if HAVE_COMPAT_SYMLINKS
>  # Add a link to allow setting LD_LIBRARY_PATH/LIBGL_DRIVERS_PATH to /lib of the build tree.
>  all-local: mesa_dri_drivers.la
>  	$(AM_V_at)$(MKDIR_P) $(top_builddir)/$(LIB_DIR);
> -	$(AM_V_GEN)ln -f .libs/mesa_dri_drivers. at LIB_EXT@ \
> -			 $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers. at LIB_EXT@;
> +	$(AM_V_GEN)ln -f .libs/mesa_dri_drivers.so \
> +			 $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.so;
>  	$(AM_V_GEN)for i in $(MEGADRIVERS); do \
> -		ln -f $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers. at LIB_EXT@ \
> +		ln -f $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.so \
>  		      $(top_builddir)/$(LIB_DIR)/$$i; \
>  	done;
>  endif
>  
>  # hardlink each megadriver instance, but don't actually have
> -# mesa_dri_drivers. at LIB_EXT@ in the set of final installed files.
> +# mesa_dri_drivers.so in the set of final installed files.
>  install-data-hook:
>  	for i in $(MEGADRIVERS); do \
> -		ln -f $(DESTDIR)$(dridir)/mesa_dri_drivers. at LIB_EXT@ \
> +		ln -f $(DESTDIR)$(dridir)/mesa_dri_drivers.so \
>  		      $(DESTDIR)$(dridir)/$$i; \
>  	done;
>  	$(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.*
> 



More information about the mesa-dev mailing list