[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog packaging/install-gnash.sh exte...
From: |
Rob Savoye |
Subject: |
[Gnash-commit] gnash ChangeLog packaging/install-gnash.sh exte... |
Date: |
Thu, 07 Feb 2008 02:43:58 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Rob Savoye <rsavoye> 08/02/07 02:43:58
Modified files:
. : ChangeLog
Added files:
packaging : install-gnash.sh
extensions/launcher: Makefile.am launcher.cpp launcher_ext.cpp
launcher_ext.h md5.cpp md5.h test.as
Log message:
* packaging/install-gnash.sh: Install script for installting
binary tarballs.
* extensions/launcher: New extension for launching application
from a swf file. Very handy for a swf basd UI for mobile devices
that use graphical menus.
* extensions/launcher/launcher.cpp: Launcher support, which uses
an MD5 checksum to make sure it only launches the application
that's compiled in.
* extensions/launcher/launcher_ext.{cpp,h}: Wrappers for the
Launcher AS class.
* extensions/launcher/md5.{cpp,h}: md5 calculations.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/packaging/install-gnash.sh?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5579&r2=1.5580
http://cvs.savannah.gnu.org/viewcvs/gnash/extensions/launcher/Makefile.am?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/extensions/launcher/launcher.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/extensions/launcher/launcher_ext.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/extensions/launcher/launcher_ext.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/extensions/launcher/md5.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/extensions/launcher/md5.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/extensions/launcher/test.as?cvsroot=gnash&rev=1.1
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5579
retrieving revision 1.5580
diff -u -b -r1.5579 -r1.5580
--- ChangeLog 6 Feb 2008 17:00:00 -0000 1.5579
+++ ChangeLog 7 Feb 2008 02:43:56 -0000 1.5580
@@ -1,3 +1,17 @@
+2008-02-06 Rob Savoye <address@hidden>
+
+ * packaging/install-gnash.sh: Install script for installting
+ binary tarballs.
+ * extensions/launcher: New extension for launching application
+ from a swf file. Very handy for a swf basd UI for mobile devices
+ that use graphical menus.
+ * extensions/launcher/launcher.cpp: Launcher support, which uses
+ an MD5 checksum to make sure it only launches the application
+ that's compiled in.
+ * extensions/launcher/launcher_ext.{cpp,h}: Wrappers for the
+ Launcher AS class.
+ * extensions/launcher/md5.{cpp,h}: md5 calculations.
+
2008-02-06 Sandro Santilli <address@hidden>
* testsuite/actionscript.all/array.as: another insane test..
Index: packaging/install-gnash.sh
===================================================================
RCS file: packaging/install-gnash.sh
diff -N packaging/install-gnash.sh
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ packaging/install-gnash.sh 7 Feb 2008 02:43:56 -0000 1.1
@@ -0,0 +1,457 @@
+#!/bin/sh
+#
+# Copyright (C) 2008 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+#
+# install script for Gnash binary tarballs.
+#
+
+# set to any command to execute to make the shell commands not
+# make any actual changes on disk. 'echo' is the usual value here
+# for this, as it just displays the commands to the screen.
+debug=echo
+
+# set 'yes' to 'yes', and you don't get asked for prompts.
+# Use with care!!! Note that setting this to yes obligates the user
+# to having agreed to the GPLv3 license when executing this script.
+yes=yes
+
+# aliases for a few commands to force debug mode while still leaving
+# the rest of this code readable.
+COPY="$debug cp -f"
+REMOVE="$debug rm -f"
+MOVE="$debug mv -f"
+
+#
+# Display the GPLv3, and get the users agreement before proceeding
+#
+gpl ()
+{
+ # display the GPLv3
+ cat COPYING
+
+ # make sure the user agrees
+ if [ x$yes = xno ]; then
+ read -p "Do you agree to the terms of this license? (yes or no) " answer
+ else
+ answer="$yes"
+ echo "NOTE: You have the install script set to \"yes always\" mode"
+ echo "NOTE: This means by default you have agree to the terms of the GPLv3"
+ fi
+
+ if [ x$answer != xyes ] ; then
+ echo "Sorry, then you can't install Gnash..."
+ exit
+ fi
+}
+
+# This script has a split personality in that it works in an
+# unconfigured tree, as well as a version with the paths munged
+# by the normal Gnash configuration process. This way we can
+# have the final version as included in the tarball have the
+# paths Gnash was configured with for that build, which seems
+# a good idea. Running this unconfigured is mostly a maintainer
+# feature, it's much faster to be avbke to rerun this script than
+# constantely reconfiguring gnash, which isn't real fast...
+
+checkdirs ()
+{
+ # Root directory used to look for pre existing installations,
+ # as well as were these files get installed to.
+ rootdir="@prefix@"
+ if [ x"${rootdir}" = x"@prefix@" ]; then
+ rootdir="/usr/local"
+ fi
+
+ # This is where the NSAPI (any Geeko based browser like Mozilla,
+ # Netscape, Firefox, Galeon, Ephipany, XO Web Activity, gets
+ # installed. Most browsers, whether proprietary or open software
+ # support NSAPI, but your mileage may vary...
+ nsapidir="@FIREFOX_PLUGINS@"
+ if [ x"${nsapidir}" = x"@FIREFOX_PLUGINS@" ]; then
+ nsapidir="/usr/lib/mozilla/plugins" #
+ fi
+ if [ ! -w ${nsapidir} ]; then
+ needstobe="`ls -ld ${nsapidir} | cut -f 3 -d ' ' 2>&1`"
+ echo "Sorry, you need to be have write permissions to \"${nsapidir}\" to
install the Gnash NSAPI plugin"
+ echo "Or be the user \"${needstobe}\""
+ $debug exit
+ fi
+
+ # This is where the Kparts plugin gets installed.
+ kpartsplugindir="@KDE_PLUGINDIR@"
+ if [ x"${kpartsplugindir}" = x"@KDE_PLUGINDIR@" ]; then
+ kpartsplugindir="/usr/lib/kde3"
+ fi
+ if [ -d ${kpartsplugindir} -a ! -w ${kpartsplugindir} ]; then
+ needstobe="`ls -ld ${kpartsplugindir} | cut -f 3 -d ' ' 2>&1`"
+ echo "Sorry, you need to be have write permissions to
\"${kpartsplugindir}\" to install the Gnash Kparts plugin"
+ echo "Or be the user \"${needstobe}\""
+ $debug exit
+ fi
+
+ # This is where the Kparts services gets installed.
+ kpartsservicesdir="@KDE_SERVICESDIR@"
+ if [ x"${kpartsservicesdir}" = x"@KDE_SERVICESDIR@" ]; then
+ kpartsservicesdir="/usr/share/services"
+ fi
+ if [ -d ${kpartsservicesdir} -a ! -w ${kpartsservicesdir} ]; then
+ needstobe="`ls -ld ${kpartsservicesdir} | cut -f 3 -d ' ' 2>&1`"
+ echo "Sorry, you need to be have write permissions to
\"${kpartsservicesdir}\" to install the Gnash Kparts services"
+ echo "Or be the user \"${needstobe}\""
+ $debug exit
+ fi
+
+ # This is where the Kparts config gets installed.
+ kpartsconfigdir="@KDE_CONFIGDIR@"
+ if [ x"${kpartsconfigdir}" = x"@KDE_CONFIGDIR@" ]; then
+ kpartsconfigdir="/etc/kde3"
+ fi
+ if [ -d ${kpartsconfigdir} -a ! -w ${kpartsconfigdir} ]; then
+ needstobe="`ls -ld ${kpartsconfigdir} | cut -f 3 -d ' ' 2>&1`"
+ echo "Sorry, you need to be have write permissions to
\"${kpartsconfigdir}\" to install the Gnash Kparts Config Data"
+ echo "Or be the user \"${needstobe}\""
+ $debug exit
+ fi
+
+ # This is where the Kparts appdata gets installed.
+ kpartappsdir="@KDE_APPSDATADIR@"
+ if [ x"${kpartappsdir}" = x"@KDE_APPSDATADIR@" ]; then
+ kpartappsdir="/usr/share/apps/klash"
+ fi
+ if [ -d ${kpartappsdir} -a ! -w ${kpartappsdir} ]; then
+ needstobe="`ls -ld ${kpartappsdir} | cut -f 3 -d ' ' 2>&1`"
+ echo "Sorry, you need to be have write permissions to \"${kpartappsdir}\"
to install the Gnash Kparts Application Data"
+ echo "Or be the user \"${needstobe}\""
+ $debug exit
+ fi
+
+ if [ x"${debug}" != x ]; then
+ echo "NOTE: You have debug mode set to \"${debug}\", no real commands will
be executed"
+ fi
+
+ if [ ! -w ${rootdir} ]; then
+ needstobe="`ls -ld ${rootdir} | cut -f 3 -d ' ' 2>&1`"
+ if [ x`whoami` != xroot ]; then
+ echo "Sorry dude, you need to be have write permissions to
\"${rootdir}\" to install Gnash"
+ echo "Or be the user \"${needstobe}\""
+ $debug exit
+ fi
+ fi
+
+ # dopcumentation gets installed here
+ docdir="/usr/share/doc"
+
+ if [ ! -w ${docdir} ]; then
+ needstobe="`ls -ld ${docdir} | cut -f 3 -d ' ' 2>&1`"
+ if [ x`whoami` != xroot ]; then
+ echo "Sorry dude, you need to be have write permissions to \"${docdir}\"
to install Gnash"
+ echo "Or be the user \"${needstobe}\""
+ $debug exit
+ fi
+ fi
+}
+
+# look for existing installtions of snapshots. As these are date stamped,
+# it's possible to get many of them from repeated weekly installs of
+# these Gnash snapshots. So Look for them, and let the user remove pieces
+# of them to return to a stable state.
+preexisting ()
+{
+ if [ -d ${rootdir}/lib/gnash ]; then
+ existing=`ls -d ${rootdir}/lib/gnash/libgnashbase-*.so 2> /dev/null`
+ if [ -n "${existing}" ]; then
+ echo ""
+ echo "You have previous installations of Gnash"
+ file=""
+ for i in $existing; do
+ files="$files `echo $i | sed -e 's:.*gnashbase-::' -e 's:.so::'`"
+ done
+ echo "version: $files"
+ echo "These should to be removed for the best stability of Gnash"
+ if [ x$yes = xno ]; then
+ read -p "Do you wish to remove these old versions ? " answer
+ else
+ answer="$yes"
+ fi
+ if [ x$answer = xyes ]; then
+ for i in $files; do
+ if [ x$yes = xno ]; then
+ read -p "Remove Gnash version \"$i\"? " answer
+ else
+ answer="$yes"
+ fi
+ if [ x$answer = xyes ]; then
+ ${REMOVE} $rootdir/lib/gnash/libgnash*-$i.*
+ fi
+ done
+ fi
+ fi
+ existing=`ls -d ${rootdir}/bin/*-gnash 2> /dev/null`
+ if [ -n "${existing}" ]; then
+ echo "You have previous installations of the Gnash GUI"
+ files=""
+ for i in $existing; do
+ files="$files `echo $i | sed -e 's:-gnash::' -e "s:${rootdir}/bin/::"`"
+ done
+ echo "GUIS: $files"
+ echo "These should to be removed for the best stability of Gnash"
+ if [ x$yes = xno ]; then
+ read -p "Do you wish to remove these old versions ? " answer
+ else
+ answer="$yes"
+ fi
+ if [ x$answer = xyes ]; then
+ for i in $files; do
+ if [ x$yes = xno ]; then
+ read -p "Remove Gnash GUI \"$i\"? " answer
+ else
+ answer="$yes"
+ fi
+ if [ x$answer = xyes ]; then
+ ${REMOVE} $rootdir/bin/gnash/$i-gnash
+ fi
+ done
+ fi
+ if [ x$yes = xno ]; then
+ read -p "Do you wish to remove the gnash shell script too ? " answer
+ else
+ answer="$yes"
+ fi
+ if [ x$answer = xyes ]; then
+ ${REMOVE} $rootdir/bin/gnash/gnash
+ fi
+ fi
+ else
+ echo "Cool, you don't have any preexisting installations of Gnash"
+ fi
+
+ return `true`
+}
+
+# install all the files to their proper location.
+# this basically dumplicates what "make install install-plugin"
+# does, but it's more oriented towards developers than end users.
+# so this is the more user friendly way to install a binary tarball.
+install ()
+{
+ # install the NSAPI (Mozilla/Firefox) plugin
+ if [ -e plugins/libgnashplugin.so -o x$yes = xyes ]; then
+ ${COPY} libgnashplugin.so ${nsapidir}
+ else
+ echo "You don't have the NSAPI plugin, installation can't continue"
+ exit
+ fi
+
+ # install the Kparts (KDE/Konqueror) plugin
+ if [ -e plugins/libklashpart.so -o x$yes = xyes ]; then
+ ${COPY} plugins/libklashpart.so ${kpartsplugindir}
+ else
+ echo "You don't have the Kparts plugin, installation can't continue"
+ exit
+ fi
+
+ # install the libraries
+ if [ -e lib/libgnashbase.so -o x$yes = xyes ]; then
+ ${COPY} lib/libgnash*.so /usr/lib/
+ else
+ echo "You don't have the Gnash libraries, installation can't continue"
+ exit
+ fi
+
+ # install the executables
+ if [ -e bin/gtk-gnash -o x$yes = xyes ]; then
+ ${COPY} bin/*gnash bin/gprocessor bin/dumpshm bin/soldumper /usr/bin/
+ else
+ echo "You don't have the Gnash executable, installation can't continue"
+ exit
+ fi
+
+ if [ -e dumpshm -o x$yes = xyes ]; then
+ ${COPY} gprocessor dumpshm soldumper /usr/bin/
+ else
+ echo "You don't have the Gnsh utilities, installation can't continue"
+ exit
+ fi
+
+ # install the documentation
+ if [ -e gnash.pdf -o x$yes = xyes ]; then
+ mkdir -p /usr/share/doc/gnash
+ ${COPY} gnash.pdf /usr/share/doc/gnash
+ fi
+}
+
+#
+# Here's where we make an attempt to see if the dependant
+# packages Gnash needs are installed. This has a pile of
+# system dependant code in it, so for now we can only support
+# the more popular packaging types, namely rpm,.deb, ipkg, and
+# BSD packages.
+#
+checkdeps()
+{
+ genericdeps="boost gstreamer libpng libjpeg libxml2 libstdc++ curl agg fixme"
+ gtkdeps="gtk2 gtkglext pango atk"
+ kdedeps="kdebase qt"
+ missing=""
+ # first see which packaging system we have to deal with.
+ # First we go through and see what program we can use to
+ # check for installed packages. Note that this does not
+ # currently support finding packages you've built from
+ # source, or installed via a tarball, because neither will
+ # have entries into the package DB.
+ pkginfo="rpm dpkg ipkg pkg_info"
+ for i in $pkginfo; do
+ if [ `which $i` ]; then
+ pkginfo=$i
+ echo "Yes, found $i, so we'll use that for listing packages"
+ break
+ fi
+ done
+
+ # BSD needs PKG_PATH set to load anything over the net.
+ if [ ${pkginfo} = "pkg_info" ]; then
+ if [ x${PKG_PATH} = x ]; then
+ echo "Pleaase set the environment variable PKG_PATH and try again."
+ exit 1
+ fi
+ fi
+ # Usually the program that installs packages isn't the same one
+ # that we can use to check the packaging DB.
+ pkgnet="yum apt-get ipkg pkg_add"
+ for i in ${pkgnet}; do
+ if [ `which $i` ]; then
+ pkgnet=$i
+ echo "Yes, found $i, so we'll use that to install packages"
+ break
+ fi
+ done
+
+ echo "Looking for dependent packages for GTK2 and KDE..."
+ # first find the packages all configurations of Gnash need
+ for i in ${genericdeps} ${gtkdeps} ${kdedeps}; do
+ case $pkginfo in
+ dpkg)
+ deps="`dpkg -l "*$i*" | grep -- "^ii" | cut -d ' ' -f 3`"
+ ;;
+ rpm)
+ deps="`rpm -q "$i"`"
+ ;;
+ pkg_info)
+ deps="fixme"
+ ;;
+ ipkg)
+ deps="fixme"
+ ;;
+ *)
+ echo "ERROR: No package manager found!"
+ exit 1
+ ;;
+ esac
+ found=`echo ${deps} | grep -v 'not installed' | grep -c "${i}" 2>&1`
+ if [ $found -gt 0 ]; then
+ echo "Yes, found $i"
+ else
+ echo "Nope, $i appears to not be installed"
+ missing="${missing} $i"
+ fi
+ done
+
+ if [ -n "${missing}" ]; then
+ echo "package(s)\"${missing}\" are missing!"
+ echo "You will need sudo priviledges to install the packages"
+ if [ x$yes = xno ]; then
+ $debug sudo ${pkgnet} install ${missing}
+ else
+ $debug sudo ${pkgnet} -y install ${missing}
+ fi
+ fi
+}
+
+#
+# Get codecs
+#
+getcodecs()
+{
+ # sudo apt-get install gstreamer0.10-ffmpegsudo apt-get install
gstreamer0.10-ffmpeg gstreamer0.10-gl gstreamer0.10-plugins-base
gstreamer0.10-plugins-good gstreamer0.10-plugins-bad
gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly
gstreamer0.10-plugins-ugly-multiverse libxine-extracodecs w32codecs
+ # deb http://archive.ubuntu.com/ubuntu dapper universe multiverse
+ # deb-src http://archive.ubuntu.com/ubuntu dapper universe multiverse
+
+
+
+ echo $0
+}
+
+#
+# Here's where all the actions happens
+#
+
+# if we have any argument, process them
+while [ ! -z $1 ]; do
+ case "$1" in
+ rootdir=*)
+ rootdir=`echo $1 | sed -e 's:rootdir=::'`
+ if [ -z "${rootdir}" ]; then
+ echo "ERROR: You need to specify an argument for rootdir="
+ fi
+ ;;
+ dump)
+ yes=yes
+ checkdirs
+ echo ""
+ echo "Default paths are: "
+ echo " Root directory is: ${rootdir}"
+ echo " NSAPI directory is: ${nsapidir}"
+ echo " Kparts plugin directory is: ${kpartsplugindir}"
+ echo " Kparts services directory is: ${kpartsservicesdir}"
+ echo " Kparts config data directory is: ${kpartsconfigdir}"
+ echo " Kparts application data directory is: ${kpartappsdir}"
+ echo ""
+ echo "The 'debug' option is set to: \"${debug}\""
+ echo "The 'yes' option is set to: \"${yes}\""
+ echo "The 'COPY' command is set to: \"${COPY}\""
+ echo "The 'REMOVE' command is set to: \"${REMOVE}\""
+ echo "The 'MOVE' command is set to: \"${MOVE}\""
+ exit 0
+ ;;
+ deps)
+ checkdeps
+ exit 1
+ ;;
+ *)
+ echo "Usage: $0 [rootdir=path]"
+ echo " \"$1\" isn't a supported option"
+ exit 1
+ ;;
+ esac
+done
+
+#
+# Here's where everything actually gets executed
+#
+# Go through the license agreement
+gpl
+
+# Check the directory permissions first
+checkdirs
+
+# Look for preexisting installations of Gnash. letting the user
+# remove them if they so choose
+preexisting
+
+# Install Gnash
+install
Index: extensions/launcher/Makefile.am
===================================================================
RCS file: extensions/launcher/Makefile.am
diff -N extensions/launcher/Makefile.am
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ extensions/launcher/Makefile.am 7 Feb 2008 02:43:57 -0000 1.1
@@ -0,0 +1,95 @@
+## Process this file with automake to generate Makefile.in
+#
+# Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+AUTOMAKE_OPTIONS =
+
+# this is where Gnash plugins get installed
+pluginsdir = $(libdir)/gnash/plugins
+
+plugins_LTLIBRARIES = launcher_ext.la
+bin_PROGRAMS = launcher-gnash
+
+AM_CPPFLAGS = -DGNASHBINDIR=\"${bindir}\"
+INCLUDES = -I$(srcdir) \
+ -I$(top_srcdir)/libbase \
+ -I$(top_srcdir)/server \
+ -I$(top_srcdir)/server/vm \
+ -I$(top_srcdir)/asobjs \
+ $(BOOST_CFLAGS) \
+ $(NULL)
+
+launcher_ext_la_SOURCES = launcher_ext.cpp launcher_ext.h
+launcher_ext_la_LDFLAGS = -module -avoid-version -no-undefined
+launcher_ext_la_LIBDADD = $(LIBADD_DL) $(LIBLTDL) \
+ $(top_builddir)/libbase/libgnashbase.la \
+ $(top_builddir)/server/libgnashserver.la \
+ $(PTHREAD_LIBS) \
+ $(NULL)
+
+launcher_gnash_SOURCES = \
+ launcher.cpp \
+ md5.cpp md5.h
+launcher_gnash_LDADD = $(top_builddir)/libbase/libgnashbase.la
+launcher_gnash_DEPENDENCIES = sums
+
+CLEANFILES = gnash-dbg.log
+
+# this is a list of Gnash executables that we're allowed to execute
+PROGS =
+
+if BUILD_GTK_GUI
+PROGS += gui/.libs/gtk-gnash
+endif
+
+if BUILD_HILDON_GUI
+PROGS += gui/.libs/hildon-gnash
+endif
+
+if BUILD_ALP_GUI
+PROGS += gui/.libs/alp-gnash
+endif
+
+if BUILD_KDE_GUI
+PROGS += gui/.libs/kde-gnash
+endif
+
+if BUILD_SDL_GUI
+PROGS += gui/.libs/sdl-gnash
+endif
+
+if BUILD_FLTK_GUI
+PROGS += gui/.libs/fltk-gnash
+endif
+
+# we don't use a dependency here, as it's too messy for make. Instead, we just
+# check to make sure the file exists, and is an executable
+sums:
+ for i in $(PROGS); do \
+ if test -x ../../$$i; then \
+ file=`basename $$i | tr '-' '_' `; \
+ rm -f $$file; \
+ md5=`$(MD5SUM) ../../$$i | cut -d ' ' -f 1`; \
+ echo "const char *$$file = \"$$md5\";" > $$file.h; \
+ fi; \
+ done
+
+check_PROGRAMS = # SharedTest
+
+install-pluginsLTLIBRARIES: $(plugins_LTLIBRARIES)
+ test -d "$(DESTDIR)$(pluginsdir)" || $(mkinstalldirs)
"$(DESTDIR)$(pluginsdir)"
+ $(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG)
$(plugins_LTLIBRARIES) "$(DESTDIR)$(pluginsdir)/$(plugins_LTLIBRARIES)"
+ $(RM) $(DESTDIR)$(pluginsdir)/*.a
Index: extensions/launcher/launcher.cpp
===================================================================
RCS file: extensions/launcher/launcher.cpp
diff -N extensions/launcher/launcher.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ extensions/launcher/launcher.cpp 7 Feb 2008 02:43:57 -0000 1.1
@@ -0,0 +1,162 @@
+//
+// Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include <iostream>
+#include <cerrno>
+#include <cstring>
+#include <cassert>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#ifdef USE_GTK
+#include "gtk_gnash.h"
+#endif
+
+#ifdef USE_HILDON
+#include "hildon_gnash.h"
+#endif
+
+#ifdef USE_ALP
+#include "alp_gnash.h"
+#endif
+
+#ifdef USE_KDE
+#include "kde_gnash.h"
+#endif
+
+#ifdef USE_SDL
+#include "sdl_gnash.h"
+#endif
+
+#ifdef USE_FLTK
+#include "fltk_gnash.h"
+#endif
+
+#include "md5.h"
+
+using namespace std;
+
+int
+main(int argc, char *argv[])
+{
+ string procname;
+ pid_t childpid;
+
+ char *gnash_env = getenv("GNASH_PLAYER");
+ if (!gnash_env) {
+ procname = GNASHBINDIR;
+ procname += "/hildon-gnash";
+ } else {
+ procname = gnash_env;
+ }
+
+ struct stat procstats;
+
+ // See if the file actually exists, otherwise we can't spawn it
+ if (stat(procname.c_str(), &procstats) == -1) {
+ cout << "Invalid filename: " << procname << endl;
+ exit(-1);
+ }
+
+ // Check the MD5, as a minimal security check
+ string md5 = hildon_gnash;
+ if (md5_filespec_check(procname, md5)) {
+ cout << "MD5 matches for " << procname << endl;
+ } else {
+ cout << "ERROR: MD5 doesn't match! for " << procname << endl;
+ exit(-1);
+ }
+
+ // make a copy of ourself, the child gets replaced by the file to
+ // be executed, and the parent goes away.
+ childpid = fork();
+
+ // childpid is -1, if the fork failed, so print out an error message
+ if (childpid == -1) {
+ cout << "ERROR: dup2() failed: " << strerror(errno) << endl;
+ exit(-1);
+ }
+
+ // childpid is a positive integer, if we are the parent, and
+ // fork() worked, so exit cleanly
+ if (childpid > 0) {
+ cout << "Forked sucessfully, child process PID is " << childpid << endl;
+ exit(0);
+ }
+
+ // setup the command line for the executable we want to launch
+ long win_xid;
+ int win_height, win_width;
+ string base_url = ".";
+
+ const size_t buf_size = 30;
+ char xid[buf_size], width[buf_size], height[buf_size];
+ snprintf(xid, buf_size, "%ld", win_xid);
+ snprintf(width, buf_size, "%d", win_width);
+ snprintf(height, buf_size, "%d", win_height);
+
+ // REMEMBER TO INCREMENT THE maxargc COUNT IF YOU
+ // ADD NEW ARGUMENTS
+ const size_t maxargc = 16;
+ char **sub_argv = new char *[maxargc];
+
+ size_t sub_argc = 0;
+ sub_argv[sub_argc++] = const_cast<char*>( procname.c_str() );
+ // don't specify rendering flags, so that the rcfile
+ // will control that
+ // sub_argv[sub_argc++] = "-r";
+ // sub_argv[sub_argc++] = "3";
+ sub_argv[sub_argc++] = "-v";
+ sub_argv[sub_argc++] = "-x";
+ sub_argv[sub_argc++] = xid;
+ sub_argv[sub_argc++] = "-j";
+ sub_argv[sub_argc++] = width;
+ sub_argv[sub_argc++] = "-k";
+ sub_argv[sub_argc++] = height;
+ sub_argv[sub_argc++] = "-u";
+ sub_argv[sub_argc++] = const_cast<char*>( base_url.c_str() );
+ sub_argv[sub_argc++] = "--version";
+ sub_argv[sub_argc++] = 0;
+
+ assert(sub_argc <= maxargc);
+
+ // Start the desired executable and go away
+ cout << "Starting process: ";
+
+ for (int i=0; sub_argv[i] != 0; ++i) {
+ cout << sub_argv[i] << " ";
+ }
+ cout << endl;
+
+ execv(sub_argv[0], sub_argv);
+ // if execv returns, an error has occurred.
+ perror(strerror(errno));
+
+ delete[] sub_argv;
+
+ exit (0);
+}
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:
Index: extensions/launcher/launcher_ext.cpp
===================================================================
RCS file: extensions/launcher/launcher_ext.cpp
diff -N extensions/launcher/launcher_ext.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ extensions/launcher/launcher_ext.cpp 7 Feb 2008 02:43:57 -0000
1.1
@@ -0,0 +1,168 @@
+//
+// Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include <iostream>
+
+#include <cstdarg>
+#include <cstdio>
+#include <cstdlib>
+
+#include <string>
+#include "log.h"
+#include "launcher_ext.h"
+#include "fn_call.h"
+#include "as_object.h"
+#include "builtin_function.h" // need builtin_function
+
+using namespace std;
+
+namespace gnash
+{
+
+as_value launcher_create_md5sum(const fn_call& fn);
+as_value launcher_verify_md5sum(const fn_call& fn);
+
+Launcher::Launcher()
+ : _name(0)
+{
+ GNASH_REPORT_FUNCTION;
+}
+
+
+Launcher::~Launcher()
+{
+ GNASH_REPORT_FUNCTION;
+}
+
+
+void
+Launcher::launch(const char *filespec)
+{
+ GNASH_REPORT_FUNCTION;
+}
+
+const char *
+Launcher::create_md5sum(const char *filespec)
+{
+ GNASH_REPORT_FUNCTION;
+}
+
+bool
+Launcher::verify_md5sum(const char *filespec, const char *md5)
+{
+ GNASH_REPORT_FUNCTION;
+}
+
+class launcher_as_object : public as_object
+{
+public:
+ Launcher obj;
+};
+
+static void
+attachInterface(as_object *obj)
+{
+ GNASH_REPORT_FUNCTION;
+ obj->init_member("CreateMD5sum", new
builtin_function(launcher_create_md5sum));
+ obj->init_member("VerifyMD5sum", new
builtin_function(launcher_verify_md5sum));
+}
+
+static as_object*
+getInterface()
+{
+ GNASH_REPORT_FUNCTION;
+ static boost::intrusive_ptr<as_object> o;
+ if (o == NULL) {
+ o = new as_object();
+ }
+ return o.get();
+}
+
+static as_value
+launcher_ctor(const fn_call& /* fn */)
+{
+ GNASH_REPORT_FUNCTION;
+ launcher_as_object* obj = new launcher_as_object();
+
+ attachInterface(obj);
+ return as_value(obj); // will keep alive
+// printf ("Hello World from %s !!!\n", __PRETTY_FUNCTION__);
+}
+
+as_value
+launcher_create_md5sum(const fn_call& fn)
+{
+ GNASH_REPORT_FUNCTION;
+ boost::intrusive_ptr<launcher_as_object> ptr =
ensureType<launcher_as_object>(fn.this_ptr);
+
+ if (fn.nargs > 0) {
+ string filespec = fn.arg(0).to_string();
+ return as_value(ptr->obj.create_md5sum(filespec.c_str()));
+ }
+ return as_value("");
+}
+
+as_value
+launcher_verify_md5sum(const fn_call& fn)
+{
+ GNASH_REPORT_FUNCTION;
+ boost::intrusive_ptr<launcher_as_object> ptr =
ensureType<launcher_as_object>(fn.this_ptr);
+
+ if (fn.nargs > 0) {
+ string filespec = fn.arg(0).to_string();
+ string md5 = fn.arg(1).to_string();
+ return as_value(ptr->obj.verify_md5sum(filespec.c_str(), md5.c_str()));
+ }
+ return as_value(true);
+}
+
+std::auto_ptr<as_object>
+init_launcher_instance()
+{
+ return std::auto_ptr<as_object>(new launcher_as_object());
+}
+
+extern "C" {
+ void
+ launcher_class_init(as_object &obj)
+ {
+// GNASH_REPORT_FUNCTION;
+ // This is going to be the global "class"/"function"
+ static boost::intrusive_ptr<builtin_function> cl;
+ if (cl == NULL) {
+ cl = new builtin_function(&launcher_ctor, getInterface());
+// // replicate all interface to class, to be able to access
+// // all methods as static functions
+ attachInterface(cl.get());
+ }
+
+ obj.init_member("Launcher", cl.get());
+ }
+} // end of extern C
+
+
+} // end of gnash namespace
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:
Index: extensions/launcher/launcher_ext.h
===================================================================
RCS file: extensions/launcher/launcher_ext.h
diff -N extensions/launcher/launcher_ext.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ extensions/launcher/launcher_ext.h 7 Feb 2008 02:43:57 -0000 1.1
@@ -0,0 +1,57 @@
+//
+// Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+#ifndef __LAUNCHER_PLUGIN_H__
+#define __LAUNCHER_PLUGIN_H__
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include <memory> // for auto_ptr
+#include "as_object.h"
+
+namespace gnash
+{
+
+class Launcher {
+public:
+ Launcher();
+ ~Launcher();
+ void launch(const char *filespec);
+ const char *create_md5sum(const char *filespec);
+ bool verify_md5sum(const char *filespec, const char *md5);
+private:
+ const char *_name;
+};
+
+extern "C" {
+ void launcher_class_init(as_object &obj);
+ /// Return an instance
+}
+
+std::auto_ptr<as_object> init_launcher_instance();
+
+} // end of gnash namespace
+
+// __LAUNCHER_PLUGIN_H__
+#endif
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:
Index: extensions/launcher/md5.cpp
===================================================================
RCS file: extensions/launcher/md5.cpp
diff -N extensions/launcher/md5.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ extensions/launcher/md5.cpp 7 Feb 2008 02:43:57 -0000 1.1
@@ -0,0 +1,507 @@
+/* Functions to compute MD5 message digest of files or memory blocks.
+ according to the definition of MD5 in RFC 1321 from April 1992.
+ Copyright (C) 1995,1996,1997,1999,2000,2001,2005
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Written by Ulrich Drepper <address@hidden>, 1995. */
+/* Trimmed by Rob Savoye for Gnash, and converted to C++ <address@hidden>,
2007. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <sys/types.h>
+#include <cstdlib>
+#include <cstring>
+#include <string>
+
+#include "md5.h"
+#include "log.h"
+
+using namespace gnash;
+using namespace std;
+
+#ifdef WORDS_BIGENDIAN
+# define SWAP(n) \
+ (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
+#else
+# define SWAP(n) (n)
+#endif
+
+
+/* This array contains the bytes used to pad the buffer to the next
+ 64-byte boundary. (RFC 1321, 3.1: Step 1) */
+static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
+
+
+/* Initialize structure containing state of computation.
+ (RFC 1321, 3.3: Step 3) */
+void
+md5_init_ctx (struct md5_ctx *ctx)
+{
+ ctx->A = 0x67452301;
+ ctx->B = 0xefcdab89;
+ ctx->C = 0x98badcfe;
+ ctx->D = 0x10325476;
+
+ ctx->total[0] = ctx->total[1] = 0;
+ ctx->buflen = 0;
+}
+
+/* Put result from CTX in first 16 bytes following RESBUF. The result
+ must be in little endian byte order.
+
+ IMPORTANT: On some systems it is required that RESBUF is correctly
+ aligned for a 32 bits value. */
+void *
+md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
+{
+ ((uint32_t *) resbuf)[0] = SWAP (ctx->A);
+ ((uint32_t *) resbuf)[1] = SWAP (ctx->B);
+ ((uint32_t *) resbuf)[2] = SWAP (ctx->C);
+ ((uint32_t *) resbuf)[3] = SWAP (ctx->D);
+
+ return resbuf;
+}
+
+/* Process the remaining bytes in the internal buffer and the usual
+ prolog according to the standard and write the result to RESBUF.
+
+ IMPORTANT: On some systems it is required that RESBUF is correctly
+ aligned for a 32 bits value. */
+void *
+md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
+{
+ /* Take yet unprocessed bytes into account. */
+ uint32_t bytes = ctx->buflen;
+ size_t pad;
+
+ /* Now count remaining bytes. */
+ ctx->total[0] += bytes;
+ if (ctx->total[0] < bytes)
+ ++ctx->total[1];
+
+ pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes;
+ memcpy (&ctx->buffer[bytes], fillbuf, pad);
+
+ /* Put the 64-bit file length in *bits* at the end of the buffer. */
+ *(uint32_t *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3);
+ *(uint32_t *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) |
+ (ctx->total[0] >> 29));
+
+ /* Process last bytes. */
+ md5_process_block (ctx->buffer, bytes + pad + 8, ctx);
+
+ return md5_read_ctx (ctx, resbuf);
+}
+
+/* Compute MD5 message digest for bytes read from STREAM. The
+ resulting message digest number will be written into the 16 bytes
+ beginning at RESBLOCK. */
+int
+md5_stream (FILE *stream, void *resblock)
+{
+ /* Important: BLOCKSIZE must be a multiple of 64. */
+#define BLOCKSIZE 4096
+ struct md5_ctx ctx;
+ char buffer[BLOCKSIZE + 72];
+ size_t sum;
+
+ /* Initialize the computation context. */
+ md5_init_ctx (&ctx);
+
+ /* Iterate over full file contents. */
+ while (1)
+ {
+ /* We read the file in blocks of BLOCKSIZE bytes. One call of the
+ computation function processes the whole buffer so that with the
+ next round of the loop another block can be read. */
+ size_t n;
+ sum = 0;
+
+ /* Read block. Take care for partial reads. */
+ do
+ {
+ n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
+
+ sum += n;
+ }
+ while (sum < BLOCKSIZE && n != 0);
+ if (n == 0 && ferror (stream))
+ return 1;
+
+ /* If end of file is reached, end the loop. */
+ if (n == 0)
+ break;
+
+ /* Process buffer with BLOCKSIZE bytes. Note that
+ BLOCKSIZE % 64 == 0
+ */
+ md5_process_block (buffer, BLOCKSIZE, &ctx);
+ }
+
+ /* Add the last bytes if necessary. */
+ if (sum > 0)
+ md5_process_bytes (buffer, sum, &ctx);
+
+ /* Construct result in desired memory. */
+ md5_finish_ctx (&ctx, resblock);
+ return 0;
+}
+
+/* Compute MD5 message digest for bytes read from filespec. The
+ resulting message digest number will be written into the 16 bytes
+ beginning at RESBLOCK. */
+bool
+md5_filespec (string &filespec, void *resblock)
+{
+ /* Important: BLOCKSIZE must be a multiple of 64. */
+#define BLOCKSIZE 4096
+ struct md5_ctx ctx;
+ char buffer[BLOCKSIZE + 72];
+ size_t sum;
+
+ /* Initialize the computation context. */
+ md5_init_ctx (&ctx);
+
+ FILE *fp;
+ fp = fopen (filespec.c_str(), "rb");
+
+ /* Iterate over full file contents. */
+ while (1) {
+ /* We read the file in blocks of BLOCKSIZE bytes. One call of the
+ computation function processes the whole buffer so that with the
+ next round of the loop another block can be read. */
+ size_t n;
+ sum = 0;
+
+ /* Read block. Take care for partial reads. */
+ do
+ {
+ n = fread (buffer + sum, 1, BLOCKSIZE - sum, fp);
+
+ sum += n;
+ }
+ while (sum < BLOCKSIZE && n != 0);
+ if (n == 0 && ferror (fp))
+ return false;
+
+ /* If end of file is reached, end the loop. */
+ if (n == 0)
+ break;
+
+ /* Process buffer with BLOCKSIZE bytes. Note that
+ BLOCKSIZE % 64 == 0
+ */
+ md5_process_block (buffer, BLOCKSIZE, &ctx);
+ }
+
+ /* Add the last bytes if necessary. */
+ if (sum > 0)
+ md5_process_bytes (buffer, sum, &ctx);
+
+ /* Construct result in desired memory. */
+ md5_finish_ctx (&ctx, resblock);
+ return true;
+}
+
+// Compute MD5 message digest for bytes read from filespec. The result
+// is compared to the ascii version of the MD5 (as produced by the
+// shell utility md5sum).
+bool
+md5_filespec_check(std::string &filespec, std::string &md5)
+{
+ unsigned char resblock[MD5_DIGEST_SIZE+1];
+ char result[(MD5_DIGEST_SIZE*2)+1];
+ memset(resblock, 0, MD5_DIGEST_SIZE+1);
+ memset(result, 0, (MD5_DIGEST_SIZE*2)+1);
+ md5_filespec(filespec, resblock);
+
+ hexify((unsigned char *)result, resblock, MD5_DIGEST_SIZE, false);
+// printf("FIXME: %s == \n %s\n", result, md5.c_str());
+ if (memcmp(result, md5.c_str(), MD5_DIGEST_SIZE) == 0) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+/* compute MD5 message digest for LEN bytes beginning at BUFFER. The
+ result is always in little endian byte order, so that a byte-wise
+ output yields to the wanted ASCII representation of the message
+ digest. */
+void *
+md5_buffer (const char *buffer, size_t len, void *resblock)
+{
+ struct md5_ctx ctx;
+
+ /* Initialize the computation context. */
+ md5_init_ctx (&ctx);
+
+ /* Process whole buffer but last len % 64 bytes. */
+ md5_process_bytes (buffer, len, &ctx);
+
+ /* Put result in desired memory area. */
+ return md5_finish_ctx (&ctx, resblock);
+}
+
+
+void
+md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
+{
+ /* When we already have some bits in our internal buffer concatenate
+ both inputs first. */
+ if (ctx->buflen != 0)
+ {
+ size_t left_over = ctx->buflen;
+ size_t add = 128 - left_over > len ? len : 128 - left_over;
+
+ memcpy (&ctx->buffer[left_over], buffer, add);
+ ctx->buflen += add;
+
+ if (ctx->buflen > 64)
+ {
+ md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
+
+ ctx->buflen &= 63;
+ /* The regions in the following copy operation cannot overlap. */
+ memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
+ ctx->buflen);
+ }
+
+ buffer = (const char *) buffer + add;
+ len -= add;
+ }
+
+ /* Process available complete blocks. */
+ if (len >= 64)
+ {
+#if !_STRING_ARCH_unaligned
+/* To check alignment gcc has an appropriate operator. Other
+ compilers don't. */
+# if __GNUC__ >= 2
+# define UNALIGNED_P(p) (((md5_uintptr) p) % __alignof__ (uint32_t) != 0)
+# else
+# define UNALIGNED_P(p) (((md5_uintptr) p) % sizeof (uint32_t) != 0)
+# endif
+ if (UNALIGNED_P (buffer))
+ while (len > 64)
+ {
+ md5_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
+ buffer = (const char *) buffer + 64;
+ len -= 64;
+ }
+ else
+#endif
+ {
+ md5_process_block (buffer, len & ~63, ctx);
+ buffer = (const char *) buffer + (len & ~63);
+ len &= 63;
+ }
+ }
+
+ /* Move remaining bytes in internal buffer. */
+ if (len > 0)
+ {
+ size_t left_over = ctx->buflen;
+
+ memcpy (&ctx->buffer[left_over], buffer, len);
+ left_over += len;
+ if (left_over >= 64)
+ {
+ md5_process_block (ctx->buffer, 64, ctx);
+ left_over -= 64;
+ memcpy (ctx->buffer, &ctx->buffer[64], left_over);
+ }
+ ctx->buflen = left_over;
+ }
+}
+
+
+/* These are the four functions used in the four steps of the MD5 algorithm
+ and defined in the RFC 1321. The first function is a little bit optimized
+ (as found in Colin Plumbs public domain implementation). */
+/* #define FF(b, c, d) ((b & c) | (~b & d)) */
+#define FF(b, c, d) (d ^ (b & (c ^ d)))
+#define FG(b, c, d) FF (d, b, c)
+#define FH(b, c, d) (b ^ c ^ d)
+#define FI(b, c, d) (c ^ (b | ~d))
+
+/* Process LEN bytes of BUFFER, accumulating context into CTX.
+ It is assumed that LEN % 64 == 0. */
+
+void
+md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
+{
+ uint32_t correct_words[16];
+ const uint32_t *words = (uint32_t *)buffer;
+ size_t nwords = len / sizeof (uint32_t);
+ const uint32_t *endp = words + nwords;
+ uint32_t A = ctx->A;
+ uint32_t B = ctx->B;
+ uint32_t C = ctx->C;
+ uint32_t D = ctx->D;
+
+ /* First increment the byte count. RFC 1321 specifies the possible
+ length of the file up to 2^64 bits. Here we only compute the
+ number of bytes. Do a double word increment. */
+ ctx->total[0] += len;
+ if (ctx->total[0] < len)
+ ++ctx->total[1];
+
+ /* Process all bytes in the buffer with 64 bytes in each round of
+ the loop. */
+ while (words < endp)
+ {
+ uint32_t *cwp = correct_words;
+ uint32_t A_save = A;
+ uint32_t B_save = B;
+ uint32_t C_save = C;
+ uint32_t D_save = D;
+
+ /* First round: using the given function, the context and a constant
+ the next context is computed. Because the algorithms processing
+ unit is a 32-bit word and it is determined to work on words in
+ little endian byte order we perhaps have to change the byte order
+ before the computation. To reduce the work for the next steps
+ we store the swapped words in the array CORRECT_WORDS. */
+
+#define OP(a, b, c, d, s, T) \
+ do \
+ { \
+ a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \
+ ++words; \
+ CYCLIC (a, s); \
+ a += b; \
+ } \
+ while (0)
+
+ /* It is unfortunate that C does not provide an operator for
+ cyclic rotation. Hope the C compiler is smart enough. */
+#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s)))
+
+ /* Before we start, one word to the strange constants.
+ They are defined in RFC 1321 as
+
+ T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
+ */
+
+ /* Round 1. */
+ OP (A, B, C, D, 7, 0xd76aa478);
+ OP (D, A, B, C, 12, 0xe8c7b756);
+ OP (C, D, A, B, 17, 0x242070db);
+ OP (B, C, D, A, 22, 0xc1bdceee);
+ OP (A, B, C, D, 7, 0xf57c0faf);
+ OP (D, A, B, C, 12, 0x4787c62a);
+ OP (C, D, A, B, 17, 0xa8304613);
+ OP (B, C, D, A, 22, 0xfd469501);
+ OP (A, B, C, D, 7, 0x698098d8);
+ OP (D, A, B, C, 12, 0x8b44f7af);
+ OP (C, D, A, B, 17, 0xffff5bb1);
+ OP (B, C, D, A, 22, 0x895cd7be);
+ OP (A, B, C, D, 7, 0x6b901122);
+ OP (D, A, B, C, 12, 0xfd987193);
+ OP (C, D, A, B, 17, 0xa679438e);
+ OP (B, C, D, A, 22, 0x49b40821);
+
+ /* For the second to fourth round we have the possibly swapped words
+ in CORRECT_WORDS. Redefine the macro to take an additional first
+ argument specifying the function to use. */
+#undef OP
+#define OP(f, a, b, c, d, k, s, T) \
+ do \
+ { \
+ a += f (b, c, d) + correct_words[k] + T; \
+ CYCLIC (a, s); \
+ a += b; \
+ } \
+ while (0)
+
+ /* Round 2. */
+ OP (FG, A, B, C, D, 1, 5, 0xf61e2562);
+ OP (FG, D, A, B, C, 6, 9, 0xc040b340);
+ OP (FG, C, D, A, B, 11, 14, 0x265e5a51);
+ OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa);
+ OP (FG, A, B, C, D, 5, 5, 0xd62f105d);
+ OP (FG, D, A, B, C, 10, 9, 0x02441453);
+ OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);
+ OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8);
+ OP (FG, A, B, C, D, 9, 5, 0x21e1cde6);
+ OP (FG, D, A, B, C, 14, 9, 0xc33707d6);
+ OP (FG, C, D, A, B, 3, 14, 0xf4d50d87);
+ OP (FG, B, C, D, A, 8, 20, 0x455a14ed);
+ OP (FG, A, B, C, D, 13, 5, 0xa9e3e905);
+ OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8);
+ OP (FG, C, D, A, B, 7, 14, 0x676f02d9);
+ OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
+
+ /* Round 3. */
+ OP (FH, A, B, C, D, 5, 4, 0xfffa3942);
+ OP (FH, D, A, B, C, 8, 11, 0x8771f681);
+ OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);
+ OP (FH, B, C, D, A, 14, 23, 0xfde5380c);
+ OP (FH, A, B, C, D, 1, 4, 0xa4beea44);
+ OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9);
+ OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60);
+ OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);
+ OP (FH, A, B, C, D, 13, 4, 0x289b7ec6);
+ OP (FH, D, A, B, C, 0, 11, 0xeaa127fa);
+ OP (FH, C, D, A, B, 3, 16, 0xd4ef3085);
+ OP (FH, B, C, D, A, 6, 23, 0x04881d05);
+ OP (FH, A, B, C, D, 9, 4, 0xd9d4d039);
+ OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);
+ OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);
+ OP (FH, B, C, D, A, 2, 23, 0xc4ac5665);
+
+ /* Round 4. */
+ OP (FI, A, B, C, D, 0, 6, 0xf4292244);
+ OP (FI, D, A, B, C, 7, 10, 0x432aff97);
+ OP (FI, C, D, A, B, 14, 15, 0xab9423a7);
+ OP (FI, B, C, D, A, 5, 21, 0xfc93a039);
+ OP (FI, A, B, C, D, 12, 6, 0x655b59c3);
+ OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92);
+ OP (FI, C, D, A, B, 10, 15, 0xffeff47d);
+ OP (FI, B, C, D, A, 1, 21, 0x85845dd1);
+ OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f);
+ OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
+ OP (FI, C, D, A, B, 6, 15, 0xa3014314);
+ OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);
+ OP (FI, A, B, C, D, 4, 6, 0xf7537e82);
+ OP (FI, D, A, B, C, 11, 10, 0xbd3af235);
+ OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb);
+ OP (FI, B, C, D, A, 9, 21, 0xeb86d391);
+
+ /* Add the starting values of the context. */
+ A += A_save;
+ B += B_save;
+ C += C_save;
+ D += D_save;
+ }
+
+ /* Put checksum in context given as argument. */
+ ctx->A = A;
+ ctx->B = B;
+ ctx->C = C;
+ ctx->D = D;
+}
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:
Index: extensions/launcher/md5.h
===================================================================
RCS file: extensions/launcher/md5.h
diff -N extensions/launcher/md5.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ extensions/launcher/md5.h 7 Feb 2008 02:43:57 -0000 1.1
@@ -0,0 +1,118 @@
+// Declaration of functions and data types used for MD5 sum computing
+// library functions.
+// Copyright (C) 1995-1997,1999,2000,2001,2004,2005
+// Free Software Foundation, Inc.
+// This file is part of the GNU C Library.
+// The GNU C Library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+
+// The GNU C Library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+
+// You should have received a copy of the GNU Lesser General Public
+// License along with the GNU C Library; if not, write to the Free
+// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+// 02111-1307 USA.
+
+// Written by Ulrich Drepper <address@hidden>, 1995.
+// Trimmed by Rob Savoye for Gnash, and converted to C++ <address@hidden>,
2007.
+
+#ifndef _MD5_H
+#define _MD5_H 1
+
+#include <cstdio>
+#include <string>
+#include <boost/cstdint.hpp>
+
+// #if defined HAVE_LIMITS_H
+// # include <limits.h>
+// #endif
+
+#define MD5_DIGEST_SIZE 16
+#define MD5_BLOCK_SIZE 64
+
+typedef unsigned long md5_uintptr;
+
+// Structure to save state of computation between the single steps.
+struct md5_ctx
+{
+ uint32_t A;
+ uint32_t B;
+ uint32_t C;
+ uint32_t D;
+
+ uint32_t total[2];
+ uint32_t buflen;
+ char buffer[128] __attribute__ ((__aligned__ (__alignof__ (uint32_t))));
+};
+
+// The following three functions are build up the low level used in
+// the functions `md5_stream' and `md5_buffer'.
+
+// Initialize structure containing state of computation.
+// (RFC 1321, 3.3: Step 3)
+void md5_init_ctx (struct md5_ctx *ctx);
+
+// Starting with the result of former calls of this function (or the
+// initialization function update the context for the next LEN bytes
+// starting at BUFFER.
+// It is necessary that LEN is a multiple of 64!!!
+void md5_process_block (const void *buffer, size_t len,
+ struct md5_ctx *ctx);
+
+// Starting with the result of former calls of this function (or the
+// initialization function update the context for the next LEN bytes
+// starting at BUFFER.
+// It is NOT required that LEN is a multiple of 64.
+void md5_process_bytes (const void *buffer, size_t len,
+ struct md5_ctx *ctx);
+
+// Process the remaining bytes in the buffer and put result from CTX
+// in first 16 bytes following RESBUF. The result is always in little
+// endian byte order, so that a byte-wise output yields to the wanted
+// ASCII representation of the message digest.
+
+// IMPORTANT: On some systems it is required that RESBUF is correctly
+// aligned for a 32 bits value.
+void *md5_finish_ctx (struct md5_ctx *ctx, void *resbuf);
+
+
+// Put result from CTX in first 16 bytes following RESBUF. The result is
+// always in little endian byte order, so that a byte-wise output yields
+// to the wanted ASCII representation of the message digest.
+
+// IMPORTANT: On some systems it is required that RESBUF is correctly
+// aligned for a 32 bits value.
+void *md5_read_ctx (const struct md5_ctx *ctx, void *resbuf);
+
+// Compute MD5 message digest for bytes read from STREAM. The
+// resulting message digest number will be written into the 16 bytes
+// beginning at RESBLOCK.
+int md5_stream (FILE *stream, void *resblock);
+
+// Compute MD5 message digest for bytes read from filespec. The
+// resulting message digest number will be written into the 16 bytes
+// beginning at RESBLOCK.
+bool md5_filespec(std::string &filespec, void *resblock);
+
+// Compute MD5 message digest for bytes read from filespec. The result
+// is compared to the ascii version of the MD5 (as produced by the
+// shell utility md5sum).
+bool md5_filespec_check(std::string &filespec, std::string &md5);
+
+// Compute MD5 message digest for LEN bytes beginning at BUFFER. The
+// result is always in little endian byte order, so that a byte-wise
+// output yields to the wanted ASCII representation of the message
+// digest.
+void *md5_buffer (const char *buffer, size_t len,
+ void *resblock);
+
+#endif /* md5.h */
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:
Index: extensions/launcher/test.as
===================================================================
RCS file: extensions/launcher/test.as
diff -N extensions/launcher/test.as
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ extensions/launcher/test.as 7 Feb 2008 02:43:57 -0000 1.1
@@ -0,0 +1,43 @@
+//
+// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+// Test case for lirc ActionScript class
+// compile this test case with Ming makeswf, and then
+// execute it like this gnash -1 -r 0 -v out.swf
+
+rcsid="$Id: test.as,v 1.1 2008/02/07 02:43:57 rsavoye Exp $";
+
+var exe = new Launcher();
+
+// test the constuctor
+if (exe) {
+ trace("Launcher() constructor works");
+} else {
+ trace("Launcher() constructor failed");
+}
+
+if (!exe) {
+ trace("UNTESTED: extensions not built!");
+}
+
+// If the extension doesn't load, don't do anything.
+if (exe) {
+ trace("ERROR: Launcher: UNIMPLEMENTED");
+}
+
+
- [Gnash-commit] gnash ChangeLog packaging/install-gnash.sh exte...,
Rob Savoye <=