diff mbox series

[oe,meta-oe,1/2] espeak: Generate phondata based on endianness of targer

Message ID 20190211153009.24991-1-raj.khem@gmail.com
State New
Headers show
Series [oe,meta-oe,1/2] espeak: Generate phondata based on endianness of targer | expand

Commit Message

Khem Raj Feb. 11, 2019, 3:30 p.m. UTC
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>

---
 .../espeak/espeak-data_1.48.04.bb             | 24 ----------
 meta-oe/recipes-support/espeak/espeak.inc     | 15 ------
 .../recipes-support/espeak/espeak_1.48.04.bb  | 47 +++++++++++++++----
 ...ages-cast-string_ordinal-init-values.patch | 34 ++++++++++++++
 .../espeak/files/espeak-1.48-gcc-6-fix.patch  | 12 -----
 5 files changed, 71 insertions(+), 61 deletions(-)
 delete mode 100644 meta-oe/recipes-support/espeak/espeak-data_1.48.04.bb
 delete mode 100644 meta-oe/recipes-support/espeak/espeak.inc
 create mode 100644 meta-oe/recipes-support/espeak/files/0002-tr_languages-cast-string_ordinal-init-values.patch
 delete mode 100644 meta-oe/recipes-support/espeak/files/espeak-1.48-gcc-6-fix.patch

-- 
2.20.1

-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/espeak/espeak-data_1.48.04.bb b/meta-oe/recipes-support/espeak/espeak-data_1.48.04.bb
deleted file mode 100644
index a4e5d14d17..0000000000
--- a/meta-oe/recipes-support/espeak/espeak-data_1.48.04.bb
+++ /dev/null
@@ -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
-}
diff --git a/meta-oe/recipes-support/espeak/espeak.inc b/meta-oe/recipes-support/espeak/espeak.inc
deleted file mode 100644
index f45455c7e1..0000000000
--- a/meta-oe/recipes-support/espeak/espeak.inc
+++ /dev/null
@@ -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"
diff --git a/meta-oe/recipes-support/espeak/espeak_1.48.04.bb b/meta-oe/recipes-support/espeak/espeak_1.48.04.bb
index 57e30f0710..78f8f85c96 100644
--- a/meta-oe/recipes-support/espeak/espeak_1.48.04.bb
+++ b/meta-oe/recipes-support/espeak/espeak_1.48.04.bb
@@ -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"
diff --git a/meta-oe/recipes-support/espeak/files/0002-tr_languages-cast-string_ordinal-init-values.patch b/meta-oe/recipes-support/espeak/files/0002-tr_languages-cast-string_ordinal-init-values.patch
new file mode 100644
index 0000000000..cef360eaef
--- /dev/null
+++ b/meta-oe/recipes-support/espeak/files/0002-tr_languages-cast-string_ordinal-init-values.patch
@@ -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
+
diff --git a/meta-oe/recipes-support/espeak/files/espeak-1.48-gcc-6-fix.patch b/meta-oe/recipes-support/espeak/files/espeak-1.48-gcc-6-fix.patch
deleted file mode 100644
index 6e59c7892f..0000000000
--- a/meta-oe/recipes-support/espeak/files/espeak-1.48-gcc-6-fix.patch
+++ /dev/null
@@ -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)