--- /dev/null
+--- flite-1.2-release/lib/Makefile.ark 2005-08-04 15:31:59.000000000 +0000
++++ flite-1.2-release/lib/Makefile 2005-08-04 15:32:16.000000000 +0000
+@@ -61,4 +61,4 @@
+ endif
+
+ install:
+- @ tar cvf - $(ALL_LIBS) | ( cd $(INSTALLLIBDIR) && tar xf -)
++ @ tar cvf - $(ALL_LIBS) | ( cd $(DESTDIR)$(INSTALLLIBDIR) && tar xf -)
+--- flite-1.2-release/Makefile.ark 2005-08-04 15:31:16.000000000 +0000
++++ flite-1.2-release/Makefile 2005-08-04 15:31:57.000000000 +0000
+@@ -79,13 +79,13 @@
+
+ install:
+ @echo Installing
+- mkdir -p $(INSTALLBINDIR)
+- mkdir -p $(INSTALLLIBDIR)
+- mkdir -p $(INSTALLINCDIR)
+- $(INSTALL) -m 644 include/*.h $(INSTALLINCDIR)
+- @ $(MAKE) -C lib --no-print-directory install
+- $(INSTALL) -m 755 bin/flite $(INSTALLBINDIR)
+- $(INSTALL) -m 755 bin/flite_time $(INSTALLBINDIR)
++ mkdir -p $(DESTDIR)$(INSTALLBINDIR)
++ mkdir -p $(DESTDIR)$(INSTALLLIBDIR)
++ mkdir -p $(DESTDIR)$(INSTALLINCDIR)
++ $(INSTALL) -m 644 include/*.h $(DESTDIR)$(INSTALLINCDIR)
++ @ $(MAKE) -C lib --no-print-directory install DESTDIR="$(DESTDIR)"
++ $(INSTALL) -m 755 bin/flite $(DESTDIR)$(INSTALLBINDIR)
++ $(INSTALL) -m 755 bin/flite_time $(DESTDIR)$(INSTALLBINDIR)
+
+ time-stamp :
+ @ echo $(PROJECT_NAME) >.time-stamp
--- /dev/null
+--- flite-1.2-release/src/audio/au_alsa.c.alsa 2001-12-04 21:05:52 +0300
++++ flite-1.2-release/src/audio/au_alsa.c 2005-10-31 14:53:35 +0300
+@@ -46,98 +46,117 @@
+ #include "cst_wave.h"
+ #include "cst_audio.h"
+
+-#include <sys/asoundlib.h>
++#include <alsa/asoundlib.h>
+
+ #include <sys/stat.h>
+ #include <fcntl.h>
+
+-static int alsa_card = 0, alsa_device = 0;
++#ifndef CST_AUDIO_ALSA_DEVICE
++#define CST_AUDIO_ALSA_DEVICE "default"
++#endif
++
++#ifdef CST_AUDIO_ALSA_DEBUG
++static snd_output_t *sndout;
++#endif
++
++static int framebits;
+
+ cst_audiodev *audio_open_alsa(int sps, int channels, cst_audiofmt fmt)
+ {
+- snd_pcm_channel_info_t pinfo;
+- snd_pcm_channel_params_t params;
+- snd_pcm_channel_setup_t setup;
+ snd_pcm_t *pcm;
+ cst_audiodev *ad;
++ snd_pcm_hw_params_t *params;
++ snd_pcm_format_t format = SND_PCM_FORMAT_S16;
++ snd_pcm_access_t access = SND_PCM_ACCESS_RW_INTERLEAVED;
++ unsigned int buffer_time = 500000; /* 0.5 sec */
++ unsigned int period_time = 100000; /* 0.1 sec */
++ unsigned int rate = sps;
+ int err;
+
+-#ifdef __QNXNTO__
+- if (snd_pcm_open_preferred(&pcm,&alsa_card,&alsa_device,SND_PCM_OPEN_PLAYBACK) < 0)
+- {
+- cst_errmsg("alsa_audio: failed to open audio device\n");
+- cst_error();
+- }
+- if (snd_pcm_plugin_set_disable(pcm,PLUGIN_DISABLE_MMAP) < 0)
+- {
+- cst_errmsg("alsa_audio: failed to disable mmap\n");
+- snd_pcm_close(pcm);
+- cst_error();
+- }
+-#else
+- if (snd_pcm_open(&pcm,alsa_card,alsa_device,SND_PCM_OPEN_PLAYBACK) < 0)
+- {
+- cst_errmsg("alsa_audio: failed to open audio device\n");
+- cst_error();
+- }
+-#endif
+-
+-
+- memset(&pinfo, 0, sizeof(pinfo));
+- memset(¶ms, 0, sizeof(params));
+- memset(&setup, 0, sizeof(setup));
+-
+- pinfo.channel = SND_PCM_CHANNEL_PLAYBACK;
+- snd_pcm_plugin_info(pcm,&pinfo);
+-
+- params.mode = SND_PCM_MODE_BLOCK;
+- params.channel = SND_PCM_CHANNEL_PLAYBACK;
+- params.start_mode = SND_PCM_START_DATA;
+- params.stop_mode = SND_PCM_STOP_STOP;
+-
+- params.buf.block.frag_size = pinfo.max_fragment_size;
+- params.buf.block.frags_max = 1;
+- params.buf.block.frags_min = 1;
+-
+- params.format.interleave = 1;
+- params.format.rate = sps;
+- params.format.voices = channels;
+-
+- switch (fmt)
+- {
++ switch (fmt) {
+ case CST_AUDIO_LINEAR16:
+- if (CST_LITTLE_ENDIAN)
+- params.format.format = SND_PCM_SFMT_S16_LE;
+- else
+- params.format.format = SND_PCM_SFMT_S16_BE;
+- break;
++ if (CST_LITTLE_ENDIAN)
++ format = SND_PCM_FORMAT_S16_LE;
++ else
++ format = SND_PCM_FORMAT_S16_BE;
++ break;
+ case CST_AUDIO_LINEAR8:
+- params.format.format = SND_PCM_SFMT_U8;
+- break;
++ format = SND_PCM_FORMAT_U8;
++ break;
+ case CST_AUDIO_MULAW:
+- params.format.format = SND_PCM_SFMT_MU_LAW;
+- break;
++ format = SND_PCM_FORMAT_MU_LAW;
++ break;
++ default:
++ cst_errmsg("alsa_audio: unexpected format requested\n");
+ }
+
+- if((err = snd_pcm_plugin_params(pcm,¶ms)) < 0)
+- {
+- cst_errmsg("alsa_audio params setting failed: %s\n",snd_strerror(err));
+- snd_pcm_close(pcm);
+- cst_error();
+- }
+- if((err = snd_pcm_plugin_setup(pcm,SND_PCM_CHANNEL_PLAYBACK)) > 0) {
+- cst_errmsg("alsa_audio sound prepare setting failed: %s\n",snd_strerror(err));
+- snd_pcm_close(pcm);
+- cst_error();
+- }
+- if((err = snd_pcm_plugin_prepare(pcm,SND_PCM_CHANNEL_PLAYBACK)) > 0) {
+- cst_errmsg("alsa_audio sound prepare setting failed: %s\n",snd_strerror(err));
+- snd_pcm_close(pcm);
+- cst_error();
+- }
++#ifdef CST_AUDIO_ALSA_DEBUG
++ if (0 > (err = snd_output_stdio_attach(&sndout, stderr, 0))) {
++ cst_errmsg("alsa_audio: failed to open log\n");
++ cst_error();
++ return NULL;
++ }
++#endif
+
+- pinfo.channel = SND_PCM_CHANNEL_PLAYBACK;
+- snd_pcm_plugin_info(pcm,&pinfo);
++ if (0 > (err = snd_pcm_open(&pcm, CST_AUDIO_ALSA_DEVICE, SND_PCM_STREAM_PLAYBACK, 0))) {
++ cst_errmsg("alsa_audio: failed to open audio device: %s\n", snd_strerror(err));
++ cst_error();
++ return NULL;
++ }
++
++ snd_pcm_hw_params_alloca(¶ms);
++
++ if ((err = snd_pcm_hw_params_any(pcm, params)) < 0) {
++ cst_errmsg("alsa_audio: failed to get configuration: %s\n", snd_strerror(err));
++ goto bailout;
++ }
++
++ if ((err = snd_pcm_hw_params_set_access(pcm, params, access)) < 0) {
++ cst_errmsg("alsa_audio: failed to set access type: %s\n", snd_strerror(err));
++ goto bailout;
++ }
++
++ if (0 > (err = snd_pcm_hw_params_set_format (pcm, params, format))) {
++ cst_errmsg("alsa_audio: failed to set sample format: %s\n", snd_strerror(err));
++ goto bailout;
++ }
++
++ if (0 > (err = snd_pcm_hw_params_set_channels(pcm, params, channels))) {
++ cst_errmsg("alsa_audio: failed to set channels count %d: %s\n", channels, snd_strerror(err));
++ goto bailout;
++ }
++
++ if (0 > (err = snd_pcm_hw_params_set_rate(pcm, params, rate, 0))) {
++ cst_errmsg("alsa_audio: failed to set sample rate: %s\n", snd_strerror(err));
++ goto bailout;
++ }
++
++ if (0 > (err = snd_pcm_hw_params_set_buffer_time_near(pcm, params, &buffer_time, NULL))) {
++ cst_errmsg("alsa_audio: failed to set buffer time: %s\n", snd_strerror(err));
++ goto bailout;
++ }
++
++ if (0 > (err = snd_pcm_hw_params_set_period_time_near(pcm, params, &period_time, NULL))) {
++ cst_errmsg("alsa_audio: failed to set period time: %s\n", snd_strerror(err));
++ goto bailout;
++ }
++
++ if (0 > (err = snd_pcm_hw_params(pcm, params))) {
++ cst_errmsg("alsa_audio: failed to set hw params: %s\n", snd_strerror(err));
++ goto bailout;
++ }
++
++ /* FIXME */
++ if (0 > (err = snd_pcm_hw_params_get_sbits(params))) {
++ cst_errmsg("alsa_audio: failed to get sbits: %s\n", snd_strerror(err));
++ goto bailout;
++ }
++
++ framebits = err * channels;
++
++#ifdef CST_AUDIO_ALSA_DEBUG
++ snd_pcm_hw_params_dump(params, sndout);
++#endif
+
+ ad = cst_alloc(cst_audiodev, 1);
+ ad->platform_data = pcm;
+@@ -146,6 +165,16 @@
+ ad->fmt = ad->real_fmt = fmt;
+
+ return ad;
++
++ bailout:
++
++#ifdef CST_AUDIO_ALSA_DEBUG
++ snd_pcm_hw_params_dump(params, sndout);
++#endif
++ snd_pcm_close(pcm);
++ cst_error();
++
++ return NULL;
+ }
+
+ int audio_close_alsa(cst_audiodev *ad)
+@@ -156,7 +185,7 @@
+ return 0;
+
+ pcm = ad->platform_data;
+- snd_pcm_plugin_flush(pcm,0);
++ snd_pcm_drop(pcm);
+ snd_pcm_close(pcm);
+ cst_free(ad);
+
+@@ -166,21 +195,35 @@
+ int audio_write_alsa(cst_audiodev *ad, void *samples, int num_bytes)
+ {
+ snd_pcm_t *pcm = ad->platform_data;
++ snd_pcm_uframes_t nframes = (num_bytes << 3) / framebits;
++ int err;
+
+- return snd_pcm_plugin_write(pcm,samples,num_bytes);
++ while (nframes > 0) {
++ if (0 > (err = snd_pcm_writei(pcm, samples, nframes))) {
++ if (err == -EAGAIN) continue;
++ if (err == -EPIPE) {
++ if (snd_pcm_prepare(pcm) < 0) return 0;
++ else continue;
++ }
++ }
++
++ samples += (err * framebits) >> 3;
++ nframes -= err;
++ }
++
++ return num_bytes;
+ }
+
+ int audio_flush_alsa(cst_audiodev *ad)
+ {
+ snd_pcm_t *pcm = ad->platform_data;
+
+- return snd_pcm_plugin_flush(pcm,0);
++ return snd_pcm_drop(pcm);
+ }
+
+ int audio_drain_alsa(cst_audiodev *ad)
+ {
+ snd_pcm_t *pcm = ad->platform_data;
+
+- return snd_pcm_plugin_playback_drain(pcm);
++ return snd_pcm_drain(pcm);
+ }
+-
+--- flite-1.2-release/configure.in.alsa 2003-02-18 03:45:45 +0300
++++ flite-1.2-release/configure.in 2005-10-31 14:50:54 +0300
+@@ -131,9 +131,10 @@
+ AC_CHECK_HEADER(sys/audioio.h,
+ [AUDIODRIVER="sun"
+ AUDIODEFS=-DCST_AUDIO_SUNOS])
+-AC_CHECK_HEADER(sys/asoundlib.h,
++AC_CHECK_HEADER(alsa/asoundlib.h,
+ [AUDIODRIVER="alsa"
+- AUDIODEFS=-DCST_AUDIO_ALSA])
++ AUDIODEFS=-DCST_AUDIO_ALSA
++ AUDIOLIBS=-lasound])
+ AC_CHECK_HEADER(mmsystem.h,
+ [AUDIODRIVER="wince"
+ AUDIODEFS=-DCST_AUDIO_WINCE
--- /dev/null
+--- flite-1.2-release.orig/doc/Makefile
++++ flite-1.2-release/doc/Makefile
+@@ -52,7 +52,8 @@
+ flite.html: flite.texi
+ @ if [ ! -d html ] ; \
+ then mkdir -p html ; fi
+- (cd html; texi2html -number -split_chapter ../flite.texi)
++ (cd html; texi2html -number -split_chapter ../flite.texi; \
++ mv flite/*.html .; rm -rf flite)
+ @ for i in html/*.html ; \
+ do \
+ sed 's/<BODY>/<BODY bgcolor="#ffffff">/' $$i >ttt.html; \
+--- flite-1.2-release.orig/doc/flite.texi
++++ flite-1.2-release/doc/flite.texi
+@@ -16,6 +16,11 @@
+ @set UPDATED 19th February 2003
+
+ @ifinfo
++@dircategory Miscellaneous
++@direntry
++* Festival Lite: (flite). Lightweight Speech synthesis engine.
++@end direntry
++
+ This file documents @code{Flite}, a small, fast run-time speech
+ synthesis engine.
+
+@@ -510,7 +515,7 @@
+ distribution, the example diphone voice is @code{cmu_us_kal}.
+
+ Here is a simple C program that uses the flite library
+-@example
++@verbatim
+ #include "flite.h"
+
+ cst_voice *register_cmu_us_kal();
+@@ -532,7 +537,7 @@
+ flite_file_to_speech(argv[1],v,"play");
+
+ }
+-@end example
++@end verbatim
+ Assuming the shell variable FLITEDIR is set to the flite directory
+ the following will compile the system (with appropriate changes for
+ your platform if necessary).
+--- flite-1.2-release.orig/debian/flite.1
++++ flite-1.2-release/debian/flite.1
+@@ -0,0 +1,65 @@
++.TH FLITE 1 "February 25, 2003"
++.SH NAME
++flite \- A small simple speech synthesizer
++.SH SYNOPSIS
++.B flite
++[\fIOPTION\fR]... \fITEXTFILE\fR [\fIWAVEFILE\fR]
++.SH DESCRIPTION
++This manual page documents briefly the
++.B flite
++command.
++This manual page was written for the Debian distribution
++because the original program does not have a manual page.
++Instead, it has documentation in /usr/share/doc/flite/
++.PP
++Converts text in TEXTFILE to a waveform in WAVEFILE.
++If text contains a space, it is treated as a literal
++textstring and spoken, and not as a file name.
++if WAVEFILE is unspecified or "play" the result is
++played on the current systems audio device. If WAVEFILE
++is "none" the waveform is discarded (good for benchmarking)
++.SH OPTIONS
++.TP
++\fB\-\-version\fR
++Output \fBflite\fP version number.
++.TP
++\fB\-?\fR, \fB\-\-help\fR
++Output usage information.
++.TP
++\fB\-o\fR WAVEFILE
++Explicitly set output filename.
++.TP
++\fB\-f\fR TEXTFILE
++Explicitly set input filename.
++.TP
++\fB\-t\fR TEXT
++Explicitly set input text string.
++.TP
++\fB\-p\fR PHONES
++Explicitly set input text string and synthesize as phones.
++.TP
++\fB\-s\fR, \fB\-\-set\fR FEATURE=VALUE
++Set feature (guesses type).
++.TP
++\fB\-\-seti\fR FEATURE=VALUE
++Set int feature.
++.TP
++\fB\-\-setf\fR FEATURE=VALUE
++Set float feature.
++.TP
++\fB\-\-sets\fR FEATURE=VALUE
++Set string feature.
++.TP
++\fB\-b\fR
++Benchmark mode.
++.TP
++\fB\-l\fR
++Loop endlessly.
++.TP
++\fB\-v\fR
++Verbose output.
++.SH SEE ALSO
++.BR flite_time (1), " " t2p (1), " " festival (1)
++.SH AUTHOR
++This manual page was written by Mario Lang <mlang@debian.org>,
++for the Debian GNU/Linux system (but may be used by others).
+--- flite-1.2-release.orig/debian/t2p.1
++++ flite-1.2-release/debian/t2p.1
+@@ -0,0 +1,19 @@
++.TH T2P 1 "February 25, 2003"
++.SH NAME
++t2p \- A text to phoneme converter
++.SH SYNOPSIS
++.B t2p
++"word word word"
++.SH DESCRIPTION
++.B t2p
++converts text specified on the command-line into US english phonemes.
++Output is given to STDOUT.
++
++.SH OPTIONS
++No options.
++
++.SH SEE ALSO
++.BR flite (1), " " flite_time (1), " " festival (1)
++.SH AUTHOR
++This manual page was written by Mario Lang <mlang@debian.org>,
++for the Debian GNU/Linux system (but may be used by others).
+--- flite-1.2-release.orig/debian/flite_time.1
++++ flite-1.2-release/debian/flite_time.1
+@@ -0,0 +1,24 @@
++.TH FLITE_TIME 1 "February 25, 2003"
++.SH NAME
++flite_time \- A talking clock based on a limited-domain voice
++.SH SYNOPSIS
++.B flite_time
++.I HH:MM
++.SH DESCRIPTION
++.B flite_time
++is a example talking clock based on a limited domain
++voice from Festival Lite.
++
++.SH OPTIONS
++Specify the time you want to have announced at the
++command-line using the format HH:MM.
++
++.SH EXAMPLES
++.IP "flite_time `date +%H:%M`" 4
++Announce the current time.
++
++.SH SEE ALSO
++.BR flite (1), " " festival (1)
++.SH AUTHOR
++This manual page was written by Mario Lang <mlang@debian.org>,
++for the Debian GNU/Linux system (but may be used by others).
--- /dev/null
+diff -urN flite-1.2-release.orig/include/cst_sts.h flite-1.2-release/include/cst_sts.h
+--- flite-1.2-release.orig/include/cst_sts.h 2002-12-23 16:55:05.000000000 +0100
++++ flite-1.2-release/include/cst_sts.h 2004-10-04 21:10:22.000000000 +0200
+@@ -47,9 +47,9 @@
+ /* else where, this information plus the indexes in the Unit relation */
+ /* allow reconstruction of the signal itself */
+ struct cst_sts_struct {
+- const unsigned short *frame;
+- const int size; /* in samples */
+- const unsigned char *residual;
++ unsigned short *frame;
++ int size; /* in samples */
++ unsigned char *residual;
+ };
+ typedef struct cst_sts_struct cst_sts;
+
--- /dev/null
+--- flite-1.2-release/config/common_make_rules..mk 2003-02-18 19:17:21 +0300
++++ flite-1.2-release/config/common_make_rules 2006-04-10 01:13:53 +0400
+@@ -52,7 +52,14 @@
+ LIBDIR=$(TOP)/lib
+
+ FLITELIBS = $(TOP)/lib/libflite.a
+-LDFLAGS += -L$(TOP)/lib -lflite -lm $(AUDIOLIBS) $(OTHERLIBS)
++LDFLAGS += -L$(TOP)/lib -lflite $(OTHERLIBS)
++
++flite_LDLIBS = $(AUDIOLIBS) -lm
++flite_cmulex_LDLIBS = -lflite
++flite_usenglish_LDLIBS = -lflite
++flite_cmu_us_kal_LDLIBS = -lflite_cmulex -lflite_usenglish
++flite_cmu_us_kal16_LDLIBS = -lflite_cmulex -lflite_usenglish
++flite_cmu_time_awb_LDLIBS = -lflite -lflite_cmulex -lflite_usenglish
+
+ ifdef SHFLAGS
+ SOOBJS = $(OBJS:.o=.os)
+@@ -88,7 +95,7 @@
+ @ rm -rf shared_os && mkdir shared_os
+ @ rm -f $@ $(LIBDIR)/$@.${PROJECT_VERSION} $(LIBDIR)/$@.${PROJECT_SHLIB_VERSION}
+ @ (cd shared_os && ar x ../$<)
+- @ (cd shared_os && $(CC) -shared -Wl,-soname,$@.${PROJECT_SHLIB_VERSION} -o ../$@.${PROJECT_VERSION} *.os)
++ @ (cd shared_os && $(CC) -shared -Wl,-soname,$@.${PROJECT_SHLIB_VERSION} -Wl,-rpath-link -Wl,../ -L../ -o ../$@.${PROJECT_VERSION} *.os $($(@:lib%.so=%_LDLIBS)))
+ @ ln -s $(LIBDIR)/$@.${PROJECT_VERSION} $(LIBDIR)/$@.${PROJECT_SHLIB_VERSION}
+ @ ln -s $(LIBDIR)/$@.${PROJECT_SHLIB_VERSION} $(LIBDIR)/$@
+ @ rm -rf shared_os
+--- flite-1.2-release/doc/Makefile..mk 2002-12-30 15:57:30 +0300
++++ flite-1.2-release/doc/Makefile 2006-04-10 01:12:41 +0400
+@@ -40,7 +40,7 @@
+ ALL_DIRS=
+ FILES = Makefile flite.texi intro.txt alice stuff.ed
+
+-ALL =
++ALL = flite.html
+
+ include $(TOP)/config/common_make_rules
+
+--- flite-1.2-release/main/Makefile..mk 2003-02-20 01:17:31 +0300
++++ flite-1.2-release/main/Makefile 2006-04-10 01:12:41 +0400
+@@ -49,11 +49,11 @@
+ $(BINDIR)/t2p$(EXEEXT)
+
+ flite_LIBS = flite_$(FL_VOX) flite_$(FL_LANG) flite_$(FL_LEX)
+-flite_LIBS_flags = -L$(LIBDIR) $(flite_LIBS:%=-l%)
++flite_LIBS_flags = -L$(LIBDIR) -Wl,-rpath-link -Wl,$(LIBDIR) $(flite_LIBS:%=-l%)
+ flite_LIBS_deps = $(flite_LIBS:%=$(LIBDIR)/lib%.a)
+
+ flite_time_LIBS = flite_cmu_time_awb flite_$(FL_LANG) flite_$(FL_LEX)
+-flite_time_LIBS_flags = -L$(LIBDIR) $(flite_time_LIBS:%=-l%)
++flite_time_LIBS_flags = -L$(LIBDIR) -Wl,-rpath-link -Wl,$(LIBDIR) $(flite_time_LIBS:%=-l%)
+ flite_time_LIBS_deps = $(flite_time_LIBS:%=$(LIBDIR)/lib%.a)
+
+ include $(TOP)/config/common_make_rules
+--- flite-1.2-release/Makefile..mk 2003-02-17 18:14:05 +0300
++++ flite-1.2-release/Makefile 2006-04-10 01:15:02 +0400
+@@ -41,7 +41,7 @@
+ ###########################################################################
+ TOP=.
+ DIRNAME=.
+-BUILD_DIRS = include src lang lib tools doc main
++BUILD_DIRS = include src lang lib main doc
+ ALL_DIRS=config $(BUILD_DIRS) testsuite sapi
+ CONFIG=configure configure.in config.sub config.guess \
+ missing install-sh mkinstalldirs
--- /dev/null
+--- flite-1.2-release.orig/include/flite_version.h
++++ flite-1.2-release/include/flite_version.h
+@@ -0,0 +1,6 @@
++#define FLITE_PROJECT_NAME "Festival Lite"
++#define FLITE_PROJECT_PREFIX "flite"
++#define FLITE_PROJECT_VERSION "1.2"
++#define FLITE_PROJECT_DATE "Feb 2003"
++#define FLITE_PROJECT_STATE "release"
++#define FLITE_PROJECT_SHLIB_VERSION "1"