NetBSD Problem Report #47208

From www@NetBSD.org  Sat Nov 17 14:38:45 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id D7F8663E7E9
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 17 Nov 2012 14:38:44 +0000 (UTC)
Message-Id: <20121117143843.C365063E7E9@www.NetBSD.org>
Date: Sat, 17 Nov 2012 14:38:43 +0000 (UTC)
From: o.vd.linden@quicknet.nl
Reply-To: o.vd.linden@quicknet.nl
To: gnats-bugs@NetBSD.org
Subject: nspluginwrapper 1.4.4 package 
X-Send-Pr-Version: www-1.0

>Number:         47208
>Category:       pkg
>Synopsis:       nspluginwrapper 1.4.4 package
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    abs
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 17 14:40:00 +0000 2012
>Last-Modified:  Sun Nov 18 19:50:47 +0000 2012
>Originator:     Onno van der Linden
>Release:        6.99.14 i386
>Organization:
>Environment:
NetBSD sheep 6.99.14 NetBSD 6.99.14 (SHEEP) #0: Sat Nov  3 13:13:20 MET 2012  onno@sheep:/usr/src/sys/arch/i386/compile/SHEEP i386
>Description:
1.2.2 is the nspluginwrapper used in pkgsrc. Way more stable version 1.4.4 of nspluginwrapper has been available since July 2011. Here's my packaged version of it which contains a hack to work around the usage of anonymous sockets in the linux npviewer.bin
binary.
>How-To-Repeat:

>Fix:
shar archive with my pkgsrc sources voor nspluginwrapper 1.4.4 will be in a followup mail

>Release-Note:

