shithub: flite

Download patch

ref: 82ccfd17ad7ad52e64651a9d63092a3e8f282567
parent: 2dabff3c93c430a7e5578327227e8b6789c31ccd
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Thu Jun 3 16:04:15 EDT 2021

plan 9 port

--- /dev/null
+++ b/README_Plan9.md
@@ -1,0 +1,6 @@
+# flite for Plan 9
+
+Install [npe](https://git.sr.ht/~ft/npe) first, then run `mk install`.
+The program is installed as `audio/flite`.  It reads `stdin` line by
+line and dumps raw PCM to `stdout`, ready to be redirected to
+`/dev/audio`.
--- a/include/cst_audio.h
+++ b/include/cst_audio.h
@@ -110,7 +110,7 @@
                               /* But this is *not* updated automatically */
     void *userdata;
 } cst_audio_streaming_info;
-cst_audio_streaming_info *new_audio_streaming_info();
+cst_audio_streaming_info *new_audio_streaming_info(void);
 void delete_audio_streaming_info(cst_audio_streaming_info *asi);
 CST_VAL_USER_TYPE_DCLS(audio_streaming_info,cst_audio_streaming_info)
 typedef int (*cst_audio_stream_callback)(const cst_wave *w,int start,int size, 
--- a/include/cst_features.h
+++ b/include/cst_features.h
@@ -49,6 +49,7 @@
     cst_val *val;
     struct cst_featvalpair_struct *next;
 } cst_featvalpair;
+#pragma incomplete cst_featvalpair
 
 typedef struct cst_features_struct {
     struct cst_featvalpair_struct *head;
@@ -58,6 +59,7 @@
     /* Link to other cst_features that we search too */
     const struct cst_features_struct *linked; 
 } cst_features;
+#pragma incomplete cst_features
 
 /* Constructor functions */
 cst_features *new_features(void);
--- a/include/cst_item.h
+++ b/include/cst_item.h
@@ -57,6 +57,7 @@
     cst_features *features;
     cst_features *relations;
 } cst_item_contents;
+#pragma incomplete cst_item_contents
 
 struct cst_item_struct {
     cst_item_contents *contents;  /* the shared part of an item */
@@ -66,6 +67,8 @@
     cst_item *u;
     cst_item *d;
 };
+#pragma incomplete cst_item
+#pragma incomplete cst_relation
 
 /* Constructor functions */
 cst_item *new_item_relation(cst_relation *r,cst_item *i);
--- a/include/cst_lexicon.h
+++ b/include/cst_lexicon.h
@@ -70,8 +70,13 @@
     cst_val *lex_addenda;  /* For pronunciations added at run time */
 
 } cst_lexicon;
+#pragma incomplete cst_lexicon
+#pragma incomplete cst_utterance
+#pragma incomplete cst_val
+#pragma incomplete cst_lts_rules
+#pragma incomplete cst_features
 
-cst_lexicon *new_lexicon();
+cst_lexicon *new_lexicon(void);
 void delete_lexicon(cst_lexicon *lex);
 
 cst_val *cst_lex_make_entry(const cst_lexicon *lex, 
--- a/include/cst_lts.h
+++ b/include/cst_lts.h
@@ -69,7 +69,7 @@
     cst_lts_addr   qfalse;
 } cst_lts_rule;
 
-cst_lts_rules *new_lts_rules();
+cst_lts_rules *new_lts_rules(void);
 
 cst_val *lts_apply(const char *word,const char *feats,const cst_lts_rules *r);
 cst_val *lts_apply_val(const cst_val *wlist,const char *feats,const cst_lts_rules *r);
--- a/include/cst_phoneset.h
+++ b/include/cst_phoneset.h
@@ -58,7 +58,7 @@
 typedef struct cst_phoneset_struct cst_phoneset;
 
 /* Constructor functions */
