http://volker.dnsalias.net/linux/vvfiles/viavoice-3.1-SuSE8.2.patch

Patch to fix ViaVoice 3.1 from Mandrake 8.0 running on SuSE 8.2.
Most/all of this patch will be useful for any Linux distribution.

Apply with
	patch -b -p0 <viavoice-3.1-SuSE8.2.patch
as root.

Volker Kuhlmann    23, 24 Feb; 11 May 2003




--- /usr/bin/vvstartenrollment.orig	2000-11-23 12:42:44.000000000 +1300
+++ /usr/bin/vvstartenrollment	2003-05-11 13:43:40.000000000 +1200
@@ -1,3 +1,4 @@
+#!/bin/sh
 #///////////////////////////////////////////////////////////////////////////////
 #//===========================================================================//
 #// COPYRIGHT:                                                                //
@@ -123,7 +124,7 @@
 #
 # USE IBM JAVA =)
 #
-export PATH=/opt/IBMJava2-13/jre/bin:$PATH
+export PATH=$SPCH_JAVA/bin:$PATH
 java com.ibm.speechapps.userwizard.UWizJustEnr $1
 fi
-sleep 4
+sleep $SPCH_WAITEXIT
--- /usr/bin/vvstartuserguru.orig	2000-11-23 12:42:44.000000000 +1300
+++ /usr/bin/vvstartuserguru	2003-05-11 13:43:40.000000000 +1200
@@ -1,3 +1,4 @@
+#!/bin/sh
 #///////////////////////////////////////////////////////////////////////////////
 #//===========================================================================//
 #// COPYRIGHT:                                                                //
@@ -123,7 +124,7 @@
 #
 # USE IBM JAVA =)
 #
-export PATH=/opt/IBMJava2-13/jre/bin:$PATH
+export PATH=$SPCH_JAVA/bin:$PATH
 java com.ibm.speechapps.userwizard.UWiz $1
 fi
-sleep 4
+sleep $SPCH_WAITEXIT
--- /usr/bin/vvsetenv.orig	2000-11-23 12:42:43.000000000 +1300
+++ /usr/bin/vvsetenv	2003-05-11 15:29:32.000000000 +1200
@@ -1,3 +1,10 @@
+#!/bin/bash
+# Dear IBM: it's not very useful to have this line displaced from the top
+# of the file by a big copyright statement (especially when setting a few
+# variables is not copyrightable anyway).
+# As this file must be sourced, the shell specification is irrelevant anyway,
+# however it is useful to have it because it helps editors detect the file type
+# for syntax highlighting.
 #///////////////////////////////////////////////////////////////////////////////
 #//===========================================================================//
 #// COPYRIGHT:                                                                //
@@ -20,7 +27,6 @@
 #//     vvstartuserwizard: To start ViaVoice Userwizard
 #//
 #///////////////////////////////////////////////////////////////////////////////
-#!/bin/bash
 #-------------------------------------------------------------------------
 # Script to set all of the environment variables that the speech engine
 # is going to be using
@@ -35,6 +41,7 @@
 #------------------------------------------
 # Data, lots and lots of data!!
 #------------------------------------------
+# WARNING: when sourcing vvsetenv, take care of this positional parameter ($1)
   export SPCH_RO=/usr/lib/ViaVoice/vocabs
   export SPCH_LOC=vl1
   export SPCH_PATH=/usr/lib/ViaVoice/vocabs/langs/$1/pools
@@ -47,11 +54,80 @@
   export SPCH_DIR=${HOME}/viavoice/temp/tmp
   export SPCH_UWIZ_LOC=/usr/lib/ViaVoice/UWiz
 
-
 #------------------------------------------
 # Setup Class Paths for Java
-# 
-#
+#------------------------------------------
 export CLASSPATH=/usr/lib/ViaVoice/bin/classes/userwizardApp.zip:/usr/lib/ViaVoice/bin/classes/userwizardComponents.zip:/usr/lib/ViaVoice/bin/classes/userwizardCtrls.zip:$CLASSPATH
 
