Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorvald Natvig <slicer@users.sourceforge.net>2007-07-14 19:29:07 +0400
committerThorvald Natvig <slicer@users.sourceforge.net>2007-07-14 19:29:07 +0400
commite13024ee13ace96b6c792e362b5e9cadc2a823f8 (patch)
treee4fdc44f4952c437bfb8d55c6dbcdcce69281fb8 /overlay_gl
parentc3d703301b91df3589ffb97434bc5dd503cb4665 (diff)
Keep just the LD_PRELOAD overlay
git-svn-id: https://mumble.svn.sourceforge.net/svnroot/mumble/trunk@594 05730e5d-ab1b-0410-a4ac-84af385074fa
Diffstat (limited to 'overlay_gl')
-rw-r--r--overlay_gl/Makefile41
-rw-r--r--overlay_gl/overlay.c49
-rw-r--r--overlay_gl/overlay_gl.pro19
3 files changed, 46 insertions, 63 deletions
diff --git a/overlay_gl/Makefile b/overlay_gl/Makefile
deleted file mode 100644
index 7690d9a51..000000000
--- a/overlay_gl/Makefile
+++ /dev/null
@@ -1,41 +0,0 @@
-CXX = gcc
-ORIGLIB = /usr/lib/libGL.so.1
-
-debug: ALL
-
-release: ALL
-
-ALL: libGL.so.1 libmumble.so.1
-
-%.o: %.c
- $(CXX) -c -pipe -O2 -Wall -W -fPIC -fvisibility=hidden -o $@ $^
-
-%_p.o: %.c
- $(CXX) -c -pipe -O2 -Wall -W -fPIC -fvisibility=hidden -DPRELOAD -o $@ $^
-
-libGL.link.so.1: libGL.original.so.1 Makefile
- $(CXX) -shared -Wl,-soname,libGL.original.so.1 -o ./$@
-
-libGL.original.so.1: $(ORIGLIB)
- ln -sf $^ $@
-
-libGL.so.1: overlay.o libGL.link.so.1
- $(CXX) -shared -Wl,-soname,$@ -o $@ $^ -lrt
- strip $@
-
-libmumble.so.1: overlay_p.o
- $(CXX) -shared -Wl,-soname,$@ -o $@ $^ -lrt -ldl
- strip $@
-
-clean:
- -rm -f *~ *.o *.so.1
-distclean: clean
-
-indent:
- indent -kr -l999 overlay.c
-
-test: libGL.so.1
- LD_LIBRARY_PATH=$$(pwd):$$LD_LIBRARY_PATH glxgears
-
-quake: libGL.so.1
- LD_LIBRARY_PATH=$$(pwd):$$LD_LIBRARY_PATH quake4-demo
diff --git a/overlay_gl/overlay.c b/overlay_gl/overlay.c
index ab1cdc704..91a5d10f7 100644
--- a/overlay_gl/overlay.c
+++ b/overlay_gl/overlay.c
@@ -62,6 +62,8 @@ static void ods(const char *format, ...);
static struct SharedMem *sm = NULL;
static sem_t *sem = NULL;
+static bool bDebug;
+
typedef struct _Context {
struct _Context *next;
Display *dpy;
@@ -111,8 +113,12 @@ static void resolveSM()
__attribute__ ((format(printf, 1, 2)))
void ods(const char *format, ...)
{
- if (sm && !sm->bDebug)
+ if (sm) {
+ if (!sm->bDebug)
+ return;
+ } else if (!bDebug) {
return;
+ }
va_list args;
va_start(args, format);
@@ -395,34 +401,35 @@ __GLXextFuncPtr glXGetProcAddressARB(const GLubyte * func)
}
__attribute__ ((constructor))
-void initializeLibrary() {
+void initializeLibrary()
+{
if (odlsym)
- return;
+ return;
-#ifdef PRELOAD
- printf("Library is HOT\n");
- void *dl = dlopen("libdl.so.2", RTLD_LAZY);
- if (!dl) {
- ods("Failed to open libdl.so.2\n");
- } else {
- odlsym = (__typeof__(&dlsym)) __libc_dlsym(dl, "dlsym");
- }
-#else
- odlsym = &dlsym;
-#endif
+ if (getenv("MUMBLE_OVERLAY_DEBUG"))
+ bDebug = true;
+ else
+ bDebug = false;
+
+ ods("Library is HOT\n");
+ void *dl = dlopen("libdl.so.2", RTLD_LAZY);
+ if (!dl) {
+ ods("Failed to open libdl.so.2\n");
+ } else {
+ odlsym = (__typeof__(&dlsym)) __libc_dlsym(dl, "dlsym");
+ }
}
-#ifdef PRELOAD
#define OGRAB(name) if (handle == RTLD_DEFAULT) handle = RTLD_NEXT; symbol = odlsym(handle, #name); if (symbol) { o##name = (__typeof__(&name)) symbol; symbol = (void *) name;}
__attribute__ ((visibility("default")))
void *dlsym(void *handle, const char *name)
{
- if (! odlsym)
- initializeLibrary();
+ if (!odlsym)
+ initializeLibrary();
void *symbol;
-
- printf("Request for symbol %s (%p)\n", name, odlsym);
+
+ ods("Request for symbol %s (%p)\n", name, odlsym);
if (strcmp(name, "glXSwapBuffers") == 0) {
OGRAB(glXSwapBuffers);
@@ -431,9 +438,7 @@ void *dlsym(void *handle, const char *name)
} else if (strcmp(name, "glXGetProcAddressARB") == 0) {
OGRAB(glXGetProcAddressARB);
} else {
- symbol = odlsym(handle, name);
+ symbol = odlsym(handle, name);
}
- printf("Returning %p\n", symbol);
return symbol;
}
-#endif
diff --git a/overlay_gl/overlay_gl.pro b/overlay_gl/overlay_gl.pro
new file mode 100644
index 000000000..fc6d6d47e
--- /dev/null
+++ b/overlay_gl/overlay_gl.pro
@@ -0,0 +1,19 @@
+# Simple project file to build Speex with same compilers
+# as Qt used.
+
+TEMPLATE = lib
+CONFIG -= qt
+CONFIG += debug_and_release
+TARGET = mumble
+VERSION = 1.0.0
+SOURCES = overlay.c
+LIBS += -lrt -ldl
+QMAKE_CFLAGS += -fvisibility=hidden
+
+CONFIG(debug, debug|release) {
+ DESTDIR = ../debug
+}
+
+CONFIG(release, debug|release) {
+ DESTDIR = ../release
+}