File pocketsphinx-largefile.patch of Package pocketsphinx
--- ./configure.in.orig 2012-12-12 11:38:23.000000000 -0700
+++ ./configure.in 2013-03-29 10:08:39.242526974 -0600
@@ -1,7 +1,7 @@
dnl Welcome to the Sphinx automated build system.
dnl try not to hurt yourself ;)
-AC_INIT(pocketsphinx, 0.8)
+AC_INIT([pocketsphinx],[0.8])
AM_INIT_AUTOMAKE([no-define])
AC_CONFIG_MACRO_DIR([m4])
@@ -30,10 +30,16 @@ case $host in
esac
AC_PROG_CC
-AM_PROG_LIBTOOL
-AC_WORDS_BIGENDIAN
+LT_INIT
+AC_C_BIGENDIAN
+AC_SYS_LARGEFILE
+AC_FUNC_FSEEKO
+AC_TYPE_OFF_T
AC_CHECK_TYPES(long long)
AC_CHECK_SIZEOF(long long)
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(off_t)
AC_CHECK_FUNCS(dup2)
dnl
@@ -82,7 +88,7 @@ else
PYTHON=bogus
fi
if test "x$use_python" != xtrue ; then
- AC_WARN([Disabling python since development headers were not found])
+ AC_MSG_WARN(Disabling python since development headers were not found)
fi
AM_CONDITIONAL(BUILD_PYTHON, test "x$use_python" = "xtrue")
AC_SUBST(PYTHON)
@@ -211,10 +217,10 @@ fi
if test x$sphinxbase != x && test x$cross_compiling != xyes; then
AC_CHECK_FILE($sphinxbase/include/sphinxbase/prim_type.h,
CPPFLAGS="-I$sphinxbase/include $CPPFLAGS",
- AC_ERROR(
-[SphinxBase headers not found in $sphinxbase. Please use the
+ AC_MSG_ERROR(
+SphinxBase headers not found in $sphinxbase. Please use the
--with-sphinxbase option to `configure' to specify the location of
-SphinxBase. Run $0 --help for more information.]))
+SphinxBase. Run $0 --help for more information.))
fi
# We include libsphinxbase/.libs because of stupid broken versions of libtool
if test x$sphinxbasebuild != x && test x$cross_compiling != xyes; then
@@ -224,16 +230,16 @@ LIBS="$LIBS -lsphinxbase"
LDFLAGS="$LDFLAGS -L$sphinxbasebuild/src/libsphinxad \
-L$sphinxbasebuild/src/libsphinxbase \
-L$sphinxbasebuild/src/libsphinxbase/.libs"],
- AC_ERROR(
-[SphinxBase libraries were not found in $sphinxbasebuild.
+ AC_MSG_ERROR(
+SphinxBase libraries were not found in $sphinxbasebuild.
Use the --with-sphinxbase-build option to `configure' to specify
-the build directory for SphinxBase. Run $0 --help for more information.]))
+the build directory for SphinxBase. Run $0 --help for more information.))
fi
AC_SUBST(sphinxbase)
AC_SUBST(sphinxbasebuild)
-AC_OUTPUT([
+AC_CONFIG_FILES([
pocketsphinx.pc
Makefile
include/Makefile
@@ -253,3 +259,4 @@ test/testfuncs.sh
test/unit/Makefile
test/regression/Makefile
])
+AC_OUTPUT
--- ./src/programs/Makefile.am.orig 2012-12-12 23:04:12.000000000 -0700
+++ ./src/programs/Makefile.am 2013-03-29 10:18:16.273631316 -0600
@@ -15,6 +15,6 @@ pocketsphinx_continuous_SOURCES = contin
pocketsphinx_continuous_LDADD = \
$(top_builddir)/src/libpocketsphinx/libpocketsphinx.la -lsphinxad
-INCLUDES = -I$(top_srcdir)/include \
+AM_CPPFLAGS = -I$(top_srcdir)/include \
-I$(top_srcdir)/src/libpocketsphinx \
-I$(top_builddir)/include
--- ./src/programs/batch.c.orig 2012-09-28 16:17:02.000000000 -0600
+++ ./src/programs/batch.c 2013-03-29 10:14:18.041982296 -0600
@@ -185,15 +185,15 @@ static const arg_t ps_args_def[] = {
static mfcc_t **
read_mfc_file(FILE *infh, int sf, int ef, int *out_nfr, int ceplen)
{
- long flen;
+ OFF_T flen;
int32 nmfc, nfr;
float32 *floats;
mfcc_t **mfcs;
int swap, i;
- fseek(infh, 0, SEEK_END);
- flen = ftell(infh);
- fseek(infh, 0, SEEK_SET);
+ FSEEK(infh, 0, SEEK_END);
+ flen = FTELL(infh);
+ FSEEK(infh, 0, SEEK_SET);
if (fread(&nmfc, 4, 1, infh) != 1) {
E_ERROR_SYSTEM("Failed to read 4 bytes from MFCC file");
return NULL;
@@ -203,13 +203,13 @@ read_mfc_file(FILE *infh, int sf, int ef
SWAP_INT32(&nmfc);
swap = 1;
if (nmfc != flen / 4 - 1) {
- E_ERROR("File length mismatch: 0x%x != 0x%x, maybe it's not MFCC file\n",
+ E_ERROR("File length mismatch: 0x%x != 0x%" PRIxOFF_T ", maybe it's not MFCC file\n",
nmfc, flen / 4 - 1);
return NULL;
}
}
- fseek(infh, sf * 4 * ceplen, SEEK_CUR);
+ FSEEK(infh, sf * 4 * ceplen, SEEK_CUR);
if (ef == -1)
ef = nmfc / ceplen;
nfr = ef - sf;
@@ -411,7 +411,7 @@ process_ctl_line(ps_decoder_t *ps, cmd_l
sf = (int32)(sf
* (cmd_ln_float32_r(config, "-samprate")
/ cmd_ln_int32_r(config, "-frate")));
- fseek(infh, cmd_ln_int32_r(config, "-adchdr") + sf * sizeof(int16), SEEK_SET);
+ FSEEK(infh, cmd_ln_int32_r(config, "-adchdr") + sf * sizeof(int16), SEEK_SET);
ps_decode_raw(ps, infh, uttid, ef);
}
else {
--- ./src/gst-plugin/Makefile.am.orig 2012-09-28 16:17:02.000000000 -0600
+++ ./src/gst-plugin/Makefile.am 2013-03-29 10:19:26.697524270 -0600
@@ -17,7 +17,7 @@ libgstpocketsphinx_la_LDFLAGS = $(GST_PL
noinst_HEADERS = gstpocketsphinx.h gstvader.h $(my_headers)
-INCLUDES = -I$(top_srcdir)/include \
+AM_CPPFLAGS = -I$(top_srcdir)/include \
-I$(top_builddir)/include
EXTRA_DIST = psmarshal.list livedemo.py fixsqrt.py
--- ./src/libpocketsphinx/s2_semi_mgau.c.orig 2012-12-12 12:25:55.000000000 -0700
+++ ./src/libpocketsphinx/s2_semi_mgau.c 2013-03-29 10:13:05.042091549 -0600
@@ -887,7 +887,7 @@ read_sendump(s2_semi_mgau_t *s, bin_mdef
char line[1000];
int32 i, n, r, c;
int32 do_swap, do_mmap;
- size_t offset;
+ OFF_T offset;
int n_clust = 0;
int n_feat = s->n_feat;
int n_density = s->n_density;
@@ -1021,7 +1021,7 @@ read_sendump(s2_semi_mgau_t *s, bin_mdef
if (do_mmap) {
E_INFO("Using memory-mapped I/O for senones\n");
}
- offset = ftell(fp);
+ offset = FTELL(fp);
/* Allocate memory for pdfs (or memory map them) */
if (do_mmap) {
--- ./src/libpocketsphinx/pocketsphinx.c.orig 2012-12-12 14:42:03.000000000 -0700
+++ ./src/libpocketsphinx/pocketsphinx.c 2013-03-29 10:12:11.842173525 -0600
@@ -580,19 +580,20 @@ int
ps_decode_raw(ps_decoder_t *ps, FILE *rawfh,
char const *uttid, long maxsamps)
{
- long total, pos;
+ long total;
+ OFF_T pos;
ps_start_utt(ps, uttid);
/* If this file is seekable or maxsamps is specified, then decode
* the whole thing at once. */
- if (maxsamps != -1 || (pos = ftell(rawfh)) >= 0) {
+ if (maxsamps != -1 || (pos = FTELL(rawfh)) >= 0) {
int16 *data;
if (maxsamps == -1) {
- long endpos;
- fseek(rawfh, 0, SEEK_END);
- endpos = ftell(rawfh);
- fseek(rawfh, pos, SEEK_SET);
+ OFF_T endpos;
+ FSEEK(rawfh, 0, SEEK_END);
+ endpos = FTELL(rawfh);
+ FSEEK(rawfh, pos, SEEK_SET);
maxsamps = endpos - pos;
}
data = ckd_calloc(maxsamps, sizeof(*data));
--- ./src/libpocketsphinx/acmod.c.orig 2012-09-28 16:17:02.000000000 -0600
+++ ./src/libpocketsphinx/acmod.c 2013-03-29 10:09:39.882440802 -0600
@@ -463,11 +463,11 @@ acmod_end_utt(acmod_t *acmod)
}
if (acmod->mfcfh) {
int32 outlen, rv;
- outlen = (ftell(acmod->mfcfh) - 4) / 4;
+ outlen = (int32) ((FTELL(acmod->mfcfh) - 4) / 4);
if (!WORDS_BIGENDIAN)
SWAP_INT32(&outlen);
/* Try to seek and write */
- if ((rv = fseek(acmod->mfcfh, 0, SEEK_SET)) == 0) {
+ if ((rv = FSEEK(acmod->mfcfh, 0, SEEK_SET)) == 0) {
fwrite(&outlen, 4, 1, acmod->mfcfh);
}
fclose(acmod->mfcfh);
@@ -1024,7 +1024,7 @@ acmod_read_scores(acmod_t *acmod)
* position for the relevant frame in the (possibly circular)
* buffer. */
++acmod->n_feat_frame;
- acmod->framepos[inptr] = ftell(acmod->insenfh);
+ acmod->framepos[inptr] = FTELL(acmod->insenfh);
return 1;
}
@@ -1107,7 +1107,7 @@ acmod_score(acmod_t *acmod, int *inout_f
/* If there is an input senone file locate the appropriate frame and read it. */
if (acmod->insenfh) {
- fseek(acmod->insenfh, acmod->framepos[feat_idx], SEEK_SET);
+ FSEEK(acmod->insenfh, acmod->framepos[feat_idx], SEEK_SET);
if (acmod_read_scores_internal(acmod) < 0)
return NULL;
}
--- ./src/libpocketsphinx/bin_mdef.c.orig 2012-09-28 16:17:02.000000000 -0600
+++ ./src/libpocketsphinx/bin_mdef.c 2013-03-29 10:11:04.940284342 -0600
@@ -325,7 +325,8 @@ bin_mdef_read(cmd_ln_t *config, const ch
bin_mdef_t *m;
FILE *fh;
size_t tree_start;
- int32 val, i, swap, pos, end;
+ int32 val, i, swap;
+ OFF_T pos, end;
int32 *sseq_size;
int do_mmap;
@@ -369,7 +370,7 @@ bin_mdef_read(cmd_ln_t *config, const ch
if (swap)
SWAP_INT32(&val);
/* Skip format descriptor. */
- fseek(fh, val, SEEK_CUR);
+ FSEEK(fh, val, SEEK_CUR);
/* Finally allocate it. */
m = ckd_calloc(1, sizeof(*m));
@@ -411,7 +412,7 @@ bin_mdef_read(cmd_ln_t *config, const ch
if (m->filemap == NULL)
do_mmap = FALSE;
}
- pos = ftell(fh);
+ pos = FTELL(fh);
if (do_mmap) {
/* Get the base pointer from the memory map. */
m->ciname[0] = (char *)mmio_file_ptr(m->filemap) + pos;
@@ -421,12 +422,12 @@ bin_mdef_read(cmd_ln_t *config, const ch
else {
/* Read everything into memory. */
m->alloc_mode = BIN_MDEF_IN_MEMORY;
- fseek(fh, 0, SEEK_END);
- end = ftell(fh);
- fseek(fh, pos, SEEK_SET);
+ FSEEK(fh, 0, SEEK_END);
+ end = FTELL(fh);
+ FSEEK(fh, pos, SEEK_SET);
m->ciname[0] = ckd_malloc(end - pos);
if (fread(m->ciname[0], 1, end - pos, fh) != end - pos)
- E_FATAL("Failed to read %d bytes of data from %s\n", end - pos, filename);
+ E_FATAL("Failed to read %" PRIdOFF_T " bytes of data from %s\n", end - pos, filename);
}
for (i = 1; i < m->n_ciphone; ++i)
@@ -563,9 +564,9 @@ bin_mdef_write(bin_mdef_t * m, const cha
for (i = 0; i < m->n_ciphone; ++i)
fwrite(m->ciname[i], 1, strlen(m->ciname[i]) + 1, fh);
/* Pad with zeros. */
- val = (ftell(fh) + 3) & ~3;
+ val = (FTELL(fh) + 3) & ~3;
i = 0;
- fwrite(&i, 1, val - ftell(fh), fh);
+ fwrite(&i, 1, val - FTELL(fh), fh);
/* Write CD-tree */
fwrite(m->cd_tree, sizeof(*m->cd_tree), m->n_cd_tree, fh);
--- ./src/libpocketsphinx/Makefile.am.orig 2012-12-12 11:51:36.000000000 -0700
+++ ./src/libpocketsphinx/Makefile.am 2013-03-29 10:19:59.217474303 -0600
@@ -62,7 +62,7 @@ noinst_HEADERS = \
tmat.h \
vector.h
-INCLUDES = \
+AM_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_builddir)/include \
-DMODELDIR=\"${prefix}/share/pocketsphinx/model\"
--- ./src/libpocketsphinx/ptm_mgau.c.orig 2012-12-12 12:25:55.000000000 -0700
+++ ./src/libpocketsphinx/ptm_mgau.c 2013-03-29 10:12:41.506127435 -0600
@@ -451,7 +451,7 @@ read_sendump(ptm_mgau_t *s, bin_mdef_t *
char line[1000];
int32 i, n, r, c;
int32 do_swap, do_mmap;
- size_t offset;
+ OFF_T offset;
int n_clust = 0;
int n_feat = s->g->n_feat;
int n_density = s->g->n_density;
@@ -585,7 +585,7 @@ read_sendump(ptm_mgau_t *s, bin_mdef_t *
if (do_mmap) {
E_INFO("Using memory-mapped I/O for senones\n");
}
- offset = ftell(fp);
+ offset = FTELL(fp);
/* Allocate memory for pdfs (or memory map them) */
if (do_mmap) {
--- ./test/unit/Makefile.am.orig 2012-09-28 16:16:57.000000000 -0600
+++ ./test/unit/Makefile.am 2013-03-29 10:21:11.801363481 -0600
@@ -47,7 +47,7 @@ noinst_HEADERS = test_macros.h
test_gst_LDADD = $(GST_LIBS)
-INCLUDES = $(GST_CFLAGS) \
+AM_CPPFLAGS = $(GST_CFLAGS) \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/libpocketsphinx \
-I$(top_builddir)/include \