-cst_phoneset *new_phoneset();
+cst_phoneset *new_phoneset(void);
 void delete_phoneset(const cst_phoneset *u);
 
 const cst_val *phone_feature(const cst_phoneset *ps,
--- a/include/cst_regex.h
+++ b/include/cst_regex.h
@@ -137,7 +137,7 @@
 size_t cst_regsub(const cst_regstate *r, const char *in, char *out, size_t max);
 
 /* Initialize the regex engine and global regex constants */
-void cst_regex_init();
+void cst_regex_init(void);
 
 /* Regexps used in text processing (these are latin-alphabet specific
    and to some extent US English-specific) */
--- a/include/cst_ss.h
+++ b/include/cst_ss.h
@@ -46,7 +46,7 @@
     double sumx;
 } cst_ss;
 
-cst_ss *new_ss();
+cst_ss *new_ss(void);
 void delete_ss(cst_ss *ss);
 void ss_reset(cst_ss *ss);
 double ss_mean(cst_ss *ss);
--- a/include/cst_sts.h
+++ b/include/cst_sts.h
@@ -115,13 +115,13 @@
 };
 typedef struct cst_lpcres_struct cst_lpcres;
 
-cst_lpcres *new_lpcres();
+cst_lpcres *new_lpcres(void);
 void delete_lpcres(cst_lpcres *l);
 float lpcres_frame_shift(cst_lpcres *t, int frame);
 void lpcres_resize_frames(cst_lpcres *l,int num_frames);
 void lpcres_resize_samples(cst_lpcres *l,int num_samples);
 
-cst_sts_list *new_sts_list();
+cst_sts_list *new_sts_list(void);
 void delete_sts_list(cst_sts_list *l);
 
 const unsigned short * get_sts_frame(const cst_sts_list *sts_list, int frame);
--- a/include/cst_track.h
+++ b/include/cst_track.h
@@ -55,7 +55,7 @@
     float **frames;
 } cst_track;
 
-cst_track *new_track();
+cst_track *new_track(void);
 void delete_track(cst_track *val);
 
 float track_frame_shift(cst_track *t, int frame);
--- a/include/cst_utterance.h
+++ b/include/cst_utterance.h
@@ -53,9 +53,10 @@
     cst_features *relations;
     cst_alloc_context ctx;
 };
+#pragma incomplete cst_utterance
 
 /* Constructor functions */
-cst_utterance *new_utterance();
+cst_utterance *new_utterance(void);
 void delete_utterance(cst_utterance *u);
 
 cst_relation *utt_relation(const cst_utterance *u,const char *name);
--- a/include/cst_val.h
+++ b/include/cst_val.h
@@ -60,6 +60,7 @@
     struct cst_val_struct *car;
     struct cst_val_struct *cdr;
 }  cst_val_cons;
+#pragma incomplete cst_val_cons
 
 typedef struct  cst_val_atom_struct {
 #ifdef WORDS_BIGENDIAN
@@ -92,6 +93,7 @@
 #endif
     } v;
 } cst_val_atom;
+#pragma incomplete cst_val_atom
 
 typedef struct  cst_val_struct {
     union
@@ -100,11 +102,13 @@
 	cst_val_atom a;
     } c;
 } cst_val;
+#pragma incomplete cst_val
 
 typedef struct cst_val_def_struct {
     const char *name;
     void (*delete_function)(void *);
 } cst_val_def;
+#pragma incomplete cst_val_def
 
 /* Constructor functions */
 cst_val *int_val(int i);
--- a/include/cst_viterbi.h
+++ b/include/cst_viterbi.h
@@ -51,7 +51,7 @@
     cst_item *item;
     struct cst_vit_cand_struct *next;
 } cst_vit_cand;
-cst_vit_cand *new_vit_cand();
+cst_vit_cand *new_vit_cand(void);
 void vit_cand_set(cst_vit_cand *vc, cst_val *val);
 void vit_cand_set_int(cst_vit_cand *vc, int ival);
 void delete_vit_cand(cst_vit_cand *vc);
