Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Jun 2003 19:22:42 +0900 (JST)
From:      Norikatsu Shigemura <nork@FreeBSD.org>
To:        ports@FreeBSD.org
Cc:        marcus@FreeBSD.org
Subject:   Linux Plugin Wrapper (Upgrade from Linux Flash Plugin Wrapper)
Message-ID:  <200306151022.h5FAMg1I038752@nd250009.gab.xdsl.ne.jp>

next in thread | raw e-mail | index | archive | help
Hi Linux Flash Plugin Wrapper User!

	I recieved a report about Linux RealPlayer Plugin from Takahiro
	Igarashi.  We can use Linux RealPlayer Plugin with native mozilla.
	I made a port for this included new feature.  Please test this port.
	But, it's MIME type was registed audio/x-pn-realaudio-plugin.
	I don't know how to s/-plugin// :-(.  And, we should think how
	to include mozilla's run-script and mplayerplugin(disable real
	feature).  Please teach me solves.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# 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:
#
#	linuxpluginwrapper
#	linuxpluginwrapper/Makefile
#	linuxpluginwrapper/files
#	linuxpluginwrapper/files/linux-ioctl.h
#	linuxpluginwrapper/files/pkg-message.in
#	linuxpluginwrapper/files/pluginwrapper.c
#	linuxpluginwrapper/pkg-descr
#	linuxpluginwrapper/pkg-plist
#
echo c - linuxpluginwrapper
mkdir -p linuxpluginwrapper > /dev/null 2>&1
echo x - linuxpluginwrapper/Makefile
sed 's/^X//' >linuxpluginwrapper/Makefile << 'END-of-linuxpluginwrapper/Makefile'
X# New ports collection makefile for:	linuxpluginwrapper
X# Date Created:				2003-06-15
X# Whom:					nork@FreeBSD.org
X#
X# $FreeBSD$
X#
X
XPORTNAME=	linuxpluginwrapper
XPORTVERSION=	20030615
XCATEGORIES=	www linux
XMASTER_SITES=	# none
XDISTFILES=	# none
X
XMAINTAINER=	nork@FreeBSD.org
XCOMMENT=	A wrapper allowing use of linux-plugin with native mozilla
X
XRUN_DEPENDS+=	${LOCALBASE}/lib/flash/libflashplayer.so:${PORTSDIR}/www/linux-flashplugin
XRUN_DEPENDS+=	${LOCALBASE}/lib/RealPlayer8/rpnp.so:${PORTSDIR}/multimedia/linux-realplayer
X
XNO_WRKSUBDIR=	YES
X
XUSE_XLIB=	yes
XONLY_FOR_ARCHS=	i386
XPKGMESSAGE=	${WRKDIR}/pkg-message
X
X.include <bsd.port.pre.mk>
X
X.ifdef	WITH_JAVA
XUSE_GCC=	3.2+
Xpre-everything:
X	@${ECHO_MSG} Please complie mozilla with USE_GCC=3.2.
X.if defined(USE_GCC) && ${USE_GCC} == 3.2+ && ${OSVERSION} < 500039
XCC=             gcc32
XCXX=            g++32
XBUILD_DEPENDS+= gcc32:${PORTSDIR}/lang/gcc32
XMAKE_ENV+=      CC=${CC} CXX=${CXX}
X.endif
X.else
Xpre-everything:
X	@${ECHO_MSG} "If you use native java plugin on 4-stable (this limitaion"
X	@${ECHO_MSG} "was brought by java/jdk13), please compile with USE_JAVA"
X	@${ECHO_MSG} "and mozilla with USE_GCC=3.2."
X.endif
X
Xdo-fetch:
X	@${DO_NADA}
X
Xdo-build:
X	${CC} -shared -o ${WRKSRC}/pluginwrapper.so \
X		-fpic ${CFLAGS} ${PTHREAD_CFLAGS} -I${FILESDIR} \
X		${FILESDIR}/pluginwrapper.c \
X		-L${X11BASE}/lib -R${X11BASE}/lib -lXt
X
Xdo-install:
X	${INSTALL_DATA} ${WRKSRC}/pluginwrapper.so ${PREFIX}/lib/
X	@${SED} -e 's,%%PREFIX%%,${PREFIX},' \
X		-e 's,%%LOCALBASE%%,${LOCALBASE},' \
X		-e 's,%%X11BASE%%,${X11BASE},' \
X		${FILESDIR}/pkg-message.in > ${PKGMESSAGE}
X	@${LN} -sf ${PREFIX}/lib/flash/ShockwaveFlash.class  ${X11BASE}/lib/browser_plugins/
X	@${LN} -sf ${PREFIX}/lib/flash/libflashplayer.so     ${X11BASE}/lib/browser_plugins/
X	@${LN} -sf ${PREFIX}/lib/RealPlayer8/rpnp.so         ${X11BASE}/lib/browser_plugins/
X	@${LN} -sf ${PREFIX}/lib/RealPlayer8/raclass.zip     ${X11BASE}/lib/browser_plugins/
X	@${CAT} ${PKGMESSAGE}
X
X.include <bsd.port.post.mk>
END-of-linuxpluginwrapper/Makefile
echo c - linuxpluginwrapper/files
mkdir -p linuxpluginwrapper/files > /dev/null 2>&1
echo x - linuxpluginwrapper/files/linux-ioctl.h
sed 's/^X//' >linuxpluginwrapper/files/linux-ioctl.h << 'END-of-linuxpluginwrapper/files/linux-ioctl.h'
X/*-
X * Copyright (c) 2002-2003 Norikatsu Shigemura
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X *    notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X *    notice, this list of conditions and the following disclaimer in the
X *    documentation and/or other materials provided with the distribution.
X *
X * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X * SUCH DAMAGE.
X *
X */
X
X#ifndef	__LINUX_IOCTL__
X#define	__LINUX_IOCTL__
X
X
X/******************************************************************************/
X#if	defined(__i386__)
X
X#define	_LINUX_IOC_NRBITS	8
X#define	_LINUX_IOC_TYPEBITS	8
X#define	_LINUX_IOC_SIZEBITS	14
X#define	_LINUX_IOC_DIRBITS	2
X
X#else
X
X#error	NOT SUPPORT ARCHITECTURE
X
X#endif
X
X
X/******************************************************************************/
X#define	_LINUX_IOC_NRMASK	( (1 << _IOC_NRBITS  ) - 1 )
X#define	_LINUX_IOC_TYPEMASK	( (1 << _IOC_TYPEBITS) - 1 )
X#define	_LINUX_IOC_SIZEMASK	( (1 << _IOC_SIZEBITS) - 1 )
X#define	_LINUX_IOC_DIRMASK	( (1 << _IOC_DIRBITS ) - 1 )
X
X#define	_LINUX_IOC_NRSHIFT	0
X#define	_LINUX_IOC_TYPESHIFT	(_LINUX_IOC_NRSHIFT   + _LINUX_IOC_NRBITS)
X#define	_LINUX_IOC_SIZESHIFT	(_LINUX_IOC_TYPESHIFT + _LINUX_IOC_TYPEBITS)
X#define	_LINUX_IOC_DIRSHIFT	(_LINUX_IOC_SIZESHIFT + _LINUX_IOC_SIZEBITS)
X
X#define	_LINUX_IOC_NONE		0U
X#define	_LINUX_IOC_WRITE	1U
X#define	_LINUX_IOC_READ		2U
X
X
X/******************************************************************************/
X#define	_LINUX_IOC(dir, type, nr, size)		\
X	(  ( (dir)  << _LINUX_IOC_DIRSHIFT  ) |	\
X	   ( (type) << _LINUX_IOC_TYPESHIFT ) |	\
X	   ( (nr)   << _LINUX_IOC_NRSHIFT   ) |	\
X	   ( (size) << _LINUX_IOC_SIZESHIFT )  )
X
X#define	_LINUX_IO(type, nr)			\
X		_LINUX_IOC(_LINUX_IOC_NONE,                  (type), (nr), 0)
X#define	_LINUX_IOR(type, nr, size)		\
X		_LINUX_IOC(_LINUX_IOC_READ,                  (type), (nr), sizeof(size))
X#define	_LINUX_IOW(type, nr, size)		\
X		_LINUX_IOC(_LINUX_IOC_WRITE,                 (type), (nr), sizeof(size))
X#define	_LINUX_IOWR(type, nr, size)		\
X		_LINUX_IOC(_LINUX_IOC_READ|_LINUX_IOC_WRITE, (type), (nr), sizeof(size))
X
X
X/******************************************************************************/
X#if	0
X
Xtypedef struct linux_audio_buf_info {
X	int		 fragments;
X	int		 fragstotal;
X	int		 fragsize;
X	int		 bytes;
X} linux_audio_buf_info;
X
Xtypedef	struct linux_count_info {
X	int		 bytes;
X	int		 blocks;
X	int		 ptr;
X} linux_count_info;
X
Xtypedef struct linux_buffmem_desc {
X	unsigned	*buffer;
X	int		 size;
X} linux_buffmem_desc;
X
X#else
X
X/* XXX: assume that Linux's 'struct linux_*' is same FreeBSD's one */
X
X#define	linux_audio_buf_info			audio_buf_info
X#define	linux_count_info			count_info
X#define	linux_buffmem_desc			buffmem_desc
X
X#endif
X
X
X/******************************************************************************/
X#define	LINUX_SNDCTL_DSP_RESET			_LINUX_IO  ('P',  0)
X#define	LINUX_SNDCTL_DSP_SYNC			_LINUX_IO  ('P',  1)
X#define	LINUX_SNDCTL_DSP_SPEED			_LINUX_IOWR('P',  2, int)
X#define	LINUX_SOUND_PCM_READ_RATE		_LINUX_IOR ('P',  2, int)
X#define	LINUX_SNDCTL_DSP_STEREO			_LINUX_IOWR('P',  3, int)
X#define	LINUX_SNDCTL_DSP_GETBLKSIZE		_LINUX_IOWR('P',  4, int)
X#define	LINUX_SOUND_PCM_READ_BITS		_LINUX_IOR ('P',  5, int)
X#define	LINUX_SNDCTL_DSP_SETFMT			_LINUX_IOWR('P',  5, int)
X#define	LINUX_SNDCTL_DSP_CHANNELS		_LINUX_IOWR('P',  6, int)
X#define	LINUX_SOUND_PCM_READ_CHANNELS		_LINUX_IOR ('P',  6, int)
X#define	LINUX_SOUND_PCM_WRITE_FILTER		_LINUX_IOWR('P',  7, int)
X#define	LINUX_SOUND_PCM_READ_FILTER		_LINUX_IOR ('P',  7, int)
X#define	LINUX_SNDCTL_DSP_POST			_LINUX_IO  ('P',  8)
X#define	LINUX_SNDCTL_DSP_SUBDIVIDE		_LINUX_IOWR('P',  9, int)
X#define	LINUX_SNDCTL_DSP_SETFRAGMENT		_LINUX_IOWR('P', 10, int)
X#define	LINUX_SNDCTL_DSP_GETFMTS		_LINUX_IOR ('P', 11, int)
X#define	LINUX_SNDCTL_DSP_GETOSPACE		_LINUX_IOR ('P', 12, linux_audio_buf_info)
X#define	LINUX_SNDCTL_DSP_GETISPACE		_LINUX_IOR ('P', 13, linux_audio_buf_info)
X#define	LINUX_SNDCTL_DSP_NONBLOCK		_LINUX_IO  ('P', 14)
X#define	LINUX_SNDCTL_DSP_GETCAPS		_LINUX_IOR ('P', 15, int)
X#define	LINUX_SNDCTL_DSP_GETTRIGGER		_LINUX_IOR ('P', 16, int)
X#define	LINUX_SNDCTL_DSP_SETTRIGGER		_LINUX_IOW ('P', 16, int)
X#define	LINUX_SNDCTL_DSP_GETIPTR		_LINUX_IOR ('P', 17, linux_count_info)
X#define	LINUX_SNDCTL_DSP_GETOPTR		_LINUX_IOR ('P', 18, linux_count_info)
X#define	LINUX_SNDCTL_DSP_MAPINBUF		_LINUX_IOR ('P', 19, linux_buffmem_desc)
X#define	LINUX_SNDCTL_DSP_MAPOUTBUF		_LINUX_IOR ('P', 20, linux_buffmem_desc)
X#define	LINUX_SNDCTL_DSP_SETSYNCRO		_LINUX_IO  ('P', 21)
X#define	LINUX_SNDCTL_DSP_SETDUPLEX		_LINUX_IO  ('P', 22)
X#define	LINUX_SNDCTL_DSP_GETODELAY		_LINUX_IOR ('P', 23, int)
X#define	LINUX_SNDCTL_DSP_PROFILE		_LINUX_IOW ('P', 23, int)
X#define	LINUX_SNDCTL_DSP_GETCHANNELMASK		_LINUX_IOWR('P', 64, int)
X#define	LINUX_SNDCTL_DSP_BIND_CHANNEL		_LINUX_IOWR('P', 65, int)
X#define	LINUX_SNDCTL_DSP_SETSPDIF		_LINUX_IOW ('P', 66, int)
X#define	LINUX_SNDCTL_DSP_GETSPDIF		_LINUX_IOR ('P', 67, int)
X
X
X/******************************************************************************/
X#define	DSP_DEVICE			"/dev/dsp"
X
X
X#endif	/* __LINUX_IOCTL__ */
END-of-linuxpluginwrapper/files/linux-ioctl.h
echo x - linuxpluginwrapper/files/pkg-message.in
sed 's/^X//' >linuxpluginwrapper/files/pkg-message.in << 'END-of-linuxpluginwrapper/files/pkg-message.in'
XIf you are using a Mozilla browser, you first need to copy the linux
Xflash plugin into the mozilla plugins directory:
X
X# cp %%LOCALBASE%%/lib/flash/libflashplayer.so \
X    %%X11BASE%%/lib/browser_plugins/libflashplayer_linux.so
X# cp %%LOCALBASE%%/lib/flash/ShockwaveFlash.class \
X    %%X11BASE%%/lib/browser_plugins/
X
XNext, change the Mozilla startup script, %%X11BASE%%/bin/mozilla
Xto have:
X
XLD_PRELOAD=%%PREFIX%%/lib/libflashplayer.so.1
Xexport LD_PRELOAD
X
Xat the top of it (but after #!/bin/sh).  Now start mozilla and go to
X'about:plugins' and the flash plugin is enabled!
END-of-linuxpluginwrapper/files/pkg-message.in
echo x - linuxpluginwrapper/files/pluginwrapper.c
sed 's/^X//' >linuxpluginwrapper/files/pluginwrapper.c << 'END-of-linuxpluginwrapper/files/pluginwrapper.c'
X/*-
X * Copyright (c) 2002-2003 Norikatsu Shigemura
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X *    notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X *    notice, this list of conditions and the following disclaimer in the
X *    documentation and/or other materials provided with the distribution.
X *
X * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X * SUCH DAMAGE.
X *
X */
X
X#define	DEV_SND_MAJOR			30
X#define	ENV_DSPDEV			"MOZILLA_DSP_DEVICE"
X#define	ENV_DISABLER			"MOZILLA_DSP_HACK_DISABLE"
X
X
X/*
X *
X */
X#define	extern_alias(type, var, orgvar)	\
X	extern  type  var  __attribute__ ( (alias(#orgvar)) );	\
X	__asm__(".comm  " #var ", 4, 4")
X
X
X/*
X *
X */
X#include <sys/param.h>
X#include <sys/types.h>
X#include <dlfcn.h>
X#include <fcntl.h>
X#include <stdio.h>
X#include <errno.h>
X#include <limits.h>
X#include <stdlib.h>
X#include <sys/stat.h>
X#include <sys/param.h>
X#include <sys/ioctl.h>
X#include "linux-ioctl.h"
X
X
X/*
X *
X */
X#ifdef	DEBUG
X#	define	dprintf(str, ...)	fprintf(stderr, str "\n" ,##__VA_ARGS__)
X#else
X#	define	dprintf(str, ...)	/* NOTHING TO DO */
X#endif
X
X
X/*
X *
X */
X#if __FreeBSD_version < 400000
X#	include <sys/sysctl.h>
X#	include <machine/soundcard.h>
X#	define	ioctl(d, r, a)		_thread_sys_ioctl(d, r, void *args)
X#	define	open(p, f, m)		_thread_sys_open(p, f, void *args)
X#	define	close(d)		_thread_sys_open(d)
X#	define	_open(p, f, ...)	syscall(SYS_fhopen, d, r ,##__VA_ARGS__)
X#	define	_ioctl(d, r, ...)	syscall(SYS_ioctl,  d, r ,##__VA_ARGS__)
X#	define	_close(d)		syscall(SYS_close, d)
X#	define	va_list			int
X#	define	va_start(a, r)		/* NOTHING TO DO */
X#	define	va_arg(a, t)		(args)
X#	define	va_end(a)		/* NOTHING TO DO */
X#else
X#	include	<stdarg.h>
X#	include	<sys/soundcard.h>
X#endif
X
X
X/*
X *
X */
Xstatic struct dsp_fd_type {
X	int		fd;			/* File Descriptor:	< 0 not available	*/
X	int		linux_ioctl_request;	/* Linux ioctl requirement is true		*/
X} dsp_fd_type = {
X	-1,
X	 0,
X};
X
X
X/*
X *
X */
X#define	FORCE_CLEAR_LD_PRELOAD	if(  !init_done  )  unsetenv("LD_PRELOAD")
Xstatic int init_done = 0;
X
X
X/*
X *
X */
Xint
Xopen(const char *path, int flags, .../* mode_t mode */)
X{
X	int		 ret;
X	va_list		 ap;
X	const char	*name = NULL;
X
X	va_start(ap, flags);
X
X	FORCE_CLEAR_LD_PRELOAD;			/* XXX: force clear (X_X) */
X
X	if(  strncmp(path, DSP_DEVICE, sizeof(DSP_DEVICE) - 1) == 0  )  {
X		if(  dsp_fd_type.fd >= 0  )  {
X			return dsp_fd_type.fd;	/* XXX: really? */
X		}
X		if(  ( name = getenv(ENV_DSPDEV) )  !=  NULL  )  {
X			struct stat st;
X			if(  stat(name, &st) == 0 
X			  && ( S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode) )
X			  && major(st.st_rdev) == DEV_SND_MAJOR  )  {
X				path = name;
X			}
X		}
X		name = path;			/* name IS NOT NULL for future use */
X	}
X
X	if(  flags & O_CREAT  )  {
X		ret = _open(path, flags, va_arg(ap, mode_t*));
X	}  else  {
X		ret = _open(path, flags);
X	}
X
X	dprintf("OPEN(%d) open(%s, 0x%08X)", ret, path, flags);
X
X	if(  name  )  {
X		dsp_fd_type.fd			= ret;
X		dsp_fd_type.linux_ioctl_request	= 0;
X	}
X
X	va_end(ap);
X
X	return ret;
X}
X
X
X/*
X *
X */
Xint
Xioctl(int d, unsigned long request, ...)
X{
X	int		ret;
X	va_list		ap;
X
X	va_start(ap, request);
X
X	FORCE_CLEAR_LD_PRELOAD;				/* XXX: force clear (X_X) */
X
X	if(  d == dsp_fd_type.fd  )  {
X		switch(  request  )  {
X
X#define	SND_IOCTL_0(        linuxctl, ...)			\
X		case	linuxctl:				\
X			dprintf(#linuxctl);			\
X			dsp_fd_type.linux_ioctl_request = 1;	\
X			errno = ENOSYS;				\
X			ret   = -1;				\
X			break
X
X#define	SND_IOCTL_1(bsdctl, linuxctl, ...)			\
X		case	bsdctl:					\
X			ret = _ioctl(d, bsdctl ,##__VA_ARGS__);	\
X			break
X
X#define	SND_IOCTL_2(bsdctl, linuxctl, ...)			\
X		case	linuxctl:				\
X			dprintf(#linuxctl);			\
X			dsp_fd_type.linux_ioctl_request = 1;	\
X			/* FALLTHROUGH */			\
X		case	bsdctl:					\
X			ret = _ioctl(d, bsdctl ,##__VA_ARGS__);	\
X			break
X
X		SND_IOCTL_2(SNDCTL_DSP_RESET,        LINUX_SNDCTL_DSP_RESET                           );
X		SND_IOCTL_2(SNDCTL_DSP_SYNC,         LINUX_SNDCTL_DSP_SYNC                            );
X		SND_IOCTL_1(SNDCTL_DSP_SPEED,        LINUX_SNDCTL_DSP_SPEED,          va_arg(ap, int*));
X		SND_IOCTL_2(SOUND_PCM_READ_RATE,     LINUX_SOUND_PCM_READ_RATE,       va_arg(ap, int*));
X		SND_IOCTL_1(SNDCTL_DSP_STEREO,       LINUX_SNDCTL_DSP_STEREO,         va_arg(ap, int*));
X		SND_IOCTL_2(SNDCTL_DSP_GETBLKSIZE,   LINUX_SNDCTL_DSP_GETBLKSIZE,     va_arg(ap, int*));
X		SND_IOCTL_2(SOUND_PCM_READ_BITS,     LINUX_SOUND_PCM_READ_BITS,       va_arg(ap, int*));
X		SND_IOCTL_1(SNDCTL_DSP_SETFMT,       LINUX_SNDCTL_DSP_SETFMT,         va_arg(ap, int*));
X		SND_IOCTL_1(SNDCTL_DSP_CHANNELS,     LINUX_SNDCTL_DSP_CHANNELS,       va_arg(ap, int*));
X		SND_IOCTL_2(SOUND_PCM_READ_CHANNELS, LINUX_SOUND_PCM_READ_CHANNELS,   va_arg(ap, int*));
X		SND_IOCTL_1(SOUND_PCM_WRITE_FILTER,  LINUX_SOUND_PCM_WRITE_FILTER,    va_arg(ap, int*));
X		SND_IOCTL_2(SOUND_PCM_READ_FILTER,   LINUX_SOUND_PCM_READ_FILTER,     va_arg(ap, int*));
X		SND_IOCTL_1(SNDCTL_DSP_POST,         LINUX_SNDCTL_DSP_POST                            );
X		SND_IOCTL_1(SNDCTL_DSP_SUBDIVIDE,    LINUX_SNDCTL_DSP_SUBDIVIDE,      va_arg(ap, int*));
X		SND_IOCTL_1(SNDCTL_DSP_SETFRAGMENT,  LINUX_SNDCTL_DSP_SETFRAGMENT,    va_arg(ap, int*));
X		SND_IOCTL_2(SNDCTL_DSP_GETFMTS,      LINUX_SNDCTL_DSP_GETFMTS,        va_arg(ap, int*));
X		SND_IOCTL_2(SNDCTL_DSP_GETOSPACE,    LINUX_SNDCTL_DSP_GETOSPACE,      va_arg(ap, linux_audio_buf_info*));
X		SND_IOCTL_2(SNDCTL_DSP_GETISPACE,    LINUX_SNDCTL_DSP_GETISPACE,      va_arg(ap, linux_audio_buf_info*));
X		SND_IOCTL_2(SNDCTL_DSP_NONBLOCK,     LINUX_SNDCTL_DSP_NONBLOCK                        );
X		SND_IOCTL_2(SNDCTL_DSP_GETCAPS,      LINUX_SNDCTL_DSP_GETCAPS,        va_arg(ap, int*));
X		SND_IOCTL_2(SNDCTL_DSP_GETTRIGGER,   LINUX_SNDCTL_DSP_GETTRIGGER,     va_arg(ap, int*));
X		SND_IOCTL_2(SNDCTL_DSP_GETIPTR,      LINUX_SNDCTL_DSP_GETIPTR,        va_arg(ap, linux_count_info*));
X		SND_IOCTL_2(SNDCTL_DSP_GETOPTR,      LINUX_SNDCTL_DSP_GETOPTR,        va_arg(ap, linux_count_info*));
X		SND_IOCTL_2(SNDCTL_DSP_MAPINBUF,     LINUX_SNDCTL_DSP_MAPINBUF,       va_arg(ap, linux_buffmem_desc*));
X		SND_IOCTL_2(SNDCTL_DSP_MAPOUTBUF,    LINUX_SNDCTL_DSP_MAPOUTBUF,      va_arg(ap, linux_buffmem_desc*));
X		SND_IOCTL_2(SNDCTL_DSP_SETSYNCRO,    LINUX_SNDCTL_DSP_SETSYNCRO                       );
X		SND_IOCTL_2(SNDCTL_DSP_SETDUPLEX,    LINUX_SNDCTL_DSP_SETDUPLEX                       );
X
X		case	LINUX_SNDCTL_DSP_GETODELAY:
X			dprintf("LINUX_SNDCTL_DSP_GETODELAY");
X			dsp_fd_type.linux_ioctl_request = 1;
X			ret = _ioctl(d, SNDCTL_DSP_GETODELAY ,va_arg(ap, int*));
X			break;
X
X		case	SNDCTL_DSP_GETODELAY/* LINUX_SNDCTL_DSP_PROFILE */:
X			if(  dsp_fd_type.linux_ioctl_request  )  {
X				errno = ENOSYS;
X				ret   = -1;
X			}  else  {
X				ret   = _ioctl(d, SNDCTL_DSP_GETODELAY ,va_arg(ap, int*));
X			}
X			break;
X
X		SND_IOCTL_0(                         LINUX_SNDCTL_DSP_GETCHANNELMASK, va_arg(ap, int*));
X		SND_IOCTL_0(                         LINUX_SNDCTL_DSP_BIND_CHANNEL,   va_arg(ap, int*));
X		SND_IOCTL_0(                         LINUX_SNDCTL_DSP_SETSPDIF,       va_arg(ap, int*));
X		SND_IOCTL_0(                         LINUX_SNDCTL_DSP_GETSPDIF,       va_arg(ap, int*));
X
X#undef	SND_IOCTL_2
X#undef	SND_IOCTL_1
X#undef	SND_IOCTL_0
X
X		default:
X			dprintf("maybe native request: %08X", request);
X			ret = _ioctl(d, request, va_arg(ap, void*));
X			break;
X		}
X	}  else  {
X		ret = _ioctl(d, request, va_arg(ap, void*));
X	}
X
X	va_end(ap);
X
X	return ret;
X}
X
X/*
X *
X */
Xint
Xclose(int d)
X{
X	if(  dsp_fd_type.fd == d  )  {
X		dsp_fd_type.fd = -1;
X	}
X
X	dprintf("CLOSE(%d)", d);
X
X	return _close(d);
X}
X
X
X/*
X *
X */
Xconst unsigned short int *__ctype_b;
X
X/*
X *
X */
X#if 1
Xextern_alias(char **, __environ, environ);
X#else
Xextern char **__environ __attribute__ ( (alias("environ")) );
X__asm__(".comm  __environ, 4, 4");
X#endif
X
X
X/*
X * This is used by brk(2), sbrk(2).  But FreeBSD's these is different from
X * Linux's these.  Therefore, this is dummy variable.
X */
X
X#if 1
Xvoid *___brk_addr = NULL;
X#else
Xvoid *__curbrk = NULL;
Xextern FILE  *___brk_addr __attribute__ ( (alias("__curbrk")) );
X#endif
X
X
X/*
X *
X */
Xlong int
X__strtol_internal(const char *nptr, char **endptr, int base, int group)
X{
X	return strtol(nptr, endptr, base);
X}
X
X
X/*
X *
X */
X#undef  stderr
X#if	__FreeBSD_version >= 500022 || \
X	(470101 <= __FreeBSD_version && __FreeBSD_version < 500000)
X#if 1
Xextern_alias(FILE*, stderr, __stderrp);
X#else
Xextern FILE  *stderr __attribute__ ( (alias("__stderrp")) );
X__asm__(".comm  stderr, 4, 4");
X#endif
X#else
XFILE *stderr = &_sF[2];
X#endif
X
X
X#if __GNUC__ > 2
X
X/* 
X * __builtin_vec_new, __builtin_vec_delete are in gcc 2.95.4's libgcc.a.
X * But there are not in new gcc (3.0 or later?).
X */
X
Xvoid *
X__builtin_vec_new(size_t sz /* XXX: std::nothrow_t& nothrow */)
X{
X	void *p;
X
X	if(  sz == 0  )
X		sz = 1;
X
X	p = malloc(sz);
X
X	/* XXX: ERROR HANDLER is not available */
X
X	return p; 
X}
X
Xvoid
X__builtin_vec_delete(void *ptr)
X{
X	if(  ptr  )
X		free(ptr);
X}
X
Xvoid
X__pure_virtual(void)
X{
X#define	MESSAGE "pure virtual method called\n"
X	write(2, MESSAGE, sizeof (MESSAGE) - 1);
X#undef	MESSAGE
X}
X#endif
END-of-linuxpluginwrapper/files/pluginwrapper.c
echo x - linuxpluginwrapper/pkg-descr
sed 's/^X//' >linuxpluginwrapper/pkg-descr << 'END-of-linuxpluginwrapper/pkg-descr'
XA wrapper that allows the use of the Linux flash plugin to work with
Xa FreeBSD-native binary of mozilla.
END-of-linuxpluginwrapper/pkg-descr
echo x - linuxpluginwrapper/pkg-plist
sed 's/^X//' >linuxpluginwrapper/pkg-plist << 'END-of-linuxpluginwrapper/pkg-plist'
Xlib/pluginwrapper.so
X@unexec /bin/rm -f %%X11BASE%%/browser_plugins/raclass.zip
X@unexec /bin/rm -f %%X11BASE%%/browser_plugins/rpnp.so
X@unexec /bin/rm -f %%X11BASE%%/browser_plugins/ShockwaveFlash.class
X@unexec /bin/rm -f %%X11BASE%%/browser_plugins/libflashplayer.so
X@exec /bin/ln -sf %D/lib/flash/libflashplayer.so     %%X11BASE%%/browser_plugins/
X@exec /bin/ln -sf %D/lib/flash/ShockwaveFlash.class  %%X11BASE%%/browser_plugins/
X@exec /bin/ln -sf %D/lib/lib/RealPlayer8/rpnp.so     %%X11BASE%%/browser_plugins/
X@exec /bin/ln -sf %D/lib/lib/RealPlayer8/raclass.zip %%X11BASE%%/browser_plugins/
END-of-linuxpluginwrapper/pkg-plist
exit



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200306151022.h5FAMg1I038752>