Build a wrapper lib with weak symbols.
authorSimon 'corecode' Schubert <corecode@fs.ei.tum.de>
Sun, 18 May 2008 16:25:22 +0000 (18:25 +0200)
committerSimon 'corecode' Schubert <corecode@fs.ei.tum.de>
Sun, 18 May 2008 16:25:22 +0000 (18:25 +0200)
obj/wraplib/Makefile [new file with mode: 0644]
obj/wrapmodule/Makefile [moved from obj/wrap/Makefile with 100% similarity]
obj/wrapmodule/exportsyms.c [moved from obj/wrap/exportsyms.c with 100% similarity]
obj/wrapmodule/wrapmodule.c [moved from obj/wrap/wrapmodule.c with 100% similarity]

diff --git a/obj/wraplib/Makefile b/obj/wraplib/Makefile
new file mode 100644 (file)
index 0000000..612d14f
--- /dev/null
@@ -0,0 +1,26 @@
+SHLIB_NAME= libGL.so.1
+SRCS=  dummyGL.c ${.CURDIR}/../wrapmodule/exportsyms.c
+NOMAN=
+
+LDADD= libGL.so.wrapped
+
+all: libGL.so.wrapped
+
+CLEANFILES+=   dummyGL.c null.c libGL.so.wrapped
+
+dummyGL.c: ../libGL.so.1
+       objdump -T $> | awk '\
+               BEGIN { \
+                       print "#include <sys/cdefs.h>"; \
+                       print "#include <stdlib.h>"; \
+                       print "static __used void dummy(void) { abort(); }"; \
+               }; \
+               $$2 == "g" && $$6 !~ /^_/ { \
+                       print "__weak_reference(dummy, "$$6");"; \
+               }' > $@
+
+libGL.so.wrapped:
+       > null.c
+       cc -shared -o $@ null.c
+
+.include <bsd.lib.mk>
similarity index 100%
rename from obj/wrap/Makefile
rename to obj/wrapmodule/Makefile