@@ -64,7 +64,7 @@
     struct cst_vit_path_struct *from;
     struct cst_vit_path_struct *next;
 } cst_vit_path;
-cst_vit_path *new_vit_path();
+cst_vit_path *new_vit_path(void);
 void delete_vit_path(cst_vit_path *vp);
 
 typedef struct cst_vit_point_struct {
@@ -76,7 +76,7 @@
     cst_vit_path **state_paths;
     struct cst_vit_point_struct *next;
 } cst_vit_point;
-cst_vit_point *new_vit_point();
+cst_vit_point *new_vit_point(void);
 void delete_vit_point(cst_vit_point *vp);
 
 struct cst_viterbi_struct;
--- a/include/cst_voice.h
+++ b/include/cst_voice.h
@@ -65,12 +65,12 @@
 struct cst_lang_struct {
     const char *lang;
     void (*lang_init)(cst_voice *vox);
-    cst_lexicon *(*lex_init)();
+    cst_lexicon *(*lex_init)(void);
 };
 typedef struct cst_lang_struct cst_lang;
 
 /* Constructor functions */
-cst_voice *new_voice();
+cst_voice *new_voice(void);
 void delete_voice(cst_voice *u);
 
 CST_VAL_USER_TYPE_DCLS(voice,cst_voice)
--- a/include/cst_wave.h
+++ b/include/cst_wave.h
@@ -64,7 +64,7 @@
     int num_channels;
 } cst_wave_header;
 
-cst_wave *new_wave();
+cst_wave *new_wave(void);
 cst_wave *copy_wave(const cst_wave *w);
 void delete_wave(cst_wave *val);
 cst_wave *concat_wave(cst_wave *dest, const cst_wave *src);
--- a/include/flite.h
+++ b/include/flite.h
@@ -76,7 +76,7 @@
  extern GLOBALVARDEF int flite_lang_list_length;
 
 /* Public functions */
-int flite_init();
+int flite_init(void);
 
 /* General top level functions */
 cst_voice *flite_voice_select(const char *name);
--- /dev/null
+++ b/lang/cmu_us_slt/mkfile
@@ -1,0 +1,25 @@
+<../../mkfile.common
+
+CFLAGS=$CFLAGS -I../usenglish -I../cmulex
+
+HFILES=\
+	cmu_us_slt_cg_durmodel.h\
+	cmu_us_slt_cg_f0_trees.h\
+	cmu_us_slt_cg_single_mcep_trees.h\
+	cmu_us_slt_spamf0_accent.h\
+	cmu_us_slt_spamf0_phrase.h\
+	voxdefs.h\
+
+OFILES=\
+	cmu_us_slt.$O\
+	cmu_us_slt_cg.$O\
+	cmu_us_slt_cg_durmodel.$O\
+	cmu_us_slt_cg_f0_trees.$O\
+	cmu_us_slt_cg_phonestate.$O\
+	cmu_us_slt_cg_single_mcep_trees.$O\
+	cmu_us_slt_cg_single_params.$O\
+	cmu_us_slt_spamf0_accent.$O\
+	cmu_us_slt_spamf0_accent_params.$O\
+	cmu_us_slt_spamf0_phrase.$O\
+
+</sys/src/cmd/mklib
--- /dev/null
+++ b/lang/cmulex/mkfile
@@ -1,0 +1,18 @@
+<../../mkfile.common
+
+HFILES=\
+	cmu_lex.h\
+	cmu_lex_entries_huff_table.c\
+	cmu_lex_num_bytes.c\
+	cmu_lex_phones_huff_table.c\
+	cmu_lts_model.h\
+
+OFILES=\
+	cmu_lex.$O\
+	cmu_lex_data.$O\
+	cmu_lex_entries.$O\
+	cmu_lts_model.$O\
+	cmu_lts_rules.$O\
+	cmu_postlex.$O\
+
+</sys/src/cmd/mklib
--- /dev/null
+++ b/lang/usenglish/mkfile
@@ -1,0 +1,34 @@
+<../../mkfile.common
+
+HFILES=\
+	us_durz_cart.h\
+	us_f0.h\
+	us_ffeatures.h\
+	us_int_accent_cart.h\
+	us_int_tone_cart.h\
+	us_nums_cart.h\
+	us_phrasing_cart.h\
+	us_pos_cart.h\
+	us_regexes.h\
+	us_text.h\
+	usenglish.h\
+
+OFILES=\
+	us_aswd.$O\
+	us_dur_stats.$O\
+	us_durz_cart.$O\
+	us_expand.$O\
+	us_f0_model.$O\
+	us_f0lr.$O\
+	us_ffeatures.$O\
+	us_gpos.$O\
+	us_int_accent_cart.$O\
+	us_int_tone_cart.$O\
+	us_nums_cart.$O\
+	us_phoneset.$O\
+	us_phrasing_cart.$O\
+	us_pos_cart.$O\
+	us_text.$O\
+	usenglish.$O\
+
+</sys/src/cmd/mklib
--- a/main/compile_regexes.c
+++ b/main/compile_regexes.c
@@ -48,7 +48,7 @@
 
 #include "flite.h"
 
