[Midnightbsd-cvs] mports: www/linuxpluginwrapper: add _dlsym(3) fix
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Tue Oct 7 23:58:53 EDT 2008
Log Message:
-----------
add _dlsym(3) fix
Modified Files:
--------------
mports/www/linuxpluginwrapper:
Makefile (r1.5 -> r1.6)
pkg-message (r1.2 -> r1.3)
Added Files:
-----------
mports/www/linuxpluginwrapper/files:
patch-compat_glibc-linux_dynamic.c (r1.1)
-------------- next part --------------
Index: pkg-message
===================================================================
RCS file: /home/cvs/mports/www/linuxpluginwrapper/pkg-message,v
retrieving revision 1.2
retrieving revision 1.3
diff -L www/linuxpluginwrapper/pkg-message -L www/linuxpluginwrapper/pkg-message -u -r1.2 -r1.3
--- www/linuxpluginwrapper/pkg-message
+++ www/linuxpluginwrapper/pkg-message
@@ -3,11 +3,6 @@
Flash7 support is unstable. I know well that there are often
crashes or freezes with flash7.
-Please get and apply a dlsym(3) hook patch.
- http://people.FreeBSD.org/~nork/rtld_dlsym_hack.diff
-This provides _dlsym(3) function to fix dynamic-link
-error "can't find gtk_major_version" ad-hoc-ly.
-
I don't set the default to use flash7. Please set-up your
enviroment(ln -s, apply patch to rtld,...).
Index: Makefile
===================================================================
RCS file: /home/cvs/mports/www/linuxpluginwrapper/Makefile,v
retrieving revision 1.5
retrieving revision 1.6
diff -L www/linuxpluginwrapper/Makefile -L www/linuxpluginwrapper/Makefile -u -r1.5 -r1.6
--- www/linuxpluginwrapper/Makefile
+++ www/linuxpluginwrapper/Makefile
@@ -8,7 +8,7 @@
PORTNAME= linuxpluginwrapper
PORTVERSION= 20051113
-PORTREVISION= 6
+PORTREVISION= 7
CATEGORIES= www linux emulators
MASTER_SITES= http://people.FreeBSD.org/~nork/distfiles/ \
${MASTER_SITE_LOCAL}
@@ -16,6 +16,7 @@
MAINTAINER= ports at MidnightBSD.org
COMMENT= A wrapper allowing use of linux-plugins with native applications
+LICENSE= bsd2
OPTIONS= REALPLAYER "install linux-realplayer" off \
ACROREAD "install acroread7" off
--- /dev/null
+++ www/linuxpluginwrapper/files/patch-compat_glibc-linux_dynamic.c
@@ -0,0 +1,96 @@
+--- compat_glibc/linux_dynamic.c.orig Sun Oct 17 12:45:23 2004
++++ compat_glibc/linux_dynamic.c Sun Jan 28 22:09:17 2007
+@@ -1,5 +1,5 @@
+ /*-
+- * Copyright (c) 2004 Norikatsu Shigemura
++ * Copyright (c) 2006 Sean Farley
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+@@ -23,38 +23,68 @@
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+- * $Id: linux_dynamic.c,v 1.1 2004/10/17 03:45:23 nork Exp $
++ * $Id$
+ */
+
+ #include "pluginwrapper.h"
+ #include "linux.h"
+-#include <stddef.h>
+ #include <dlfcn.h>
+-#include <string.h>
++#include <err.h>
++#include <stdlib.h>
++
++static const char LibGtk[] = "libgtk-x11-2.0.so.0";
++
++static void *libGtkHandle;
++
++/*
++ * Initialize handle to libgtk-x11-2.0.
++ */
++static void __attribute__((constructor)) init_lib(void)
++{
++ libGtkHandle = dlopen(LibGtk, RTLD_LAZY | RTLD_LOCAL);
++ if (libGtkHandle == NULL) {
++ errx(EXIT_FAILURE, "dlopen(\"%s\"): %s", LibGtk, dlerror());
++ }
++
++ return;
++}
+
+-extern unsigned int gtk_major_version;
+
+ /*
+- * dlsym(3)
++ * Deinitialize handle to libgtk-x11-2.0.
+ */
+-void *_dlsym(void *, const char *);
++static void __attribute__((constructor)) deinit_lib(void)
++{
++ if (libGtkHandle != NULL && dlclose(libGtkHandle) != 0) {
++ errx(EXIT_FAILURE, "dlclose(%p): %s", libGtkHandle, dlerror());
++ }
++
++ return;
++}
++
+
++/*
++ * dlsym(3) using dlfunc(3) to avoid difficulty of locating original dlsym().
++ */
+ void *
+ dlsym(void *handle, const char *symbol)
+ {
+- void *ret;
+-
+- if( handle == NULL && strcmp(symbol, "gtk_major_version") == 0 ) {
+- ret = >k_major_version;
+- dprintf("gtk_major_version = %d", gtk_major_version);
+- } else {
+- ret = _dlsym(handle, symbol);
+- }
++ void *sym;
+
+- dprintf("dlsym(handle='%s', symbol='%s') = %p", handle, symbol, ret);
+- if( ret == NULL ) {
+- dprintf("dlerror=%s", dlerror());
++ /* Find desired symbol. */
++ sym = dlfunc(handle, symbol);
++ if (sym == NULL) {
++ dprintf("dlfunc(%p, %s): %s", handle, symbol, dlerror());
++
++ /* Attempt another search using libgtk-x11-2.0. */
++ if (handle == NULL) {
++ sym = dlfunc(libGtkHandle, symbol);
++ if (sym == NULL)
++ dprintf("dlfunc(%p, %s): %s", handle, symbol,
++ dlerror());
++ }
+ }
++ dprintf("dlsym(%p, %s) = %p", handle, symbol, sym);
+
+- return ret;
++ return (sym);
+ }
More information about the Midnightbsd-cvs
mailing list