>Audit-Trail:
From: Onno van der Linden <o.vd.linden@quicknet.nl>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/47208: nspluginwrapper 1.4.4 package
Date: Sat, 17 Nov 2012 15:45:41 +0100

 Here's my attempt at creating a nspluginwrapper 1.4.4
 package. Works for me. Contains gross hack to work around
 anonymous socket use in npviewer.bin binary. This
 likely needs some cleanup but it should be an okay
 starting point.

 Onno
 # This is a shell archive.  Save it in a file, remove anything before
 # this line, and then unpack it by entering "sh file".  Note, it may
 # create directories; files and directories will be owned by you and
 # have default permissions.
 #
 # This archive contains:
 #
 #	DESCR
 #	Makefile
 #	PLIST
 #	distinfo
 #	files
 #	patches
 #	files/libnoanonsocket.c
 #	patches/patch-Makefile
 #	patches/patch-aa
 #	patches/patch-ab
 #	patches/patch-ac
 #	patches/patch-src_npw-player.c
 #	patches/patch-src_npw-wrapper.c
 #	patches/patch-src_rpc.c
 #	patches/patch-src_sysdeps.h
 #
 echo x - DESCR
 sed 's/^X//' >DESCR << 'END-of-DESCR'
 Xnspluginwrapper is an Open Source compatibility plugin for Netscape
 X4 (NPAPI) plugins. It separates the execution environment of the
 Xplugin from the browser, allowing a plugin compiled for one ABI to
 Xbe used in a browser compiled for another.
 X
 XFor example the linux 32bit Adobe Flash plugin can be used in a
 Xnative Firefox under Linux/x86_64, NetBSD, DragonFlyBSD and FreeBSD
 Xplatforms.
 X
 XTo install the Linux flash player into a native Firefox browser:
 X  - Also install multimedia/ns-flash and multimedia/libflashsupport
 X  - Run "nspluginwrapper -i /usr/pkg/lib/netscape/plugins/libflashplayer.so"
 X  - Run Firefox
 X
 XYou do not need nspluginwrapper if the ABI of the plugin and browser are the
 Xsame, such as running a 32 bit Linux firefox and flash plugin under NetBSD.
 END-of-DESCR
 echo x - Makefile
 sed 's/^X//' >Makefile << 'END-of-Makefile'
 X# $NetBSD: Makefile,v 1.34 2012/10/28 06:30:24 asau Exp $
 X#
 X
 XDISTNAME=	nspluginwrapper-1.4.4
 XCATEGORIES=	www
 XMASTER_SITES=	http://nspluginwrapper.org/download/ \
 X		http://download.opensuse.org/distribution/12.1/repo/oss/suse/x86_64/ 
 XDISTFILES=	${DISTNAME}.tar.gz ${DISTNAME}-2.2.1.x86_64.rpm
 X
 XMAINTAINER=	abs@NetBSD.org
 XHOMEPAGE=	http://nspluginwrapper.org/
 XCOMMENT=	Use Netscape compatible plugins from other platforms
 XLICENSE=	gnu-gpl-v2
 X
 XEMUL_PLATFORMS=		linux-i386
 XEMUL_MODULES.linux=	base gtk2 x11
 XNOT_FOR_PLATFORM=	Linux-*-*
 X
 XHAS_CONFIGURE=		yes
 XUSE_LANGUAGES=		c c++
 XUSE_TOOLS+=		gmake pkg-config
 XCONFIGURE_ARGS+=	--prefix=${PREFIX}
 X
 XPLUGIN_SUBDIR=		lib/nspluginwrapper/i386/linux
 XPLUGIN_INSTDIR=		${PREFIX}/${PLUGIN_SUBDIR}
 XPLUGIN_SRCDIR=		${WRKDIR}/usr/${PLUGIN_SUBDIR}
 X
 XLDFLAGS.DragonFly=	-lgmodule-2.0
 X
 XSUBST_CLASSES+=		npviewer
 XSUBST_STAGE.npviewer=	post-build
 XSUBST_FILES.npviewer=	${PLUGIN_SRCDIR}/npviewer
 XSUBST_SED.npviewer=	-e "s|/usr/|${PREFIX}/|g"
 X
 XINSTALLATION_DIRS=	${PLUGIN_INSTDIR}
 X
 Xpost-extract:
 X	cp files/libnoanonsocket.c ${WRKDIR}/${DISTNAME}/src
 X
 Xpost-install:
 X	${INSTALL_LIB} ${PLUGIN_SRCDIR}/libnoxshm.so ${DESTDIR}${PLUGIN_INSTDIR}
 X	${INSTALL_LIB} ${WRKDIR}/${DISTNAME}/libnoanonsocket.so ${DESTDIR}${PLUGIN_INSTDIR}
 X	${INSTALL_SCRIPT} ${PLUGIN_SRCDIR}/npviewer ${DESTDIR}${PLUGIN_INSTDIR}
 X	${INSTALL_LIB} ${PLUGIN_SRCDIR}/npviewer.bin ${DESTDIR}${PLUGIN_INSTDIR}
 X
 X.include "../../devel/glib2/buildlink3.mk"
 X.include "../../www/curl/buildlink3.mk"
 X.include "../../x11/gtk2/buildlink3.mk"
 X.include "../../x11/libX11/buildlink3.mk"
 X.include "../../x11/libXt/buildlink3.mk"
 X.include "../../mk/bsd.pkg.mk"
 END-of-Makefile
 echo x - PLIST
 sed 's/^X//' >PLIST << 'END-of-PLIST'
 X@comment $NetBSD: PLIST,v 1.3 2009/01/05 19:11:24 jmcneill Exp $
 Xbin/nspluginplayer
 Xbin/nspluginwrapper
 Xlib/nspluginwrapper/${MACHINE_ARCH}/${LOWER_OPSYS}/npconfig
 Xlib/nspluginwrapper/${MACHINE_ARCH}/${LOWER_OPSYS}/npplayer
 Xlib/nspluginwrapper/${MACHINE_ARCH}/${LOWER_OPSYS}/npwrapper.so
 Xlib/nspluginwrapper/i386/linux/npviewer
 Xlib/nspluginwrapper/i386/linux/libnoanonsocket.so
 Xlib/nspluginwrapper/i386/linux/npviewer.bin
 Xlib/nspluginwrapper/noarch/npviewer.sh
 END-of-PLIST
 echo x - distinfo
 sed 's/^X//' >distinfo << 'END-of-distinfo'
 X$NetBSD$
 X
 XSHA1 (nspluginwrapper-1.4.4-2.2.1.x86_64.rpm) = 5165160126bc2d853aa03da68ff292c451cf7005
 XRMD160 (nspluginwrapper-1.4.4-2.2.1.x86_64.rpm) = 630136113810ac9eb9cf76611a52be898d606cdf
 XSize (nspluginwrapper-1.4.4-2.2.1.x86_64.rpm) = 160203 bytes
 XSHA1 (nspluginwrapper-1.4.4.tar.gz) = ffb271a741215874808d4a77d0a0dd65588a8440
 XRMD160 (nspluginwrapper-1.4.4.tar.gz) = 6acd93653aa8466e1e3703c2b794f32691c10d12
 XSize (nspluginwrapper-1.4.4.tar.gz) = 412513 bytes
 XSHA1 (patch-Makefile) = 103c8cd5403cb8895dc5096be9b9d978a71afce0
 XSHA1 (patch-aa) = 28f9e18e519337852cb47d04ed0c1cea76b3416d
 XSHA1 (patch-ab) = 20dc1b6ff4036a0946dd469860eb9b6c129fdb7a
 XSHA1 (patch-ac) = f85d793564dc23465c94e30af6d5c3c67bdee0e1
 XSHA1 (patch-src_npw-player.c) = d6f6ffa71e920b06710b24b1e31938056fb3d8e1
 XSHA1 (patch-src_npw-wrapper.c) = 6801b6817d5e85d0ed3f2548be247a657c98daa9
 XSHA1 (patch-src_rpc.c) = 00e41894abe3e3587d70c6398461dd8143faa5a3
 XSHA1 (patch-src_sysdeps.h) = 097cc04320f236b151e4685d742abaf0581108f5
 END-of-distinfo
 echo c - files
 mkdir -p files > /dev/null 2>&1
 echo c - patches
 mkdir -p patches > /dev/null 2>&1
 echo x - files/libnoanonsocket.c
 sed 's/^X//' >files/libnoanonsocket.c << 'END-of-files/libnoanonsocket.c'
 X#include <sys/socket.h>
 X#include <sys/types.h>
 X#include <stddef.h>
 X#include <dlfcn.h>
 X
 Xstruct osockaddr_un {
 X        uint16_t        sa_family;      /* address family */
 X        char            sun_path[108];    /* up to 108 bytes of direct address */
 X};
 X
 Xstruct rpc_connection {
 X  int type;
 X  int refcnt;
 X  int status;
 X  int socket;
 X  char *socket_path;
 X  struct osockaddr_un socket_addr;
 X  socklen_t socket_addr_len;
 X  int server_socket;
 X  int server_thread_active;
 X};
 X
 X
 Xint	(*bindfunc)(int, const struct sockaddr *, int) = NULL;
 X
 Xint bind(int sockfd, const struct sockaddr *my_addr, socklen_t addrlen)
 X{
 X	struct osockaddr_un	*sun;
 X
 X	if (bindfunc == NULL) {
 X		bindfunc = dlsym(RTLD_NEXT,"bind");
 X		if (bindfunc == NULL)
 X			return -1;
 X	}
 X	sun = (struct osockaddr_un *) my_addr;
 X	if (sun != NULL && sun->sa_family == AF_LOCAL && sun->sun_path[0] == '\0') {
 X		char	*p, *q;
 X		struct rpc_connection	*conn;
 X
 X		conn = (void *) my_addr - offsetof(struct rpc_connection, socket_addr);
 X		p = sun->sun_path;
 X		q = conn->socket_path;
 X		while (q[1]) {
 X			*q = q[1];
 X			*p = q[1];
 X			++q;
 X			++p;
 X		}
 X		*q = '\0';
 X		*p = '\0';
 X	}
 X	return bindfunc(sockfd, my_addr, addrlen);
 X}
 END-of-files/libnoanonsocket.c
 echo x - patches/patch-Makefile
 sed 's/^X//' >patches/patch-Makefile << 'END-of-patches/patch-Makefile'
 X--- Makefile.orig	2011-07-01 05:18:57.000000000 +0200
 X+++ Makefile	2012-11-17 11:32:25.000000000 +0100
 X@@ -151,6 +151,12 @@
 X libnoxshm_CFLAGS  = $(CFLAGS_32) $(PIC_CFLAGS)
 X libnoxshm_LDFLAGS = $(LDFLAGS_32)
 X 
 X+libnoanonsocket_LIBRARY = libnoanonsocket.so
 X+libnoanonsocket_RAWSRCS = libnoanonsocket.c
 X+libnoanonsocket_SOURCES = $(libnoanonsocket_RAWSRCS:%.c=$(SRC_PATH)/src/%.c)
 X+libnoanonsocket_OBJECTS = $(libnoanonsocket_RAWSRCS:%.c=libnoanonsocket-%.o)
 X+libnoanonsocket_CFLAGS  = $(CFLAGS_32) $(PIC_CFLAGS)
 X+
 X npconfig_PROGRAM = npconfig
 X npconfig_RAWSRCS = npw-config.c
 X npconfig_SOURCES = $(npconfig_RAWSRCS:%.c=$(SRC_PATH)/src/%.c)
 X@@ -193,6 +199,7 @@
 X TARGETS		= $(npconfig_PROGRAM)
 X TARGETS		+= $(nploader_PROGRAM)
 X TARGETS		+= $(npwrapper_LIBRARY)
 X+TARGETS		+= $(libnoanonsocket_LIBRARY)
 X ifeq ($(build_viewer),yes)
 X TARGETS		+= $(npviewer_PROGRAM)
 X TARGETS		+= $(libnoxshm_LIBRARY)
 X@@ -323,6 +330,12 @@
 X libnoxshm-%.o: $(SRC_PATH)/src/%.c
 X 	$(CC) -o $@ -c $< $(CPPFLAGS) $(libnoxshm_CFLAGS)
 X 
 X+$(libnoanonsocket_LIBRARY): $(libnoanonsocket_OBJECTS)
 X+	$(LD) $(DSO_LDFLAGS) -o $@ $(libnoanonsocket_OBJECTS)
 X+
 X+libnoanonsocket-%.o: $(SRC_PATH)/src/%.c
 X+	$(CC) -o $@ -c $< $(CPPFLAGS) $(libnoxshm_CFLAGS)
 X+
 X $(npconfig_PROGRAM): $(npconfig_OBJECTS)
 X 	$(CC) $(npconfig_LDFLAGS) -o $@ $(npconfig_OBJECTS) $(npconfig_LIBS)
 X 
 END-of-patches/patch-Makefile
 echo x - patches/patch-aa
 sed 's/^X//' >patches/patch-aa << 'END-of-patches/patch-aa'
 X$NetBSD: patch-aa,v 1.5 2008/12/18 19:59:31 jmcneill Exp $
 X
 X--- src/npw-config.c.orig	2009-09-16 11:05:23.000000000 +0100
 X+++ src/npw-config.c
 X@@ -125,22 +125,15 @@ static const char *get_system_mozilla_pl
 X 	  };
 X 	  dirs = freebsd_dirs;
 X 	}
 X-#elif defined(__DragonFly__)
 X+#elif defined(__NetBSD__) || defined(__DragonFly__)
 X 	{
 X 	  static const char *dragonfly_dirs[] = {
 X-		"/usr/pkg/" LIB "/mozilla/plugins",
 X-		"/usr/pkg/" LIB "/firefox/plugins",
 X+		LIBDIR "/netscape/plugins",
 X+		LIBDIR "/firefox/plugins",
 X+		LIBDIR "/seamonkey/plugins",
 X 	  };
 X 	  dirs = dragonfly_dirs;
 X 	}
 X-#elif defined(__NetBSD__)
 X-	{
 X-	  static const char *netbsd_dirs[] = {
 X-		"/usr/pkg/" LIB "/mozilla/plugins",
 X-		"/usr/pkg/" LIB "/firefox/plugins",
 X-	  };
 X-	  dirs = netbsd_dirs;
 X-	}
 X #elif defined(__sun__)
 X 	{
 X 	  static const char *solaris_dirs[] = {
 X@@ -223,16 +216,11 @@ static const char **get_mozilla_plugin_d
 X 	"/usr/local/lib/npapi/linux-flashplugin",
 X 	"/usr/X11R6/Adobe/Acrobat7.0/ENU/Browser/intellinux",
 X #endif
 X-#if defined(__DragonFly__)
 X+#if defined(__NetBSD__) || defined(__DragonFly__)
 X 	"/usr/pkg/lib/netscape/plugins",
 X 	"/usr/pkg/lib/firefox/plugins",
 X-	"/usr/pkg/lib/RealPlayer/mozilla",
 X-	"/usr/pkg/Acrobat5/Browsers/intellinux",
 X-	"/usr/pkg/Acrobat7/Browser/intellinux",
 X-#endif
 X-#if defined(__NetBSD__)
 X 	"/usr/pkg/lib/netscape/plugins",
 X-	"/usr/pkg/lib/firefox/plugins",
 X+	"/usr/pkg/lib/seamonkey/plugins",
 X 	"/usr/pkg/lib/RealPlayer/mozilla",
 X 	"/usr/pkg/Acrobat5/Browsers/intellinux",
 X 	"/usr/pkg/Acrobat7/Browser/intellinux",
 END-of-patches/patch-aa
 echo x - patches/patch-ab
 sed 's/^X//' >patches/patch-ab << 'END-of-patches/patch-ab'
 X$NetBSD$
 X
 X--- src/utils.c.orig	2008-12-06 15:16:38.000000000 -0500
 X+++ src/utils.c
 X@@ -19,6 +19,7 @@
 X  */
 X 
 X #define _GNU_SOURCE 1
 X+#define _NETBSD_SOURCE 1
 X #include "sysdeps.h"
 X 
 X #include <stdio.h>
 END-of-patches/patch-ab
 echo x - patches/patch-ac
 sed 's/^X//' >patches/patch-ac << 'END-of-patches/patch-ac'
 X$NetBSD: patch-ac,v 1.3 2011/01/20 13:06:15 pooka Exp $
 X
 X--- src/npw-viewer.sh.orig	2008-12-14 12:24:19.000000000 +0100
 X+++ src/npw-viewer.sh	2011-01-19 12:20:26.000000000 +0100
 X@@ -83,6 +83,13 @@
 X NPW_USE_VALGRIND=${NPW_USE_VALGRIND:-no}
 X can_use_valgrind="no"
 X 
 X+case $OS in
 X+freebsd|netbsd)
 X+    LD_PRELOAD=${NPW_VIEWER_DIR}/libnoanonsocket.so
 X+    export LD_PRELOAD
 X+    ;;
 X+esac
 X+
 X if test "$ARCH" != "$TARGET_ARCH"; then
 X     case $TARGET_ARCH in
 X     i386)
 END-of-patches/patch-ac
 echo x - patches/patch-src_npw-player.c
 sed 's/^X//' >patches/patch-src_npw-player.c << 'END-of-patches/patch-src_npw-player.c'
 X$NetBSD$
 X
 XAdapt for glib-2.32.
 X
 X--- src/npw-player.c.orig	2009-01-02 08:54:10.000000000 +0000
 X+++ src/npw-player.c
 X@@ -24,8 +24,6 @@
 X #include <dlfcn.h>
 X #include <unistd.h>
 X #include <glib.h>
 X-#include <glib/gstdio.h>
 X-#include <glib/gthread.h>
 X #include <gtk/gtk.h>
 X #include <gdk/gdkx.h>
 X #include <gdk/gdkkeysyms.h>
 END-of-patches/patch-src_npw-player.c
 echo x - patches/patch-src_npw-wrapper.c
 sed 's/^X//' >patches/patch-src_npw-wrapper.c << 'END-of-patches/patch-src_npw-wrapper.c'
 X--- src/npw-wrapper.c.orig	2012-11-14 16:01:37.000000000 +0100
 X+++ src/npw-wrapper.c	2012-11-14 16:00:38.000000000 +0100
 X@@ -3863,9 +3863,15 @@
 X 	return;
 X 
 X   char *connection_path =
 X+#ifdef __linux__
 X 	g_strdup_printf("%s/%s/%d-%d/%ld",
 X 					NPW_CONNECTION_PATH, plugin_file_name,
 X 					getpid(), init_count, random());
 X+#else
 X+	g_strdup_printf("%s_%s_%d-%d_%ld",
 X+					NPW_CONNECTION_PATH, plugin_file_name,
 X+					getpid(), init_count, random());
 X+#endif
 X 
 X   // Start plug-in viewer
 X   if ((g_plugin.viewer_pid = fork()) == 0) {
 END-of-patches/patch-src_npw-wrapper.c
 echo x - patches/patch-src_rpc.c
 sed 's/^X//' >patches/patch-src_rpc.c << 'END-of-patches/patch-src_rpc.c'
 X--- src/rpc.c.orig	2011-07-01 05:18:57.000000000 +0200
 X+++ src/rpc.c	2012-11-17 12:14:16.000000000 +0100
 X@@ -609,16 +609,7 @@
 X #if USE_ANONYMOUS_SOCKETS
 X   n = 0;
 X #else
 X-#if 0
 X-  char *tmpdir = getenv("TMPDIR");
 X-  if (tmpdir == NULL)
 X-	tmpdir = "/tmp";
 X-#else
 X-  // XXX don't use TMPDIR because the length of the resulting path
 X-  // could exceed the size of sun_path[] (typically 108 bytes on Linux)
 X-  char *tmpdir = "/tmp";
 X-#endif
 X-  n = strlen(tmpdir);
 X+  n = -1;
 X #endif
 X 
 X   len = strlen(ident);
 X@@ -630,14 +621,8 @@
 X   strcpy(&path[1], ident);
 X   n = 1 + len;
 X #else
 X-  n = sprintf(path, "%s/", tmpdir);
 X-  for (int i = 0; i < len; i++) {
 X-    char ch = ident[i];
 X-    if (ch == '/')
 X-      ch = '_';
 X-    path[n++] = ch;
 X-  }
 X-  path[n] = '\0';
 X+  strcpy(path, ident);
 X+  n = len;
 X #endif
 X 
 X   if (*pathp)
 END-of-patches/patch-src_rpc.c
 echo x - patches/patch-src_sysdeps.h
 sed 's/^X//' >patches/patch-src_sysdeps.h << 'END-of-patches/patch-src_sysdeps.h'
 X--- src/sysdeps.h.orig	2012-11-14 15:58:12.000000000 +0100
 X+++ src/sysdeps.h	2012-11-14 15:58:23.000000000 +0100
 X@@ -40,7 +40,11 @@
 X #include <limits.h>
 X 
 X // NSPluginWrapper paths and identification strings
 X+#ifdef __linux__
 X #define NPW_CONNECTION_PATH "/org/wrapper/NSPlugins"
 X+#else
 X+#define NPW_CONNECTION_PATH "/tmp/_org_wrapper_NSPlugins"
 X+#endif
 X #define NPW_VIEWER_BASE "npviewer"
 X #define NPW_VIEWER NPW_VIEWER_BASE
 X #define NPW_WRAPPER_BASE "npwrapper"
 END-of-patches/patch-src_sysdeps.h
 exit

Responsible-Changed-From-To: pkg-manager->abs
Responsible-Changed-By: hauke@NetBSD.org
Responsible-Changed-When: Sun, 18 Nov 2012 19:50:47 +0000
Responsible-Changed-Why:
Over to maintainer.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.