-static void compregex_usage()
+static void compregex_usage(void)
 {
     printf("compregex: compile regexes into C structures\n");
     printf("usage: compregex name regex\n"
--- /dev/null
+++ b/main/flite_plan9.c
@@ -1,0 +1,182 @@
+/*************************************************************************/
+/*																	   */
+/*				  Language Technologies Institute					  */
+/*					 Carnegie Mellon University						*/
+/*						 Copyright (c) 2001							*/
+/*						All Rights Reserved.						   */
+/*																	   */
+/*  Permission is hereby granted, free of charge, to use and distribute  */
+/*  this software and its documentation without restriction, including   */
+/*  without limitation the rights to use, copy, modify, merge, publish,  */
+/*  distribute, sublicense, and/or sell copies of this work, and to	  */
+/*  permit persons to whom this work is furnished to do so, subject to   */
+/*  the following conditions:											*/
+/*   1. The code must retain the above copyright notice, this list of	*/
+/*	  conditions and the following disclaimer.						 */
+/*   2. Any modifications must be clearly marked as such.				*/
+/*   3. Original authors' names are not deleted.						 */
+/*   4. The authors' names are not used to endorse or promote products   */
+/*	  derived from this software without specific prior written		*/
+/*	  permission.													  */
+/*																	   */
+/*  CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK		 */
+/*  DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING	  */
+/*  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT   */
+/*  SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE	  */
+/*  FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES	*/
+/*  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN   */
+/*  AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,		  */
+/*  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF	   */
+/*  THIS SOFTWARE.													   */
+/*																	   */
+/*************************************************************************/
+/*			 Author:  Sigrid										   */
+/*			   Date:  June 2021										*/
+/*************************************************************************/
+/*																	   */
+/*  Simple top level program for Plan 9								  */
+/*																	   */
+/*************************************************************************/
+
+#include <flite.h>
+#include <bio.h>
+#include "flite_version.h"
+
+#pragma lib "../lang/cmu_us_slt/libcmu_us_slt.$M.a"
+#pragma lib "../lang/cmulex/libcmulex.$M.a"
+#pragma lib "../lang/usenglish/libusenglish.$M.a"
+#pragma lib "../src/audio/libaudio.$M.a"
+#pragma lib "../src/cg/libcg.$M.a"
+#pragma lib "../src/hrg/libhrg.$M.a"
+#pragma lib "../src/lexicon/liblexicon.$M.a"
+#pragma lib "../src/regex/libregex.$M.a"
+#pragma lib "../src/speech/libspeech.$M.a"
+#pragma lib "../src/stats/libstats.$M.a"
+#pragma lib "../src/synth/libsynth.$M.a"
+#pragma lib "../src/utils/libutils.$M.a"
+#pragma lib "../src/wavesynth/libwavesynth.$M.a"
+
+void *
+flite_set_lang_list(void)
+{
+	return nil;
+}
+
+cst_voice *register_cmu_us_slt(const char *voxdir);
+
+cst_val *
+flite_set_voice_list(const char *voxdir)
+{
+	flite_voice_list = cons_val(voice_val(register_cmu_us_slt(voxdir)),flite_voice_list);
+	flite_voice_list = val_reverse(flite_voice_list);
+
+	return flite_voice_list;
+}
+
+static void
+usage(void)
+{
+	cst_voice *voice;
+	const cst_val *v;
+
+	fprint(2, "usage: flite [-v VOICE] [>/dev/audio]\n");
+
+	fprint(2, "voices:");
+	for(v = flite_voice_list; v; v = val_cdr(v)){
+		voice = val_voice(val_car(v));
+		fprint(2, " %s", voice->name);
+	}
+	fprint(2, "\n");
+
+	fprint(2, "  Carnegie Mellon University, Copyright (c) 1999-2021, all rights reserved\n");
+	fprint(2, "  version: %s-%s-%s %s (http://cmuflite.org)\n",
+		FLITE_PROJECT_PREFIX,
+		FLITE_PROJECT_VERSION,
+		FLITE_PROJECT_STATE,
+		FLITE_PROJECT_DATE);
+
+	exits("usage");
+}
+
+static int
+runconv(void)
+{
+	char fmt[16];
+	int p[2];
+
+	pipe(p);
+	if(rfork(RFPROC|RFNOTEG|RFFDG|RFCENVG) == 0){
+		dup(p[1], 0);
+		close(p[0]);
+		close(p[1]);
+		sprintf(fmt, "s%dr%dc%d", 16, 16000, 1);
+		execl("/bin/audio/pcmconv", "pcmconv", "-i", fmt, nil);
+		fprint(2, "%r\n");
+		exits("pcmconv");
+	}
+	close(p[1]);
+
+	return p[0];
+}
+
+static int fd = -1;
+
+static int
+audiochunk(const cst_wave *w, int start, int size, int last, cst_audio_streaming_info *a)
+{
+	USED(last, a);
+
+	if(fd < 0)
+		fd = runconv();
+
+	write(fd, cst_wave_samples(w)+start, 2*size);
+
+	return CST_AUDIO_STREAM_CONT;
+}
+
+void
+main(int argc, char **argv)
+{
+    cst_audio_streaming_info *a;
+	char *s, *v;
+	cst_voice *voice;
+	Biobuf in;
+
+	if(Binit(&in, 0, OREAD|OCEXEC) != 0)
+		sysfatal("bio: %r");
+
+	flite_init();
+	flite_set_lang_list();
+	quotefmtinstall();
+	flite_set_voice_list(nil);
+
+	v = nil;
+	ARGBEGIN{
+	case 'v':
+		v = EARGF(usage());
+		break;
+	default:
+		usage();
+	}ARGEND
+
+	if((voice = flite_voice_select(v)) == nil)
+		sysfatal("invalid voice %q", v);
+
+	feat_copy_into(new_features(), voice->features);
+
+	a = new_audio_streaming_info();
+	a->asc = audiochunk;
+	a->min_buffsize = 4096;
+	feat_set(voice->features, "streaming_info", audio_streaming_info_val(a));
+
+	for(;;){
+		if((s = Brdstr(&in, '\n', 1)) == nil)
+			break;
+		flite_text_to_speech(s, voice, "stream");
+	}
+
+	close(fd);
+	waitpid();
+
+	exits(nil);
+}
--- /dev/null
+++ b/main/mkfile
@@ -1,0 +1,11 @@
+<../mkfile.common
+
+TARG=flite
+BIN=/$objtype/bin/audio
+LIB=
+CFLAGS=`{echo $CFLAGS | sed 's,\.\./,,'} -D__plan9_keep_main__
+
+OFILES=\
+	flite_plan9.$O\
+
+</sys/src/cmd/mkone
--- /dev/null
+++ b/mkfile
@@ -1,0 +1,20 @@
+root=`{pwd}
+
+%.all:V:
+	for(src in $root/src/*/)
+		cd $src && mk $stem
+	for(lang in $root/lang/^(cmu_us_slt cmulex usenglish))
+		cd $lang && mk $stem
+	cd $root/main && mk $stem
+
+all:V:
+	mk all.all
+
+clean:V:
+	mk clean.all
+
+nuke:V:
+	mk nuke.all
+
+install:V: all
+	cd $root/main && mk install
--- /dev/null
+++ b/mkfile.common
@@ -1,0 +1,4 @@
+</$objtype/mkfile
+
+LIB=lib`{basename `{pwd}}.$objtype.a
+CFLAGS=$CFLAGS -DCST_AUDIO_NONE -DCST_NO_SOCKETS -p -I../../include -I/sys/include/npe -D__plan9__
--- /dev/null
+++ b/src/audio/mkfile
@@ -1,0 +1,12 @@
+<../../mkfile.common
+
+HEADERS=\
+	native_audio.h\
+
+OFILES=\
+	au_command.$O\
+	au_none.$O\
+	au_streaming.$O\
+	audio.$O\
+
+</sys/src/cmd/mklib
--- a/src/cg/cst_mlsa.c
+++ b/src/cg/cst_mlsa.c
@@ -235,7 +235,7 @@
     return;
 }
 
-static double plus_or_minus_one()
+static double plus_or_minus_one(void)
 {
     /* Randomly return 1 or -1 */
     /* not sure rand() is portable */
--- a/src/cg/cst_spamf0.c
+++ b/src/cg/cst_spamf0.c
@@ -104,7 +104,7 @@
     return utt;
 }
 
-void cst_synthtilt(const cst_cg_db *cg_db, 
+static void cst_synthtilt(const cst_cg_db *cg_db, 
                           const float start, const float peak, const float tiltamp, 
                           const float tiltdur, const float tilttilt,
                           cst_track *ftrack)
--- /dev/null
+++ b/src/cg/mkfile
@@ -1,0 +1,20 @@
+<../../mkfile.common
+
+HEADERS=\
+	cst_cg_map.h\
+	cst_mlpg.h\
+	cst_mlsa.h\
+	cst_spamf0.h\
+	cst_vc.h\
+
+OFILES=\
+	cst_cg.$O\
+	cst_cg_dump_voice.$O\
+	cst_cg_load_voice.$O\
+	cst_cg_map.$O\
+	cst_mlpg.$O\
+	cst_mlsa.$O\
+	cst_spamf0.$O\
+	cst_vc.$O\
+
+</sys/src/cmd/mklib
--- /dev/null
+++ b/src/hrg/mkfile
@@ -1,0 +1,10 @@
+<../../mkfile.common
+
+OFILES=\
+	cst_ffeature.$O\
+	cst_item.$O\
+	cst_rel_io.$O\
+	cst_relation.$O\
+	cst_utterance.$O\
+
+</sys/src/cmd/mklib
--- /dev/null
+++ b/src/lexicon/mkfile
@@ -1,0 +1,8 @@
+<../../mkfile.common
+
+OFILES=\
+	cst_lexicon.$O\
+	cst_lts.$O\
+	cst_lts_rewrites.$O\
+
+</sys/src/cmd/mklib
--- /dev/null
+++ b/src/regex/mkfile
@@ -1,0 +1,11 @@
+<../../mkfile.common
+
+HEADERS=\
+	cst_regex_defs.h\
+
+OFILES=\
+	cst_regex.$O\
+	regexp.$O\
+	regsub.$O\
+
+</sys/src/cmd/mklib
--- /dev/null
+++ b/src/speech/mkfile
@@ -1,0 +1,19 @@
+<../../mkfile.common
+
+HEADERS=\
+	g72x.h\
+
+OFILES=\
+	cst_lpcres.$O\
+	cst_track.$O\
+	cst_track_io.$O\
+	cst_wave.$O\
+	cst_wave_io.$O\
+	cst_wave_utils.$O\
+	g721.$O\
+	g723_24.$O\
+	g723_40.$O\
+	g72x.$O\
+	rateconv.$O\
+
+</sys/src/cmd/mklib
--- a/src/stats/cst_ss.c
+++ b/src/stats/cst_ss.c
@@ -42,7 +42,7 @@
 #include "cst_ss.h"
 #include "cst_math.h"
 
-cst_ss *new_ss()
+cst_ss *new_ss(void)
 {
     cst_ss *ss = cst_alloc(cst_ss,1);
     return ss;
--- /dev/null
+++ b/src/stats/mkfile
@@ -1,0 +1,8 @@
+<../../mkfile.common
+
+OFILES=\
+	cst_cart.$O\
+	cst_ss.$O\
+	cst_viterbi.$O\
+
+</sys/src/cmd/mklib
--- /dev/null
+++ b/src/synth/mkfile
@@ -1,0 +1,12 @@
+<../../mkfile.common
+
+OFILES=\
+	cst_ffeatures.$O\
+	cst_phoneset.$O\
+	cst_ssml.$O\
+	cst_synth.$O\
+	cst_utt_utils.$O\
+	cst_voice.$O\
+	flite.$O\
+
+</sys/src/cmd/mklib
--- a/src/utils/cst_mmap_none.c
+++ b/src/utils/cst_mmap_none.c
@@ -61,7 +61,7 @@
     cst_filemap *fmap;
     cst_file fh;
 
-    if ((fh = cst_fopen(path, CST_OPEN_READ)) < 0) {
+    if ((fh = cst_fopen(path, CST_OPEN_READ)) == NULL) {
 	cst_errmsg("cst_read_whole_file: Failed to open file\n");
 	return NULL;
     }
--- a/src/utils/cst_val.c
+++ b/src/utils/cst_val.c
@@ -43,7 +43,7 @@
 #include "cst_string.h"
 #include "cst_tokenstream.h"
 
-static cst_val *new_val()
+static cst_val *new_val(void)
 {
     return cst_alloc(struct cst_val_struct,1);
 }
--- /dev/null
+++ b/src/utils/mkfile
@@ -1,0 +1,20 @@
+<../../mkfile.common
+
+CFLAGS=$CFLAGS -DCST_NO_SOCKETS
+
+OFILES=\
+	cst_alloc.$O\
+	cst_args.$O\
+	cst_endian.$O\
+	cst_error.$O\
+	cst_features.$O\
+	cst_file_stdio.$O\
+	cst_mmap_none.$O\
+	cst_string.$O\
+	cst_tokenstream.$O\
+	cst_url.$O\
+	cst_val.$O\
+	cst_val_const.$O\
+	cst_val_user.$O\
+
+</sys/src/cmd/mklib
--- a/src/wavesynth/cst_units.c
+++ b/src/wavesynth/cst_units.c
@@ -476,7 +476,7 @@
     cst_free(unit_residual_unpacked);
 }
 
-static double plus_or_minus_one()
+static double plus_or_minus_one(void)
 {
     /* Randomly return 1 or -1 */
     /* not sure rand() is portable */
@@ -486,7 +486,7 @@
         return -1.0;
 }
 
-static double rand_zero_to_one()
+static double rand_zero_to_one(void)
 {
     /* Return number between 0.0 and 1.0 */
     return rand()/(float)RAND_MAX;
--- /dev/null
+++ b/src/wavesynth/mkfile
@@ -1,0 +1,11 @@
+<../../mkfile.common
+
+OFILES=\
+	cst_clunits.$O\
+	cst_diphone.$O\
+	cst_reflpc.$O\
+	cst_sigpr.$O\
+	cst_sts.$O\
+	cst_units.$O\
+
+</sys/src/cmd/mklib