xref: /OK3568_Linux_fs/yocto/meta-openembedded/meta-oe/recipes-support/espeak/espeak_1.48.04.bb (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1DESCRIPTION = "eSpeak is a compact open source software speech synthesizer"
2SECTION = "base"
3LICENSE = "GPL-3.0-only"
4LIC_FILES_CHKSUM = "file://License.txt;md5=cb7a20edb4c9f5f478de6523dcd7362c"
5
6SRC_URI = "http://downloads.sourceforge.net/espeak/espeak-1.48.04-source.zip \
7           file://0001-Fix-build-of-shared-library-on-architectures-needing.patch \
8           file://0002-tr_languages-cast-string_ordinal-init-values.patch \
9"
10SRC_URI[md5sum] = "cadd7482eaafe9239546bdc09fa244c3"
11SRC_URI[sha256sum] = "bf9a17673adffcc28ff7ea18764f06136547e97bbd9edf2ec612f09b207f0659"
12
13S = "${WORKDIR}/espeak-${PV}-source"
14
15DEPENDS = "portaudio-v19 qemu-helper-native"
16inherit siteinfo qemu
17
18
19CXXFLAGS += "-DUSE_PORTAUDIO"
20TARGET_CC_ARCH += "${LDFLAGS}"
21
22FILES:${PN} += "${datadir}/espeak-data"
23
24do_configure() {
25    #  "speak" binary, a TTS engine, uses portaudio in either APIs V18 or V19, use V19
26    install -m 0644 "${S}/src/portaudio19.h" "${S}/src/portaudio.h"
27}
28
29do_compile() {
30    cd src
31    oe_runmake
32
33    cd "${S}/platforms/big_endian"
34    qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${S}/platforms/big_endian', '${STAGING_DIR_TARGET}${base_libdir}'])}"
35    cat >qemuwrapper <<EOF
36#!/bin/sh
37$qemu_binary "\$@"
38EOF
39    chmod +x qemuwrapper
40    sed -i '/^ *CC *=/d' Makefile
41    # Fixing byte order of phoneme data files
42    if [ "${SITEINFO_ENDIANNESS}" = "be" ]; then
43        sed -i 's/\(.*BYTE_ORDER\)/#undef BYTE_ORDER\n#define BYTE_ORDER BIG_ENDIAN\n\1/' espeak-phoneme-data.c
44    else
45        sed -i 's/\(.*BYTE_ORDER\)/#undef BYTE_ORDER\n#define BYTE_ORDER LITTLE_ENDIAN\n\1/' espeak-phoneme-data.c
46    fi
47    oe_runmake
48    ./qemuwrapper ./espeak-phoneme-data "${S}/espeak-data" "." "${S}/espeak-data/phondata-manifest"
49    cp -f phondata phonindex phontab "${S}/espeak-data"
50}
51
52do_install() {
53    install -d ${D}${bindir}
54    install -d ${D}${libdir}
55    install -d ${D}${includedir}/espeak
56    install -d ${D}${datadir}/espeak-data
57
58    # we do not ship "speak" binary though.
59    install -m 0755 ${S}/src/espeak ${D}${bindir}
60    install -m 0644 ${S}/src/speak_lib.h ${D}${includedir}/espeak/
61    ln -sf espeak/espeak.h ${D}${includedir}/
62    oe_libinstall -so -C src libespeak ${D}${libdir}
63
64    cp -R --no-dereference --preserve=mode,links ${S}/espeak-data/* ${D}${datadir}/espeak-data
65}
66
67RDEPENDS:${PN} = "portaudio-v19"
68