espeak: Generate phondata based on endianness of targer

Use qemu usermode to generate it, so we are always in correct
endian-ness

espeak-data is no longer needed now, since sole purpose of it was to
provide the data for bigendian systems

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj 2019-02-09 17:37:06 -08:00
parent 357573db84
commit 06d4a5427b
5 changed files with 71 additions and 61 deletions

View File

@ -1,24 +0,0 @@
require espeak.inc
inherit native
PACKAGES = "${PN}"
FILES_${PN} = "${layout_datadir}"
PACKAGE_ARCH = "${MACHINE_ARCH}"
TARGET_ARCH = "${MACHINE_ARCH}"
do_compile() {
# Fixing byte order of phoneme data files
cd "${S}/platforms/big_endian"
sed -i '/^ *CC *=/d' Makefile
sed -i 's/\(.*BYTE_ORDER\)/#undef BYTE_ORDER\n#define BYTE_ORDER BIG_ENDIAN\n\1/' espeak-phoneme-data.c
oe_runmake
./espeak-phoneme-data "${S}/espeak-data" "." "${S}/espeak-data/phondata-manifest"
cp -f phondata phonindex phontab "${S}/espeak-data"
}
do_install() {
install -d ${D}${layout_datadir}/espeak-data
install -m 0644 ${S}/espeak-data/phon* ${D}${layout_datadir}/espeak-data
}

View File

@ -1,15 +0,0 @@
DESCRIPTION = "eSpeak is a compact open source software speech synthesizer"
SECTION = "base"
LICENSE = "GPLv3"
LIC_FILES_CHKSUM = "file://License.txt;md5=cb7a20edb4c9f5f478de6523dcd7362c"
SRC_URI = "http://downloads.sourceforge.net/espeak/espeak-1.48.04-source.zip \
file://0001-Fix-build-of-shared-library-on-architectures-needing.patch \
file://espeak-1.48-gcc-6-fix.patch \
"
SRC_URI[md5sum] = "cadd7482eaafe9239546bdc09fa244c3"
SRC_URI[sha256sum] = "bf9a17673adffcc28ff7ea18764f06136547e97bbd9edf2ec612f09b207f0659"
S = "${WORKDIR}/espeak-${PV}-source"
DEPENDS = "portaudio-v19"

View File

