- speech-dispatcher: try fix building on FreeBSD < 8.0
PR: 142869 Submitted by: Alberto Villa (maintainer) Approved by: miwi, tabthorpe (mentors implicit)
This commit is contained in:
parent
36c6945340
commit
380457953c
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=248060
8 changed files with 301 additions and 1 deletions
|
@ -84,7 +84,16 @@ CONFIGURE_ARGS+= --with-pulseaudio
|
|||
CONFIGURE_ARGS+= --without-pulseaudio
|
||||
.endif
|
||||
|
||||
pre-patch:
|
||||
.if ${OSVERSION} < 800000
|
||||
EXTRA_PATCHES= ${FILESDIR}/extrapatch-*
|
||||
.endif
|
||||
|
||||
post-extract:
|
||||
.if ${OSVERSION} < 800000
|
||||
${CP} ${FILESDIR}/getline.* ${WRKSRC}/src
|
||||
.endif
|
||||
|
||||
post-patch:
|
||||
@${REINPLACE_CMD} -e 's/-pthread/${PTHREAD_LIBS}/g' \
|
||||
${WRKSRC}/ltmain.sh
|
||||
@${REINPLACE_CMD} -e 's/-lpthread/${PTHREAD_LIBS}/g' \
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
--- src/c/api/Makefile.in.orig 2010-01-15 19:51:09.284466853 +0100
|
||||
+++ src/c/api/Makefile.in 2010-01-15 19:51:42.602485219 +0100
|
||||
@@ -54,7 +54,7 @@
|
||||
libLTLIBRARIES_INSTALL = $(INSTALL)
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
libspeechd_la_DEPENDENCIES =
|
||||
-am_libspeechd_la_OBJECTS = libspeechd.lo
|
||||
+am_libspeechd_la_OBJECTS = libspeechd.lo ../../getline.$(OBJEXT)
|
||||
libspeechd_la_OBJECTS = $(am_libspeechd_la_OBJECTS)
|
||||
libspeechd_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
|
@ -0,0 +1,11 @@
|
|||
--- src/c/clients/say/Makefile.in.orig 2010-01-15 19:45:48.339555703 +0100
|
||||
+++ src/c/clients/say/Makefile.in 2010-01-15 19:46:05.488979035 +0100
|
||||
@@ -45,7 +45,7 @@
|
||||
am__installdirs = "$(DESTDIR)$(bindir)"
|
||||
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
-am_spd_say_OBJECTS = say.$(OBJEXT) options.$(OBJEXT)
|
||||
+am_spd_say_OBJECTS = say.$(OBJEXT) options.$(OBJEXT) ../../../getline.$(OBJEXT)
|
||||
spd_say_OBJECTS = $(am_spd_say_OBJECTS)
|
||||
spd_say_DEPENDENCIES = $(c_api)/libspeechd.la
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
|
@ -0,0 +1,11 @@
|
|||
--- src/c/clients/spdsend/Makefile.in.orig 2010-01-15 19:46:14.737593506 +0100
|
||||
+++ src/c/clients/spdsend/Makefile.in 2010-01-15 19:46:29.284418153 +0100
|
||||
@@ -47,7 +47,7 @@
|
||||
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
am_spdsend_OBJECTS = spdsend.$(OBJEXT) server.$(OBJEXT) \
|
||||
- client.$(OBJEXT) common.$(OBJEXT)
|
||||
+ client.$(OBJEXT) common.$(OBJEXT) ../../../getline.$(OBJEXT)
|
||||
spdsend_OBJECTS = $(am_spdsend_OBJECTS)
|
||||
spdsend_DEPENDENCIES =
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
|
@ -0,0 +1,55 @@
|
|||
--- src/modules/Makefile.in.orig 2010-01-15 19:47:30.277280590 +0100
|
||||
+++ src/modules/Makefile.in 2010-01-15 19:49:05.729978711 +0100
|
||||
@@ -57,44 +57,44 @@
|
||||
"$(DESTDIR)$(snddatadir)"
|
||||
modulebinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
|
||||
PROGRAMS = $(modulebin_PROGRAMS)
|
||||
-am_sd_cicero_OBJECTS = cicero.$(OBJEXT) module_utils.$(OBJEXT)
|
||||
+am_sd_cicero_OBJECTS = cicero.$(OBJEXT) module_utils.$(OBJEXT) ../getline.$(OBJEXT)
|
||||
sd_cicero_OBJECTS = $(am_sd_cicero_OBJECTS)
|
||||
sd_cicero_DEPENDENCIES =
|
||||
-am_sd_dummy_OBJECTS = dummy.$(OBJEXT) module_utils.$(OBJEXT)
|
||||
+am_sd_dummy_OBJECTS = dummy.$(OBJEXT) module_utils.$(OBJEXT) ../getline.$(OBJEXT)
|
||||
sd_dummy_OBJECTS = $(am_sd_dummy_OBJECTS)
|
||||
sd_dummy_DEPENDENCIES =
|
||||
sd_dummy_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(sd_dummy_LDFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
-am_sd_espeak_OBJECTS = espeak.$(OBJEXT) module_utils.$(OBJEXT)
|
||||
+am_sd_espeak_OBJECTS = espeak.$(OBJEXT) module_utils.$(OBJEXT) ../getline.$(OBJEXT)
|
||||
sd_espeak_OBJECTS = $(am_sd_espeak_OBJECTS)
|
||||
sd_espeak_DEPENDENCIES =
|
||||
sd_espeak_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(sd_espeak_LDFLAGS) $(LDFLAGS) -o $@
|
||||
-am_sd_festival_OBJECTS = festival.$(OBJEXT) module_utils.$(OBJEXT)
|
||||
+am_sd_festival_OBJECTS = festival.$(OBJEXT) module_utils.$(OBJEXT) ../getline.$(OBJEXT)
|
||||
sd_festival_OBJECTS = $(am_sd_festival_OBJECTS)
|
||||
sd_festival_DEPENDENCIES =
|
||||
sd_festival_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(sd_festival_LDFLAGS) $(LDFLAGS) -o $@
|
||||
-am_sd_flite_OBJECTS = flite.$(OBJEXT) module_utils.$(OBJEXT)
|
||||
+am_sd_flite_OBJECTS = flite.$(OBJEXT) module_utils.$(OBJEXT) ../getline.$(OBJEXT)
|
||||
sd_flite_OBJECTS = $(am_sd_flite_OBJECTS)
|
||||
am__DEPENDENCIES_1 =
|
||||
sd_flite_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
|
||||
sd_flite_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(sd_flite_LDFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
-am_sd_generic_OBJECTS = generic.$(OBJEXT) module_utils.$(OBJEXT)
|
||||
+am_sd_generic_OBJECTS = generic.$(OBJEXT) module_utils.$(OBJEXT) ../getline.$(OBJEXT)
|
||||
sd_generic_OBJECTS = $(am_sd_generic_OBJECTS)
|
||||
sd_generic_DEPENDENCIES =
|
||||
-am_sd_ibmtts_OBJECTS = ibmtts.$(OBJEXT) module_utils.$(OBJEXT)
|
||||
+am_sd_ibmtts_OBJECTS = ibmtts.$(OBJEXT) module_utils.$(OBJEXT) ../getline.$(OBJEXT)
|
||||
sd_ibmtts_OBJECTS = $(am_sd_ibmtts_OBJECTS)
|
||||
sd_ibmtts_DEPENDENCIES =
|
||||
sd_ibmtts_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(sd_ibmtts_LDFLAGS) $(LDFLAGS) -o $@
|
||||
-am_sd_ivona_OBJECTS = ivona.$(OBJEXT) module_utils.$(OBJEXT)
|
||||
+am_sd_ivona_OBJECTS = ivona.$(OBJEXT) module_utils.$(OBJEXT) ../getline.$(OBJEXT)
|
||||
sd_ivona_OBJECTS = $(am_sd_ivona_OBJECTS)
|
||||
sd_ivona_DEPENDENCIES =
|
||||
sd_ivona_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
|
@ -0,0 +1,11 @@
|
|||
--- src/server/Makefile.in.orig 2010-01-15 19:44:32.014987477 +0100
|
||||
+++ src/server/Makefile.in 2010-01-15 19:44:56.313346422 +0100
|
||||
@@ -50,7 +50,7 @@
|
||||
parse.$(OBJEXT) set.$(OBJEXT) alloc.$(OBJEXT) \
|
||||
compare.$(OBJEXT) speaking.$(OBJEXT) options.$(OBJEXT) \
|
||||
output.$(OBJEXT) sem_functions.$(OBJEXT) \
|
||||
- index_marking.$(OBJEXT)
|
||||
+ index_marking.$(OBJEXT) ../getline.$(OBJEXT)
|
||||
speech_dispatcher_OBJECTS = $(am_speech_dispatcher_OBJECTS)
|
||||
speech_dispatcher_DEPENDENCIES =
|
||||
speech_dispatcher_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
169
accessibility/speech-dispatcher/files/getline.c
Normal file
169
accessibility/speech-dispatcher/files/getline.c
Normal file
|
@ -0,0 +1,169 @@
|
|||
/* getline.c -- Replacement for GNU C library function getline
|
||||
|
||||
Copyright (C) 1993 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 2 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. */
|
||||
|
||||
/* Written by Jan Brittenson, bson@gnu.ai.mit.edu. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include "getline.h"
|
||||
|
||||
/* Always add at least this many bytes when extending the buffer. */
|
||||
#define MIN_CHUNK 64
|
||||
|
||||
/* Read up to (and including) a TERMINATOR from STREAM into *LINEPTR
|
||||
+ OFFSET (and null-terminate it). If LIMIT is non-negative, then
|
||||
read no more than LIMIT chars.
|
||||
|
||||
*LINEPTR is a pointer returned from malloc (or NULL), pointing to
|
||||
*N characters of space. It is realloc'd as necessary.
|
||||
|
||||
Return the number of characters read (not including the null
|
||||
terminator), or -1 on error or EOF. On a -1 return, the caller
|
||||
should check feof(), if not then errno has been set to indicate the
|
||||
error. */
|
||||
|
||||
int
|
||||
getstr (lineptr, n, stream, terminator, offset, limit)
|
||||
char **lineptr;
|
||||
size_t *n;
|
||||
FILE *stream;
|
||||
int terminator;
|
||||
int offset;
|
||||
int limit;
|
||||
{
|
||||
int nchars_avail; /* Allocated but unused chars in *LINEPTR. */
|
||||
char *read_pos; /* Where we're reading into *LINEPTR. */
|
||||
int ret;
|
||||
|
||||
if (!lineptr || !n || !stream)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!*lineptr)
|
||||
{
|
||||
*n = MIN_CHUNK;
|
||||
*lineptr = malloc (*n);
|
||||
if (!*lineptr)
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
*lineptr[0] = '\0';
|
||||
}
|
||||
|
||||
nchars_avail = *n - offset;
|
||||
read_pos = *lineptr + offset;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int save_errno;
|
||||
register int c;
|
||||
|
||||
if (limit == 0)
|
||||
break;
|
||||
else
|
||||
{
|
||||
c = getc (stream);
|
||||
|
||||
/* If limit is negative, then we shouldn't pay attention to
|
||||
it, so decrement only if positive. */
|
||||
if (limit > 0)
|
||||
limit--;
|
||||
}
|
||||
|
||||
save_errno = errno;
|
||||
|
||||
/* We always want at least one char left in the buffer, since we
|
||||
always (unless we get an error while reading the first char)
|
||||
NUL-terminate the line buffer. */
|
||||
|
||||
assert((*lineptr + *n) == (read_pos + nchars_avail));
|
||||
if (nchars_avail < 2)
|
||||
{
|
||||
if (*n > MIN_CHUNK)
|
||||
*n *= 2;
|
||||
else
|
||||
*n += MIN_CHUNK;
|
||||
|
||||
nchars_avail = *n + *lineptr - read_pos;
|
||||
*lineptr = realloc (*lineptr, *n);
|
||||
if (!*lineptr)
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
read_pos = *n - nchars_avail + *lineptr;
|
||||
assert((*lineptr + *n) == (read_pos + nchars_avail));
|
||||
}
|
||||
|
||||
if (ferror (stream))
|
||||
{
|
||||
/* Might like to return partial line, but there is no
|
||||
place for us to store errno. And we don't want to just
|
||||
lose errno. */
|
||||
errno = save_errno;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (c == EOF)
|
||||
{
|
||||
/* Return partial line, if any. */
|
||||
if (read_pos == *lineptr)
|
||||
return -1;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
*read_pos++ = c;
|
||||
nchars_avail--;
|
||||
|
||||
if (c == terminator)
|
||||
/* Return the line. */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Done - NUL terminate and return the number of chars read. */
|
||||
*read_pos = '\0';
|
||||
|
||||
ret = read_pos - (*lineptr + offset);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
getline (lineptr, n, stream)
|
||||
char **lineptr;
|
||||
size_t *n;
|
||||
FILE *stream;
|
||||
{
|
||||
return getstr (lineptr, n, stream, '\n', 0, GETLINE_NO_LIMIT);
|
||||
}
|
||||
|
||||
int
|
||||
getline_safe (lineptr, n, stream, limit)
|
||||
char **lineptr;
|
||||
size_t *n;
|
||||
FILE *stream;
|
||||
int limit;
|
||||
{
|
||||
return getstr (lineptr, n, stream, '\n', 0, limit);
|
||||
}
|
23
accessibility/speech-dispatcher/files/getline.h
Normal file
23
accessibility/speech-dispatcher/files/getline.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
#ifndef _getline_h_
|
||||
#define _getline_h_ 1
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
|
||||
#define __PROTO(args) args
|
||||
#else
|
||||
#define __PROTO(args) ()
|
||||
#endif /* GCC. */
|
||||
|
||||
#define GETLINE_NO_LIMIT -1
|
||||
|
||||
int
|
||||
getline __PROTO ((char **_lineptr, size_t *_n, FILE *_stream));
|
||||
int
|
||||
getline_safe __PROTO ((char **_lineptr, size_t *_n, FILE *_stream,
|
||||
int limit));
|
||||
int
|
||||
getstr __PROTO ((char **_lineptr, size_t *_n, FILE *_stream,
|
||||
int _terminator, int _offset, int limit));
|
||||
|
||||
#endif /* _getline_h_ */
|
Loading…
Reference in a new issue