-export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH
+#------------------------------------------
+# Setup location of java used for ViaVoice
+#------------------------------------------
+# Select one of these by placing comment characters, or edit to select another.
+#
+# IBMJava2-JRE-1.3 from SuSE 8.0 does not run on SuSE 8.1:
+#export SPCH_JAVA=/usr/lib/IBMJava2-1.3.0/jre
+# SuSE 8.1, whatever java is installed as default:
+#export SPCH_JAVA=/usr/lib/java/jre
+# SuSE 8.1, java2-jre-1.3.1 (SunJava2-1.3.1, shipped with SuSE 8.1):
+#export SPCH_JAVA=/usr/lib/SunJava2-1.3.1/jre
+# IBMJava2 1.3.1-3.0 (downloaded from IBM)
+#export SPCH_JAVA=/opt/IBMJava2-131/jre
+#
+# SuSE 8.2, BlackdownJava2-JRE-1.4.1:
+export SPCH_JAVA=/usr/lib/BlackdownJava2-1.4.1/jre
+# SuSE 8.2, java2-jre-1.4.1 (SunJava2-1.4.1, shipped with SuSE 8.2):
+export SPCH_JAVA=/usr/lib/SunJava2-1.4.1/jre
+# IBMJava2 1.3.1-4.0 (downloaded from IBM)
+export SPCH_JAVA=/opt/IBMJava2-131/jre
+
+#------------------------------------------
+# Setup shared library path
+#------------------------------------------
+# This diddling with LD_LIBRARY_PATH is not necessary for the Mandrake 8.0
+# version of ViaVoice, and may have negative effects on other applications
+# if this file (vvsetenv) is sourced by the shell. It's best to call viavoice by
+# the wrapper scripts only and not to source vvsetenv by your shell.
+# On Mandrake 8.0, /usr/lib does not contain any ViaVoice-related libraries.
+# In some situations however it is required for loading libraries not directly
+# required by ViaVoice. Whether you need it, or a similar setting, depends on
+# which java you selected with SPCH_JAVA above.
+#
+# VV IBM boxed set, on SuSE 8.1, (which java?): John Smart says this setting is
+# required:
+#export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH
+#
+# VV from Mdk 8.0, on SuSE 8.1 with SuSE's SunJava2-1.3.1: this setting is
+# required:
+#export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH
+#
+# VV from Mdk 8.0, on SuSE 8.1 with SuSE's SunJava2-1.3.1: this setting is the
+# same as no setting (doesn't work)
+#export LD_LIBRARY_PATH=/lib:$LD_LIBRARY_PATH
+#
+# VV from Mdk 8.0, on SuSE 8.1, IBMJava2 1.3.1: no setting required
+
+#------------------------------------------
+# Set length of wait when exiting
+#------------------------------------------
+# This seems very silly - what's its use? It's waiting for nothing.
+# IBM has 4, we'll try waiting much shorter.
+# I see - this probably waits for the engine to shut down. vvstartuserguru and
+# vvstartdictation don't start up at all if the engine is still running from a
+# previous invocation. I still don't like to waste my time - if a viavoice
+# program doesn't start properly, wait a few seconds a try again. Or set this
+# back to 4.
+export SPCH_WAITEXIT=1
+
+#------------------------------------------
+# Set length of wait when starting java
+#------------------------------------------
+# IBM uses 2. Useless - axe it.
+export SPCH_WAITJAVA=0
+
+#------------------------------------------
+# Set location of TTS config
+#------------------------------------------
+# This is added to /etc/profile when installing ViaVoice. We'll put a copy here
+# so it works with any shell. If nothing else uses the TTS (text to speech)
+# software, (seems very likely), you can remove the line from /etc/profile.
+export ECIINI=/usr/lib/ViaVoiceTTS/eci.ini
--- /usr/bin/vvstartaudiosetup.orig	2000-11-23 12:42:44.000000000 +1300
+++ /usr/bin/vvstartaudiosetup	2003-05-11 13:43:40.000000000 +1200
@@ -1,3 +1,4 @@
+#!/bin/sh
 #///////////////////////////////////////////////////////////////////////////////
 #//===========================================================================//
 #// COPYRIGHT:                                                                //
@@ -123,8 +124,7 @@
 #
 # USE IBM JAVA =)
 #
-export PATH=/opt/IBMJava2-13/jre/bin:$PATH
+export PATH=$SPCH_JAVA/bin:$PATH
 java com.ibm.speechapps.userwizard.UWizAudSet $1
 fi
-sleep 4
-
+sleep $SPCH_WAITEXIT
--- /usr/bin/vvstartdictation.orig	2000-12-01 11:03:09.000000000 +1300
+++ /usr/bin/vvstartdictation	2003-05-11 13:43:40.000000000 +1200
@@ -63,8 +63,8 @@
 echo $STARTING $VVDICTATION
 echo $JAVANEEDED
 echo $JAVAWAIT
-sleep 2
 . vvsetenv $VVENGINELANG
+sleep $SPCH_WAITJAVA
 /usr/lib/ViaVoice/bin/vvsetuser $1
 export SPCH_PATH=$SPCH_PATH:/usr/lib/ViaVoice/javaspeakpad/data/$1/pools
 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/ViaVoice/javaspeakpad/bin
@@ -72,6 +72,6 @@
 #
 # USE IBM JAVA =)
 #
-export PATH=/usr/lib/ViaVoice/IBMJava2-13/jre/bin:$PATH
+export PATH=$SPCH_JAVA/bin:$PATH
 java -jar speakpad.jar -gl $1
 exit 0
--- /dev/null	2003-03-15 02:07:09.000000000 +1300
+++ /usr/bin/vvuser	2003-02-24 20:51:33.000000000 +1300
@@ -0,0 +1,12 @@
+#!/bin/sh
+#
+# Run the program of ViaVoice which deals with creating/deleteing ViaVoice
+# users and voice models. Provide access to this ViaVoice-internal program
+# and make it stand-alone with this wrapper script.
+#
+# Volker Kuhlmann
+#   9 Sep 2001; 23, 24 Feb 2003
+#
+
+source /usr/bin/vvsetenv
+exec /usr/lib/ViaVoice/bin/vvuser "$@"
--- /dev/null	2003-03-15 02:07:09.000000000 +1300
+++ /usr/bin/viavoice	2003-02-24 18:25:47.000000000 +1300
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# /usr/bin/viavoice
+# Restore alsa mixer settings for ViaVoice and start dictation.
+# Mixer settings are restored from the first of these files found:
+#   $HOME/viavoice/alsa.state
+#   /etc/asound.state.viavoice
+#
+# Volker Kuhlmann
+#   9, 10 Sep; 10 Dec 2001; 3 Jan 2002; 24 Feb 2003
+#
+
+statefiles="
+    $HOME/viavoice/alsa.state
+    /etc/asound.state.viavoice
+    "
+
+mixerloaded=
+if alsactl 2>/dev/null; then
+    for f in $statefiles; do
+    	if [ -r "$f" ]; then
+	    echo "Restoring mixer settings from $f"
+	    alsactl -f "$f" restore "$@"
+	    mixerloaded=1
+	    break
+	fi
+    done
+else
+    echo "Can't execute alsactl - unable to restore mixer settings."
+fi
+test -z "$mixerloaded" && echo "\
+Can't find any mixer settings to restore, ensure mixer settings are correct
+or ViaVoice might not run too well.
+"
+exec /usr/bin/vvstartdictation "$@"
