Carl Worth [Sat, 21 Sep 2013 16:18:26 +0000 (09:18 -0700)]
Install symlinks from libGL.so to libGL.so.1
An application that is directly linked will already be pointing to libGL.so.1,
but an application that is using dlopen will likely look for a file named
"libGL.so" so we need to install this symlink for those to work as well.
Carl Worth [Sat, 21 Sep 2013 16:05:23 +0000 (09:05 -0700)]
Fix misleasing error message for unset GLAZE_WRAPPER variable.
The previous error message was apparently copy-pasted from the GLAZE_LIBGL
error message. Fix it to indicate that GLAZE_WRAPPER should point to the
user's wrapper library, not the underlying libGL.so.
Carl Worth [Sat, 21 Sep 2013 16:02:26 +0000 (09:02 -0700)]
Install a libglaze-32.so library along with a glaze-32.pc file.
This is the helper library that Glaze-using libraries can link against.
Previously, it was only compiled in a native version (named libglaze.so).
Now, we compile a 64-bit version named libglaze.so and a 32-bit version
named libglaze-32.so.
Carl Worth [Wed, 4 Sep 2013 23:44:44 +0000 (16:44 -0700)]
Add function glaze_set_first_gl_call_callback
This allows the wrapper to specify a callback to be called once OpenGL
is first initialized, (without the wrapper library needing to predict
what the name of the first GL function called might be, nor needing to
wrap all OpenGL calls just in order to intercept the first one).
Carl Worth [Thu, 29 Aug 2013 22:25:09 +0000 (15:25 -0700)]
Remove dependency of libglaze on libelf
The dependency is onerous since it requires the user of Glaze to have
both a 32-bit and 64-bit development version of libelf available, (and
also have a toolchain ready to find either one as appropriate).
Meanwhile, the only thing we were doing with libelf was determining
whether the current library targets a 32-bit or a 64-bit
architecture. But we are compiling this code twice, once for each
architecture. So it is actually quite simple to just conditionally
compile in the value we want.
Carl Worth [Fri, 23 Aug 2013 23:32:29 +0000 (16:32 -0700)]
Add a glaze_execute function to libglaze
This function takes care of all of the magic needed in order to use Glaze.
With this function, the caller need not set the environment variables
such as LD_LIBRARY_PATH, GLAZE_WRAPPER, and GLAZE_LIBGL that would
otherwise need to be set in order to use Glaze.
In some cases, (such as when the "program" passed to glaze_execute is
a script that forces an alternate libGL.so.1 to be loaded), the user
may still need to set GLAZE_LIBGL to the absolute path of the correct,
underlying libGL.so.1 providing the implementation of OpenGL.
Carl Worth [Fri, 23 Aug 2013 23:24:37 +0000 (16:24 -0700)]
Add a simple helper program to find libGL.so.1
This allows us to directly inspect the final result of all of the
loader's search-path logic without us needing to implement a
compatible version of that logic ourselves, (which is more than
trivial).
Carl Worth [Thu, 22 Aug 2013 00:32:35 +0000 (17:32 -0700)]
Add a more useful error message if dlopen fails
Previously, we were printing only the name of the library that we failed to
open. Now, we also print the underlying cause for the failure, (as reported
by dlerror).
Carl Worth [Thu, 22 Aug 2013 00:28:49 +0000 (17:28 -0700)]
Use "gcc --print-multiarch" to determine directory names for library installs
Previously, we had hardcoded names of lib32 and lib64. Instead, we now
ask gcc for the actual triple being targeted, (such as, for example,
lib/i386-linux-gnu or lib/x86_64-linux-gnu).
Using these correct names means that the user of Glaze can put a
literal $LIB into LD_PRELOAD or LD_LIBRARY_PATH and the run-time
linker will expand that to the correct name based on the architecture
of the program being linked
Carl Worth [Thu, 22 Aug 2013 00:15:41 +0000 (17:15 -0700)]
Don't compile 32- or 64-bit components when not supported
The configure script is already kind enough to detect whether we can
compile 32-bit- or 64-bit-specific components. Now, fix the Makefile
to actually pay attention and not try to compile something which we
know will not work.
Carl Worth [Mon, 12 Aug 2013 21:09:58 +0000 (14:09 -0700)]
Add a new libglaze library
So far this is simply a glaze_lookup function which uses GLAZE_LIBGL
to find libGL.so, then does a dlopen on that, and then a dlsym for the
function name of interest.
Carl Worth [Mon, 12 Aug 2013 20:18:37 +0000 (13:18 -0700)]
Add a configure script
The primary motivation is a new install target. And it's just plain
rude to provide an install target without also supporting --prefix and
DESTDIR, so we need this simple configure script at least.
Carl Worth [Mon, 12 Aug 2013 19:22:00 +0000 (12:22 -0700)]
Rename glaze.c to glaze-gl.c
I'm planning to add a new glaze library with a "glaze.h" header file,
so it will be natural to have its implementation in glaze.c. To
prepare for that, I'm renaming the OpenGL API implementation from
glaze.c to glaze-gl.c.
Carl Worth [Mon, 29 Jul 2013 22:04:21 +0000 (15:04 -0700)]
Add a README file
Documenting how to set LD_LIBRARY_PATH, GLAZE_WRAPPER, and GLAZE_LIBGL
for invoking Glaze. Also giving credit to Alexander Monakov for
teaching me how to ue ifuncs.
Carl Worth [Mon, 29 Jul 2013 21:25:55 +0000 (14:25 -0700)]
Add GLAZE_WRAPPER variable to specify library with OpenGL wrapper functions
The GLAZE_WRAPPER environment variable should point to a library which
has symbols for some subset of the OpenGL API. For all such symbols,
Glaze will resolve its ifunc symbols to the wrapper functions. For all
functions not having symbols in the GLAZE_WRAPPER library, Glaze will
resolve its ifunc symbols to the functions in the GLAZE_LIBGL library.
Along with a script and Makefile to convert it to the list form
expected by glaze.c.
Note: The Makefile to perform the conversion is not called by
default. Instead, the result of the conversion (gl.def) is committed
directly to the source repository. This makes it convenient, (the
general user does not need to install xmlstarlet, for example), while
a developer that does need to update gl.xml can simply invoke "make
clean; make" in the specs directory to rebuild gl.def.