--- festival-1.4.3.orig/examples/text2wave.sh +++ festival-1.4.3/examples/text2wave.sh @@ -40,7 +40,7 @@ ;;; Because this is a --script type file I has to explicitly ;;; load the initfiles: init.scm and user's .festivalrc -(load (path-append libdir "init.scm")) +(load (path-append datadir "init.scm")) ;;; Process command line arguments (define (text2wave_help) --- festival-1.4.3.orig/examples/dumpfeats.sh +++ festival-1.4.3/examples/dumpfeats.sh @@ -39,7 +39,7 @@ ;;; Because this is a --script type file it has to explicitly ;;; load the initfiles: init.scm and user's .festivalrc -(load (path-append libdir "init.scm")) +(load (path-append datadir "init.scm")) (define (dumpfeats_help) (format t "%s\n" --- festival-1.4.3.orig/examples/make_utts.sh +++ festival-1.4.3/examples/make_utts.sh @@ -44,7 +44,7 @@ ;;; Because this is a --script type file it has to explicitly ;;; load the initfiles: init.scm and user's .festivalrc (if (not (symbol-bound? 'caar)) - (load (path-append libdir "init.scm"))) + (load (path-append datadir "init.scm"))) ;;; Some parts are potentially editable (defvar basic_relations '((Phrase segmental ()) --- festival-1.4.3.orig/examples/scfg_parse_text.sh +++ festival-1.4.3/examples/scfg_parse_text.sh @@ -45,7 +45,7 @@ ;;; Because this is a --script type file I has to explicitly ;;; load the initfiles: init.scm and user's .festivalrc -(load (path-append libdir "init.scm")) +(load (path-append datadir "init.scm")) (require 'scfg) @@ -66,7 +66,7 @@ (gc-status nil) ;;; Default argument values -(defvar grammarfile (path-append libdir "scfg_wsj_wp20.gram")) +(defvar grammarfile (path-append datadir "scfg_wsj_wp20.gram")) (defvar outfile "-") (defvar outfd t) (defvar parse_type 'brackets_only) --- festival-1.4.3.orig/examples/durmeanstd.sh +++ festival-1.4.3/examples/durmeanstd.sh @@ -40,7 +40,7 @@ ;;; Because this is a --script type file it has to explicitly ;;; load the initfiles: init.scm and user's .festivalrc -(load (path-append libdir "init.scm")) +(load (path-append datadir "init.scm")) (define (durmeanstd_help) (format t "%s\n" --- festival-1.4.3.orig/examples/text2pos.sh +++ festival-1.4.3/examples/text2pos.sh @@ -50,7 +50,7 @@ ;;; Because this is a --script type file I has to explicitly ;;; load the initfiles: init.scm and user's .festivalrc -(load (path-append libdir "init.scm")) +(load (path-append datadir "init.scm")) (define (find-pos utt) "Main function for processing TTS utterances. Predicts POS and --- festival-1.4.3.orig/examples/benchmark.text +++ festival-1.4.3/examples/benchmark.text @@ -32,8 +32,13 @@ --libdir PATH Specify alternate to default library directory (used - in initializing the variable load-path, and for - loading most intinialisation files) + for architecture-specific libraries and programs) + + --datadir PATH + Specify alternate to default shared-data directory (used + in initializing the variable load-path, and for + loading most initialisation files). Typically, the voice and + dictionary files reside here. -b or --batch Run in batch mode. In batch mode no input is read --- festival-1.4.3.orig/examples/benchmark +++ festival-1.4.3/examples/benchmark @@ -1,6 +1,7 @@ #!/bin/sh -default_libdir="/projects/festival/lib" +default_libdir="/usr/lib/festival" +default_datadir="/usr/share/festival" while true do @@ -11,13 +12,17 @@ -l ) libdir="$2" shift 2 ;; + -d ) datadir="$2" + shift 2 + ;; + -- ) shift; break ;; * ) break;; esac done -text=${1-"$HOME/projects/festival/examples/benchmark.text"} +text=${1-"/usr/share/doc/festival/examples/benchmark.text"} -for i in . src/main ../src/main $HOME/projects/festival/src/main /cstr/bin +for i in /usr/bin . src/main ../src/main $HOME/projects/festival/src/main /cstr/bin do if [ -n "$festival" ] then @@ -39,7 +44,15 @@ then case $festival in *main/festival ) libdir=`dirname $festival`/../../lib;; - * ) libdir=$default_libdir;; + * ) libdir=$default_libdir; + esac +fi + +if [ -z "$datadir" ] + then + case $festival in + *main/festival ) datadir=`dirname $festival`/../../share;; + * ) datadir=$default_datadir;; esac fi @@ -54,10 +67,11 @@ cat > $script <<__END__ (set! libdir "$libdir/") -(set! lexdir "$default_libdir/dicts/") -(set! voiced_dir "$default_libdir/voices/") +(set! datadir "$datadir/") +(set! lexdir "$default_datadir/dicts/") +(set! voiced_dir "$default_datadir/voices/") -(load (string-append libdir "init.scm")) +(load (string-append datadir "init.scm")) (if (probe_file (format nil "%s/.festivalrc" (getenv "HOME"))) (load (format nil "%s/.festivalrc" (getenv "HOME")))) --- festival-1.4.3.orig/examples/latest.sh +++ festival-1.4.3/examples/latest.sh @@ -50,7 +50,7 @@ ;;; Because this is a --script type file I has to explicitly ;;; load the initfiles: init.scm and user's .festivalrc -(load (path-append libdir "init.scm")) +(load (path-append datadir "init.scm")) (audio_mode 'async) ;; play waves while continuing synthesis --- festival-1.4.3.orig/examples/saytime.sh +++ festival-1.4.3/examples/saytime.sh @@ -44,7 +44,7 @@ ;;; Because this is a --script type file I has to explicitly ;;; load the initfiles: init.scm and user's .festivalrc -(load (path-append libdir "init.scm")) +(load (path-append datadir "init.scm")) (define (get-the-time) "Returns a list of hour and minute and second, for later processing" --- festival-1.4.3.orig/lib/init.scm +++ festival-1.4.3/lib/init.scm @@ -36,7 +36,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Basic siod library (need this before load_library or require works) -(load (path-append libdir "siod.scm")) +(load (path-append datadir "siod.scm")) (defvar home-directory (or (getenv "HOME") "/") "home-directory --- festival-1.4.3.orig/lib/phrase.scm +++ festival-1.4.3/lib/phrase.scm @@ -93,7 +93,7 @@ (require 'pos) ;; for part of speech map -(defvar pbreak_ngram_dir libdir +(defvar pbreak_ngram_dir datadir "pbreak_ngram_dir The directory containing the ngram models for predicting phrase breaks. By default this is the standard library directory.") --- festival-1.4.3.orig/lib/soleml-mode.scm +++ festival-1.4.3/lib/soleml-mode.scm @@ -330,7 +330,7 @@ (list 'exit_func soleml_exit_func) '(analysis_type xxml) (list 'filter - (format nil "%s -D %s " sgml_parse_progname libdir)))) + (format nil "%s -D %s " sgml_parse_progname datadir)))) tts_text_modes)) (provide 'soleml-mode) --- festival-1.4.3.orig/src/main/festival_main.cc +++ festival-1.4.3/src/main/festival_main.cc @@ -74,8 +74,8 @@ "In evaluation mode \"filenames\" starting with ( are evaluated inline\n"+ "Festival Speech Synthesis System: "+ festival_version +"\n"+ "-q Load no default setup files\n"+ - "--libdir \n"+ - " Set library directory pathname\n"+ + "--datadir \n"+ + " Set data directory pathname\n"+ "-b Run in batch mode (no interaction)\n"+ "--batch Run in batch mode (no interaction)\n"+ "--tts Synthesize text in files as speech\n"+ @@ -113,6 +115,12 @@ festival_libdir = wstrdup(al.val("--libdir")); else if (getenv("FESTLIBDIR") != 0) festival_libdir = getenv("FESTLIBDIR"); + + if (al.present("--datadir")) + festival_datadir = wstrdup(al.val("--datadir")); + else if (getenv("FESTDATADIR") != 0) + festival_datadir = getenv("FESTDATADIR"); + if (al.present("--heap")) heap_size = al.ival("--heap"); --- festival-1.4.3.orig/doc/doc.scm +++ festival-1.4.3/doc/doc.scm @@ -0,0 +1,4 @@ +(load (path-append datadir "siod.scm")) +(load (path-append datadir "cstr.scm")) +(load_library "festdoc.scm") +(make-doc) --- festival-1.4.3.orig/src/include/festival.h +++ festival-1.4.3/src/include/festival.h @@ -134,6 +134,7 @@ void add_item_features(EST_Item *s,LISP features); extern const char *festival_libdir; +extern const char *festival_datadir; // Module specific LISP/etc definitions void festival_init_modules(void); --- festival-1.4.3.orig/lib/lexicons.scm +++ festival-1.4.3/lib/lexicons.scm @@ -42,8 +42,8 @@ ;;; you should set lexdir in sitevars.scm (defvar lexdir - (if (probe_file (path-append libdir "dicts")) - (path-append libdir "dicts/") + (if (probe_file (path-append datadir "dicts")) + (path-append datadir "dicts/") ;; else we'll guess we're in the CSTR filespace (path-as-directory "/usr/share/festival/dicts/")) "lexdir --- festival-1.4.3.orig/src/arch/festival/festival.cc +++ festival-1.4.3/src/arch/festival/festival.cc @@ -74,7 +74,10 @@ #define FTOSTYPE "" #endif -const char *festival_libdir = FTLIBDIR; +const char *festival_libdir = "/usr/lib/festival"; +const char *festival_datadir = "/usr/share/festival"; +const char *festival_sysconfdir = "/etc"; + ostream *cdebug; static int festival_server_port = 1314; static EST_StrList sub_copyrights; @@ -299,7 +302,7 @@ EST_String userinitfile, home_str, initfile; // Load library init first - initfile = (EST_String)EST_Pathname(festival_libdir).as_directory() + + initfile = (EST_String)EST_Pathname(festival_datadir).as_directory() + "init.scm"; if (access((const char *)initfile,R_OK) == 0) vload(initfile,FALSE); @@ -315,6 +318,8 @@ int major,minor,subminor; siod_set_lval("libdir",strintern(festival_libdir)); + siod_set_lval("datadir",strintern(festival_datadir)); + siod_set_lval("sysconfdir",strintern(festival_sysconfdir)); if (!streq(FTOSTYPE,"")) siod_set_lval("*ostype*",cintern(FTOSTYPE)); siod_set_lval("festival_version", --- festival-1.4.3.orig/doc/festival.texi +++ festival-1.4.3/doc/festival.texi @@ -951,12 +953,12 @@ @code{voices_dir} (pointing to voice directories) should be reset here if necessary. -@cindex change libdir at run-time +@cindex change libdir or datadir at run-time @cindex run-time configuration @cindex @code{load-path} The default installation will try to find its lexicons and voices automatically based on the value of @code{load-path} (this is derived -from @code{FESTIVAL_HOME} at compilation time or by using the @code{--libdir} +from @code{FESTIVAL_HOME} at compilation time or by using the @code{--datadir} at run-time). If the voices and lexicons have been unpacked into subdirectories of the library directory (the default) then no site specific initialization of the above pathnames will be necessary. @@ -1085,7 +1087,9 @@ Copyright (C) University of Edinburgh, 1996-2003. All rights reserved. For details type `(festival_warranty)' festival> libdir -"/projects/festival/lib/" +"/usr/lib/festival" +festival> datadir +"/usr/share/festival" festival> ^D @end example This should show the pathname you set in your @file{config/config}.