Skip to content

Commit e2fafa5

Browse files
author
Bruno Berisso
authored
Merge pull request #46 from tryolabs/development
1.0.0
2 parents 3ce7254 + 321f352 commit e2fafa5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+3227
-1620
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ build/
1212
*.perspectivev3
1313
!default.perspectivev3
1414
xcuserdata
15+
xcshareddata
1516
*.xccheckout
1617
profile
1718
*.moved-aside
1819
DerivedData
1920
*.hmap
2021
*.ipa
22+
.LSOverride
2123

2224
# Bundler
2325
.bundle

Sphinx/LICENSE

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Copyright (c) 1999-2016 Carnegie Mellon University. All rights
2+
reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions
6+
are met:
7+
8+
1. Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
11+
2. Redistributions in binary form must reproduce the above copyright
12+
notice, this list of conditions and the following disclaimer in
13+
the documentation and/or other materials provided with the
14+
distribution.
15+
16+
This work was supported in part by funding from the Defense Advanced
17+
Research Projects Agency and the National Science Foundation of the
18+
United States of America, and the CMU Sphinx Speech Consortium.
19+
20+
THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
21+
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23+
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
24+
NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Sphinx/builder/README.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
2+
# CMU SphinxBase and PocketSphinx Builder
3+
4+
> **DISCLAIMER**: TLSphinx comes with pre-bundled sphinxbase and pocketsphinx
5+
> libraries and headers, you're **strongly** encouraged to use those instead of
6+
> building them on your own.
7+
8+
These are the CMU sphinxbase and pocketsphinx building instructions for TLSphinx, follow the guide below to build the required libraries for TLSphinx to build.
9+
10+
In order to build sphinxbase and pocketsphinx both packages need to be downloaded, see: [CMUSphinx Downloads](https://cmusphinx.github.io/wiki/download/).
11+
12+
From there you need to download:
13+
14+
* [sphinxbase-5prealpha](http://sourceforge.net/projects/cmusphinx/files/sphinxbase/5prealpha)
15+
* [pocketsphinx-5prealpha](http://sourceforge.net/projects/cmusphinx/files/pocketsphinx/5prealpha)
16+
17+
After downloading both files copy them to `Sphinx/builder/cmusphinx`
18+
19+
## Automatic Compilation
20+
After copying the files to the appropiate directory (*see above*) just run the install.sh script and with some luck you're done.
21+
22+
```
23+
cd Sphinx/builder/
24+
./install.sh
25+
```
26+
27+
28+
---
29+
## Manual Compilation
30+
If possible please try automatic compilation when possible, manual compilation is not for the feint of heart yet it might help in scenarios where you want to build CMU Sphinx Base and Pocket Sphinx from their respective master branches.
31+
32+
Below are sample instructions on how to manually build the **5prealpha** release, to build against the lastest source just modify each command accordingly.
33+
### Sphinxbase
34+
---
35+
#### To prepare build environment:
36+
```
37+
#From TLSphinx root directory
38+
cd Sphinx/builder/cmusphinx
39+
tar zxvf sphinxbase-5prealpha.tar.gz
40+
cp ../ios-build-sphinxbase.sh sphinxbase-5prealpha/
41+
```
42+
#### To build:
43+
```
44+
SPHINX_VERSION_REQ=5prealpha
45+
cd sphinxbase-5prealpha
46+
./ios-build-sphinxbase.sh
47+
```
48+
#### Install Libraries:
49+
```
50+
cp bin/arm64/lib/libsphinx*.a ../../../lib/sphinxbase/arm64/
51+
cp bin/armv7/lib/libsphinx*.a ../../../lib/sphinxbase/armv7/
52+
cp bin/armv7s/lib/libsphinx*.a ../../../lib/sphinxbase/armv7s/
53+
cp bin/i386/lib/libsphinx*.a ../../../lib/sphinxbase/i386/
54+
cp bin/x86_64/lib/libsphinx*.a ../../../lib/sphinxbase/x86_64/
55+
cp bin/libsphinxad.a ../../../lib/sphinxbase/
56+
cp bin/libsphinxbase.a ../../../lib/sphinxbase/
57+
```
58+
#### Install Headers
59+
```
60+
cp include/sphinxbase/ ../../../include/sphinxbase/
61+
cp include/sphinx_config.h ../../../include/sphinxbase/
62+
```
63+
64+
### PocketSphinx
65+
---
66+
#### To prepare build environment:
67+
```
68+
#From TLSphinx root directory
69+
cd Sphinx/builder/cmusphinx
70+
tar zxvf pocketsphinx-5prealpha.tar.gz
71+
cp ../ios-build-pocketsphinx.sh pocketsphinx-5prealpha/
72+
```
73+
#### To build:
74+
```
75+
SPHINX_VERSION_REQ=5prealpha
76+
cd pocketsphinx-5prealpha
77+
./ios-build-pocketsphinx.sh
78+
```
79+
#### Install Libraries:
80+
```
81+
cp bin/arm64/lib/libpocketsphinx.a ../../../lib/pocketsphinx/arm64/
82+
cp bin/armv7/lib/libpocketsphinx.a ../../../lib/pocketsphinx/armv7/
83+
cp bin/armv7s/lib/libpocketsphinx.a ../../../lib/pocketsphinx/armv7s/
84+
cp bin/i386/lib/libpocketsphinx.a ../../../lib/pocketsphinx/i386/
85+
cp bin/x86_64/lib/libpocketsphinx.a ../../../lib/pocketsphinx/x86_64/
86+
cp bin/libpocketsphinx.a ../../../lib/pocketsphinx/
87+
```
88+
#### Install Headers
89+
```
90+
cp -vf include/*.h ../../../include/pocketsphinx/
91+
```
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.tar.gz
2+
*sphinx*/

Sphinx/builder/cmusphinx/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Yes this is the directory where you should put
2+
3+
* pocketsphinx-5prealpha.tar.gz
4+
* sphinxbase-5prealpha.tar.Igz

Sphinx/builder/install.sh

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/bin/sh
2+
SPHINX_VERSION_REQ=5prealpha
3+
SPHINXBASE_RELEASE=sphinxbase-${SPHINX_VERSION_REQ}
4+
POCKETSPHINX_RELEASE=pocketsphinx-${SPHINX_VERSION_REQ}
5+
export SPHINX_VERSION_REQ
6+
7+
SPHINXBASE_PKG=${SPHINXBASE_RELEASE}.tar.gz
8+
POCKETSPHINX_PKG=${POCKETSPHINX}.tar.gz
9+
10+
#Check Sphinx libraries are in place
11+
if [ ! -f `pwd`/cmusphinx/${SPHINXBASE_RELEASE}.tar.gz ]; then
12+
echo "Please follow the readme instrunctions on how to download ${SPHINXBASE_PKG}"
13+
exit 1
14+
fi
15+
16+
if [ ! -f `pwd`/cmusphinx/${POCKETSPHINX_RELEASE}.tar.gz ]; then
17+
echo "Please follow the readme instrunctions on how to download ${POCKETSPHINX_PKG}"
18+
exit 1
19+
fi
20+
21+
cd cmusphinx
22+
rm -f build.log > /dev/null 2>&1
23+
24+
for SPHINX_PROJECT in ${SPHINXBASE_RELEASE} ${POCKETSPHINX_RELEASE}
25+
do
26+
#Delete previous build directory if found
27+
if [ -d ${SPHINX_PROJECT} ]; then
28+
rm -rf ${SPHINX_PROJECT}
29+
fi
30+
tarfile=${SPHINX_PROJECT}.tar.gz
31+
echo "Decompressing ${tarfile}..."
32+
tar zxf $tarfile || exit 1
33+
done
34+
35+
#Copy build scripts
36+
cp -f ../ios-build-sphinxbase.sh ${SPHINXBASE_RELEASE}/
37+
cp -f ../ios-build-pocketsphinx.sh ${POCKETSPHINX_RELEASE}/
38+
39+
#Compile SphinxBase
40+
cd $SPHINXBASE_RELEASE
41+
./ios-build-sphinxbase.sh || exit 1
42+
cd ..
43+
#Compile PocketSphinx
44+
cd $POCKETSPHINX_RELEASE
45+
./ios-build-pocketsphinx.sh || exit 1
46+
cd ..
47+
48+
#rm -rf ../../../lib/*sphinx*
49+
#rm -rf ../../../include/*sphinx*
50+
51+
cd $SPHINXBASE_RELEASE
52+
echo
53+
echo "Installing SphinxBase libraries..."
54+
cp -f bin/arm64/lib/libsphinx*.a ../../../lib/sphinxbase/arm64/ &&
55+
cp -f bin/armv7/lib/libsphinx*.a ../../../lib/sphinxbase/armv7/ &&
56+
cp -f bin/armv7s/lib/libsphinx*.a ../../../lib/sphinxbase/armv7s/ &&
57+
cp -f bin/i386/lib/libsphinx*.a ../../../lib/sphinxbase/i386/ &&
58+
cp -f bin/x86_64/lib/libsphinx*.a ../../../lib/sphinxbase/x86_64/ &&
59+
cp -f bin/libsphinxad.a ../../../lib/sphinxbase/ &&
60+
cp -f bin/libsphinxbase.a ../../../lib/sphinxbase/ || exit 1
61+
echo
62+
echo "Installing SphinxBase header..."
63+
cp -f include/sphinxbase/*.h ../../../include/sphinxbase/ &&
64+
cp -f include/sphinx_config.h ../../../include/sphinxbase/ || exit 1
65+
cd ..
66+
67+
cd $POCKETSPHINX_RELEASE
68+
echo
69+
echo "Installing PocketSphinx libraries..."
70+
cp -f bin/arm64/lib/libpocketsphinx.a ../../../lib/pocketsphinx/arm64/ &&
71+
cp -f bin/armv7/lib/libpocketsphinx.a ../../../lib/pocketsphinx/armv7/ &&
72+
cp -f bin/armv7s/lib/libpocketsphinx.a ../../../lib/pocketsphinx/armv7s/ &&
73+
cp -f bin/i386/lib/libpocketsphinx.a ../../../lib/pocketsphinx/i386/ &&
74+
cp -f bin/x86_64/lib/libpocketsphinx.a ../../../lib/pocketsphinx/x86_64/ &&
75+
cp -f bin/libpocketsphinx.a ../../../lib/pocketsphinx/ || exit 1
76+
echo
77+
echo "Installing PocketSphinx headers..."
78+
cp -vf include/*.h ../../../include/pocketsphinx/ || exit 1
79+
80+
cd ..
81+
echo Done
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/sh
2+
3+
SCRATCH="scratch"
4+
DEST=`pwd`/"bin"
5+
6+
ARCHS="arm64 armv7 armv7s x86_64 i386"
7+
8+
if [ "$*" ]
9+
then
10+
ARCHS="$*"
11+
fi
12+
13+
if [ "${SPHINX_VERSION_REQ}" != "" ]; then
14+
SPHINX_VERSION_SUFFIX="-${SPHINX_VERSION_REQ}"
15+
fi
16+
17+
CWD=`pwd`
18+
19+
for ARCH in $ARCHS
20+
do
21+
SPHINXBASE_DIR=`pwd`/../sphinxbase${SPHINX_VERSION_SUFFIX}/bin/$ARCH
22+
echo "building $ARCH..."
23+
mkdir -p "$SCRATCH/$ARCH"
24+
cd "$SCRATCH/$ARCH"
25+
26+
MIN_IOS_VERSION="8.0"
27+
if [[ "${ARCH}" == "arm64" || "${ARCH}" == "x86_64" ]]; then
28+
MIN_IOS_VERSION="7.0" # 7.0 as this is the minimum for these architectures
29+
fi
30+
31+
if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]
32+
then
33+
PLATFORM="iPhoneSimulator"
34+
IOS_CFLAGS="-arch $ARCH -mios-simulator-version-min=$MIN_IOS_VERSION"
35+
else
36+
PLATFORM="iPhoneOS"
37+
IOS_CFLAGS="-arch $ARCH -mios-version-min=$MIN_IOS_VERSION -fembed-bitcode"
38+
fi
39+
40+
HOST_TYPE="${ARCH}-apple-darwin"
41+
if [ "${ARCH}" == "arm64" ]; then
42+
# Fix unknown type for arm64 cpu (which is aarch64)
43+
HOST_TYPE="aarch64-apple-darwin"
44+
fi
45+
46+
export DEVELOPER=`xcode-select --print-path`
47+
export DEVROOT="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
48+
export SDKROOT="${DEVROOT}/SDKs/${PLATFORM}${IPHONE_SDK}.sdk"
49+
export CC=`xcrun -find clang`
50+
export LD=`xcrun -find ld`
51+
export CFLAGS="-O3 ${IOS_CFLAGS} -isysroot ${SDKROOT}"
52+
export LDFLAGS="${IOS_CFLAGS} -isysroot ${SDKROOT}"
53+
export CPPFLAGS="${CFLAGS}"
54+
55+
$CWD/configure \
56+
--host="${HOST_TYPE}" \
57+
--prefix="$DEST/$ARCH" \
58+
--without-lapack \
59+
--without-python \
60+
--with-sphinxbase="$SPHINXBASE_DIR" \
61+
|| exit 1
62+
63+
make -j3 install || exit 1
64+
cd $CWD
65+
done
66+
67+
PROJECT=pocketsphinx
68+
69+
if [ ! "$*" ]
70+
then
71+
LIPO_ARGS="-output $DEST/lib$PROJECT.a"
72+
for ARCH in $ARCHS
73+
do
74+
LIPO_ARGS="$LIPO_ARGS $DEST/$ARCH/lib/lib$PROJECT.a"
75+
done
76+
lipo -create $LIPO_ARGS || exit 1
77+
fi
78+
79+
echo Done
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/bin/sh
2+
3+
SCRATCH="scratch"
4+
DEST=`pwd`/"bin"
5+
6+
ARCHS="arm64 armv7 armv7s x86_64 i386"
7+
8+
if [ "$*" ]
9+
then
10+
ARCHS="$*"
11+
fi
12+
13+
if [ "${SPHINX_VERSION_REQ}" != "" ]; then
14+
SPHINX_PKG_SUFFIX="-${SPHINX_VERSION_REQ}"
15+
fi
16+
17+
CWD=`pwd`
18+
19+
for ARCH in $ARCHS
20+
do
21+
SPHINXBASE_DIR=`pwd`/../sphinxbase${SPHINX_VERSION_SUFFIX}/bin/$ARCH
22+
echo "building $ARCH..."
23+
mkdir -p "$SCRATCH/$ARCH"
24+
cd "$SCRATCH/$ARCH"
25+
26+
MIN_IOS_VERSION="8.0"
27+
if [[ "${ARCH}" == "arm64" || "${ARCH}" == "x86_64" ]]; then
28+
MIN_IOS_VERSION="7.0" # 7.0 as this is the minimum for these architectures
29+
fi
30+
31+
if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]
32+
then
33+
PLATFORM="iPhoneSimulator"
34+
IOS_CFLAGS="-arch $ARCH -mios-simulator-version-min=$MIN_IOS_VERSION"
35+
else
36+
PLATFORM="iPhoneOS"
37+
IOS_CFLAGS="-arch $ARCH -mios-version-min=$MIN_IOS_VERSION -fembed-bitcode"
38+
fi
39+
40+
HOST_TYPE="${ARCH}-apple-darwin"
41+
if [ "${ARCH}" == "arm64" ]; then
42+
# Fix unknown type for arm64 cpu (which is aarch64)
43+
HOST_TYPE="aarch64-apple-darwin"
44+
fi
45+
46+
export DEVELOPER=`xcode-select --print-path`
47+
export DEVROOT="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
48+
export SDKROOT="${DEVROOT}/SDKs/${PLATFORM}${IPHONE_SDK}.sdk"
49+
export CC=`xcrun -find clang`
50+
export LD=`xcrun -find ld`
51+
export CFLAGS="-O3 ${IOS_CFLAGS} -isysroot ${SDKROOT}"
52+
export LDFLAGS="${IOS_CFLAGS} -isysroot ${SDKROOT}"
53+
export CPPFLAGS="${CFLAGS}"
54+
55+
$CWD/configure \
56+
--host="${HOST_TYPE}" \
57+
--prefix="$DEST/$ARCH" \
58+
--without-lapack \
59+
--without-python \
60+
--with-sphinxbase="$SPHINXBASE_DIR" \
61+
|| exit 1
62+
63+
make -j3 install || exit 1
64+
cd $CWD
65+
done
66+
67+
PROJECT=sphinxbase
68+
69+
if [ ! "$*" ]
70+
then
71+
LIPO_ARGS="-output $DEST/lib$PROJECT.a"
72+
for ARCH in $ARCHS
73+
do
74+
LIPO_ARGS="$LIPO_ARGS $DEST/$ARCH/lib/lib$PROJECT.a"
75+
done
76+
lipo -create $LIPO_ARGS || exit 1
77+
fi
78+
# libsphinxad
79+
if [ ! "$*" ]
80+
then
81+
LIPO_ARGS="-output $DEST/libsphinxad.a"
82+
for ARCH in $ARCHS
83+
do
84+
LIPO_ARGS="$LIPO_ARGS $DEST/$ARCH/lib/libsphinxad.a"
85+
done
86+
lipo -create $LIPO_ARGS || exit 1
87+
fi
88+
89+
echo Done

0 commit comments

Comments
 (0)