@ -1,8 +1,20 @@
require espeak.inc
inherit siteinfo
DESCRIPTION = "eSpeak is a compact open source software speech synthesizer"
SECTION = "base"
LICENSE = "GPLv3"
LIC_FILES_CHKSUM = "file://License.txt;md5=cb7a20edb4c9f5f478de6523dcd7362c"
SRC_URI = "http://downloads.sourceforge.net/espeak/espeak-1.48.04-source.zip \
file://0001-Fix-build-of-shared-library-on-architectures-needing.patch \
file://0002-tr_languages-cast-string_ordinal-init-values.patch \
"
SRC_URI[md5sum] = "cadd7482eaafe9239546bdc09fa244c3"
SRC_URI[sha256sum] = "bf9a17673adffcc28ff7ea18764f06136547e97bbd9edf2ec612f09b207f0659"
S = "${WORKDIR}/espeak-${PV}-source"
DEPENDS = "portaudio-v19 qemu-helper-native"
inherit siteinfo qemu
EXTRA_PHONEMES = '${@bb.utils.contains("SITEINFO_ENDIANNESS", "be", "espeak-data (= ${PV})", "", d)}'
RDEPENDS_${PN} = "portaudio-v19 ${EXTRA_PHONEMES}"
CXXFLAGS += "-DUSE_PORTAUDIO"
TARGET_CC_ARCH += "${LDFLAGS}"
@ -11,12 +23,30 @@ FILES_${PN} += "${datadir}/espeak-data"
do_configure() {
# "speak" binary, a TTS engine, uses portaudio in either APIs V18 or V19, use V19
cp "${S}/src/portaudio19.h" "${S}/src/portaudio.h"
install -m 0644 "${S}/src/portaudio19.h" "${S}/src/portaudio.h"
}
do_compile() {
cd src
oe_runmake
cd "${S}/platforms/big_endian"
qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${S}/platforms/big_endian', '${STAGING_DIR_TARGET}${base_libdir}'])}"
cat >qemuwrapper <<EOF
#!/bin/sh
$qemu_binary "\$@"
EOF
chmod +x qemuwrapper
sed -i '/^ *CC *=/d' Makefile
# Fixing byte order of phoneme data files
if [ "${SITEINFO_ENDIANNESS}" = "be" ]; then
sed -i 's/\(.*BYTE_ORDER\)/#undef BYTE_ORDER\n#define BYTE_ORDER BIG_ENDIAN\n\1/' espeak-phoneme-data.c
else
sed -i 's/\(.*BYTE_ORDER\)/#undef BYTE_ORDER\n#define BYTE_ORDER LITTLE_ENDIAN\n\1/' espeak-phoneme-data.c
fi
oe_runmake
./qemuwrapper ./espeak-phoneme-data "${S}/espeak-data" "." "${S}/espeak-data/phondata-manifest"
cp -f phondata phonindex phontab "${S}/espeak-data"
}
do_install() {
@ -31,10 +61,7 @@ do_install() {
ln -sf espeak/espeak.h ${D}${includedir}/
oe_libinstall -so -C src libespeak ${D}${libdir}
if [ "${SITEINFO_ENDIANNESS}" = "be" ] ; then
# the big-endian phon* files are provided by the package espeak-data
rm -f ${S}/espeak-data/phon*
fi
cp -R --no-dereference --preserve=mode,links ${S}/espeak-data/* ${D}${datadir}/espeak-data
}
RDEPENDS_${PN} = "portaudio-v19"

View File

@ -0,0 +1,34 @@
From 451330d09a6a3500b40bc4f5896ba790ab46cd6c Mon Sep 17 00:00:00 2001
From: Romain Naour <romain.naour@gmail.com>
Date: Sun, 15 Jan 2017 19:37:31 +0100
Subject: [PATCH 2/2] tr_languages: cast string_ordinal init values
On some architecture, "char" is signed (x86_64, nios2...) so the
compiler try to convert int 0xc2 and 0xba to a signed char.
This is an error since gcc6 (Wnarrowing).
Fixes:
http://autobuild.buildroot.net/results/bae/baef9888b1979d18171668a675985e3f3b45fda6
Upstream-Status: Pending [imported from BR]
Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
src/tr_languages.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/tr_languages.cpp b/src/tr_languages.cpp
index 5c80286..dbc6e36 100644
--- a/src/tr_languages.cpp
+++ b/src/tr_languages.cpp
@@ -200,7 +200,7 @@ static const unsigned short chars_ignore_zwnj_hyphen[] = {
0x200d, 1, // zero width joiner
0, 0 };
-const char string_ordinal[] = {0xc2,0xba,0}; // masculine ordinal character, UTF-8
+const char string_ordinal[] = {(char)0xc2,(char)0xba,0}; // masculine ordinal character, UTF-8
static Translator* NewTranslator(void)
--
2.9.3

View File

@ -1,12 +0,0 @@
diff --git a/src/tr_languages.cpp b/src/tr_languages.cpp
--- a/src/tr_languages.cpp
+++ b/src/tr_languages.cpp
@@ -198,7 +198,7 @@ static const unsigned short chars_ignore_zwnj_hyphen[] = {
0x200d, 1, // zero width joiner
0, 0 };
-const char string_ordinal[] = {0xc2,0xba,0}; // masculine ordinal character, UTF-8
+const char string_ordinal[] = {'\xc2','\xba',0}; // masculine ordinal character, UTF-8
static Translator* NewTranslator(void)