libglvnd/src/GLX/Makefile.am

98 lines
3.2 KiB
Makefile
Raw Normal View History

# Copyright (c) 2013, NVIDIA CORPORATION.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and/or associated documentation files (the
# "Materials"), to deal in the Materials without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Materials, and to
# permit persons to whom the Materials are furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# unaltered in all copies or substantial portions of the Materials.
# Any additions, deletions, or changes to the original source files
# must be clearly indicated in accompanying documentation.
#
# If only executable code is distributed, then the accompanying
# documentation must state that "this software is based in part on the
# work of the Khronos Group."
#
# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
noinst_HEADERS = \
glvnd_genentry.h \
libglxabipriv.h \
libglxcurrent.h \
libglxmapping.h \
Re-implement libGL such that ELF symbol filtering is optional Unfortunately, glibc has a bug where dlopening a shared library with DT_FILTER or DT_AUXILIARY ELF headers can cause the application to segfault (see https://sourceware.org/bugzilla/show_bug.cgi?id=16272). Hence, for now, we can't rely on ELF symbol filtering to implement the libGL compatibility library for libGLdispatch and libGLX. This change re-implements libGL such that this is no longer necessary, by building in the glapi static dispatch stubs and implementing thin wrapper functions around GLX entrypoints. - Rename getCachedProcAddress() to __glXGetCachedProcAddress() and give this public visibility. This is used by the libGL wrapper library to retrieve GLX entrypoints at load time. - Link libGLX with the -Bsymbolic flag so __glXGetCachedProcAddress() avoids referencing functions in the libGL wrapper library when libGL and libGLX are both loaded. - Replace the hand-coded no-op definitions in libglxnoopdefs.h with a spec file, glx_funcs.spec, and a simple Perl script, gen_stubs.pl, which parses the file and generates no-op functions as well as pass-through functions that are used by libGL. - Restructure GLdispatch/vnd-glapi/mapi/entry.c such that the pure C fallback code is in its own header, entry_pure_c.h. In each of the entry_*.h headers, separate code not related to implementing the static dispatch stubs into an "#if !defined(STATIC_DISPATCH_ONLY)" block. - Give u_current (which is #defined as _glapi_Current or _glapi_tls_Current depending on the thread storage model used) public visibility so it can be referenced from outside of libGLdispatch.so. - When building libGL, include GLdispatch/vnd-glapi/mapi/entry.c in the sources, and define STATIC_DISPATCH_ONLY so that only the static entrypoints are compiled. Remove the -Wl,--auxiliary flags from Makefile.am. Bonus: fix "make distcheck" by adding GLdispatchABI.h to noinst_HEADERS. Signed-off-by: Brian Nguyen <brnguyen@nvidia.com>
2013-12-03 21:06:47 +01:00
libglxgl.h \
libglxthread.h \
libglxproto.h
lib_LTLIBRARIES = libGLX.la
UTIL_DIR = ../util
UTHASH_DIR = ../util/uthash/src
GL_DISPATCH_DIR = ../GLdispatch
# Warning settings
# Include paths
libGLX_la_CFLAGS = -I$(srcdir)/$(UTHASH_DIR)
libGLX_la_CFLAGS += -I$(srcdir)/$(UTIL_DIR)
libGLX_la_CFLAGS += -I$(srcdir)/$(GL_DISPATCH_DIR)
libGLX_la_CFLAGS += -I$(top_srcdir)/include
libGLX_la_CFLAGS += $(GLPROTO_CFLAGS) $(X11_CFLAGS) $(XEXT_CFLAGS)
# Required library flags
libGLX_la_CFLAGS += $(PTHREAD_CFLAGS)
# Required libraries
libGLX_la_LIBADD = @LIB_DL@
libGLX_la_LIBADD += $(X11_LIBS)
libGLX_la_LIBADD += $(XEXT_LIBS)
libGLX_la_LIBADD += $(GL_DISPATCH_DIR)/libGLdispatch.la
libGLX_la_LIBADD += $(UTIL_DIR)/libtrace.la
libGLX_la_LIBADD += $(UTIL_DIR)/libglvnd_pthread.la
libGLX_la_LIBADD += $(UTIL_DIR)/libutils_misc.la
libGLX_la_LIBADD += $(UTIL_DIR)/libapp_error_check.la
libGLX_la_LIBADD += $(UTIL_DIR)/libwinsys_dispatch.la
libGLX_la_LDFLAGS = -shared -Wl,-Bsymbolic -version-info 0 $(LINKER_FLAG_NO_UNDEFINED)
Re-implement libGL such that ELF symbol filtering is optional Unfortunately, glibc has a bug where dlopening a shared library with DT_FILTER or DT_AUXILIARY ELF headers can cause the application to segfault (see https://sourceware.org/bugzilla/show_bug.cgi?id=16272). Hence, for now, we can't rely on ELF symbol filtering to implement the libGL compatibility library for libGLdispatch and libGLX. This change re-implements libGL such that this is no longer necessary, by building in the glapi static dispatch stubs and implementing thin wrapper functions around GLX entrypoints. - Rename getCachedProcAddress() to __glXGetCachedProcAddress() and give this public visibility. This is used by the libGL wrapper library to retrieve GLX entrypoints at load time. - Link libGLX with the -Bsymbolic flag so __glXGetCachedProcAddress() avoids referencing functions in the libGL wrapper library when libGL and libGLX are both loaded. - Replace the hand-coded no-op definitions in libglxnoopdefs.h with a spec file, glx_funcs.spec, and a simple Perl script, gen_stubs.pl, which parses the file and generates no-op functions as well as pass-through functions that are used by libGL. - Restructure GLdispatch/vnd-glapi/mapi/entry.c such that the pure C fallback code is in its own header, entry_pure_c.h. In each of the entry_*.h headers, separate code not related to implementing the static dispatch stubs into an "#if !defined(STATIC_DISPATCH_ONLY)" block. - Give u_current (which is #defined as _glapi_Current or _glapi_tls_Current depending on the thread storage model used) public visibility so it can be referenced from outside of libGLdispatch.so. - When building libGL, include GLdispatch/vnd-glapi/mapi/entry.c in the sources, and define STATIC_DISPATCH_ONLY so that only the static entrypoints are compiled. Remove the -Wl,--auxiliary flags from Makefile.am. Bonus: fix "make distcheck" by adding GLdispatchABI.h to noinst_HEADERS. Signed-off-by: Brian Nguyen <brnguyen@nvidia.com>
2013-12-03 21:06:47 +01:00
GENERATE_DISPATCH_STUBS_SCRIPT = $(top_srcdir)/src/GLX/gen_glx_stubs.py
EXTRA_DIST = $(GENERATE_DISPATCH_STUBS_SCRIPT)
if HAVE_PYTHON
g_glx_dispatch_stub_list.h: $(GENERATE_DISPATCH_STUBS_SCRIPT)
$(AM_V_GEN)$(PYTHON) $(GENERATE_DISPATCH_STUBS_SCRIPT) > $@
BUILT_SOURCES = g_glx_dispatch_stub_list.h
CLEANFILES = $(BUILT_SOURCES)
endif
libGLX_la_SOURCES = \
libglx.c \
libglxmapping.c \
libglxproto.c \
glvnd_genentry.c \
g_glx_dispatch_stub_list.h
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = glx.pc
AM_TESTS_ENVIRONMENT = \
TOP_SRCDIR='$(top_srcdir)' \
TOP_BUILDDIR='$(top_builddir)' \
NM='$(NM)' \
PYTHON='$(PYTHON)'
TESTS = glx-symbol-check.sh
EXTRA_DIST += \
glx-symbol-check.sh \
glx.symbols \
meson.build