-
Notifications
You must be signed in to change notification settings - Fork 53
Enables bitcode support for TLSphinx #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| Copyright (c) 1999-2016 Carnegie Mellon University. All rights | ||
| reserved. | ||
|
|
||
| Redistribution and use in source and binary forms, with or without | ||
| modification, are permitted provided that the following conditions | ||
| are met: | ||
|
|
||
| 1. Redistributions of source code must retain the above copyright | ||
| notice, this list of conditions and the following disclaimer. | ||
|
|
||
| 2. Redistributions in binary form must reproduce the above copyright | ||
| notice, this list of conditions and the following disclaimer in | ||
| the documentation and/or other materials provided with the | ||
| distribution. | ||
|
|
||
| This work was supported in part by funding from the Defense Advanced | ||
| Research Projects Agency and the National Science Foundation of the | ||
| United States of America, and the CMU Sphinx Speech Consortium. | ||
|
|
||
| THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND | ||
| ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY | ||
| NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
|
|
||
| # CMU SphinxBase and PocketSphinx Builder | ||
|
|
||
| > **DISCLAIMER**: TLSphinx comes with pre-bundled sphinxbase and pocketsphinx | ||
| > libraries and headers, you're **strongly** encouraged to use those instead of | ||
| > building them on your own. | ||
|
|
||
| These are the CMU sphinxbase and pocketsphinx building instructions for TLSphinx, follow the guide below to build the required libraries for TLSphinx to build. | ||
|
|
||
| In order to build sphinxbase and pocketsphinx both packages need to be downloaded, see: [CMUSphinx Downloads](https://cmusphinx.github.io/wiki/download/). | ||
|
|
||
| From there you need to download: | ||
|
|
||
| * [sphinxbase-5prealpha](http://sourceforge.net/projects/cmusphinx/files/sphinxbase/5prealpha) | ||
| * [pocketsphinx-5prealpha](http://sourceforge.net/projects/cmusphinx/files/pocketsphinx/5prealpha) | ||
|
|
||
| After downloading both files copy them to `Sphinx/builder/cmusphinx` | ||
|
|
||
| ## Automatic Compilation | ||
| After copying the files to the appropiate directory (*see above*) just run the install.sh script and with some luck you're done. | ||
|
|
||
| ``` | ||
| cd Sphinx/builder/ | ||
| ./install.sh | ||
| ``` | ||
|
|
||
|
|
||
| --- | ||
| ## Manual Compilation | ||
| 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. | ||
|
|
||
| Below are sample instructions on how to manually build the **5prealpha** release, to build against the lastest source just modify each command accordingly. | ||
| ### Sphinxbase | ||
| --- | ||
| #### To prepare build environment: | ||
| ``` | ||
| #From TLSphinx root directory | ||
| cd Sphinx/builder/cmusphinx | ||
| tar zxvf sphinxbase-5prealpha.tar.gz | ||
| cp ../ios-build-sphinxbase.sh sphinxbase-5prealpha/ | ||
| ``` | ||
| #### To build: | ||
| ``` | ||
| SPHINX_VERSION_REQ=5prealpha | ||
| cd sphinxbase-5prealpha | ||
| ./ios-build-sphinxbase.sh | ||
| ``` | ||
| #### Install Libraries: | ||
| ``` | ||
| cp bin/arm64/lib/libsphinx*.a ../../../lib/sphinxbase/arm64/ | ||
| cp bin/armv7/lib/libsphinx*.a ../../../lib/sphinxbase/armv7/ | ||
| cp bin/armv7s/lib/libsphinx*.a ../../../lib/sphinxbase/armv7s/ | ||
| cp bin/i386/lib/libsphinx*.a ../../../lib/sphinxbase/i386/ | ||
| cp bin/x86_64/lib/libsphinx*.a ../../../lib/sphinxbase/x86_64/ | ||
| cp bin/libsphinxad.a ../../../lib/sphinxbase/ | ||
| cp bin/libsphinxbase.a ../../../lib/sphinxbase/ | ||
| ``` | ||
| #### Install Headers | ||
| ``` | ||
| cp include/sphinxbase/ ../../../include/sphinxbase/ | ||
| cp include/sphinx_config.h ../../../include/sphinxbase/ | ||
| ``` | ||
|
|
||
| ### PocketSphinx | ||
| --- | ||
| #### To prepare build environment: | ||
| ``` | ||
| #From TLSphinx root directory | ||
| cd Sphinx/builder/cmusphinx | ||
| tar zxvf pocketsphinx-5prealpha.tar.gz | ||
| cp ../ios-build-pocketsphinx.sh pocketsphinx-5prealpha/ | ||
| ``` | ||
| #### To build: | ||
| ``` | ||
| SPHINX_VERSION_REQ=5prealpha | ||
| cd pocketsphinx-5prealpha | ||
| ./ios-build-pocketsphinx.sh | ||
| ``` | ||
| #### Install Libraries: | ||
| ``` | ||
| cp bin/arm64/lib/libpocketsphinx.a ../../../lib/pocketsphinx/arm64/ | ||
| cp bin/armv7/lib/libpocketsphinx.a ../../../lib/pocketsphinx/armv7/ | ||
| cp bin/armv7s/lib/libpocketsphinx.a ../../../lib/pocketsphinx/armv7s/ | ||
| cp bin/i386/lib/libpocketsphinx.a ../../../lib/pocketsphinx/i386/ | ||
| cp bin/x86_64/lib/libpocketsphinx.a ../../../lib/pocketsphinx/x86_64/ | ||
| cp bin/libpocketsphinx.a ../../../lib/pocketsphinx/ | ||
| ``` | ||
| #### Install Headers | ||
| ``` | ||
| cp -vf include/*.h ../../../include/pocketsphinx/ | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| *.tar.gz | ||
| *sphinx*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Yes this is the directory where you should put | ||
|
|
||
| * pocketsphinx-5prealpha.tar.gz | ||
| * sphinxbase-5prealpha.tar.Igz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| #!/bin/sh | ||
| SPHINX_VERSION_REQ=5prealpha | ||
| SPHINXBASE_RELEASE=sphinxbase-${SPHINX_VERSION_REQ} | ||
| POCKETSPHINX_RELEASE=pocketsphinx-${SPHINX_VERSION_REQ} | ||
| export SPHINX_VERSION_REQ | ||
|
|
||
| SPHINXBASE_PKG=${SPHINXBASE_RELEASE}.tar.gz | ||
| POCKETSPHINX_PKG=${POCKETSPHINX}.tar.gz | ||
|
|
||
| #Check Sphinx libraries are in place | ||
| if [ ! -f `pwd`/cmusphinx/${SPHINXBASE_RELEASE}.tar.gz ]; then | ||
| echo "Please follow the readme instrunctions on how to download ${SPHINXBASE_PKG}" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -f `pwd`/cmusphinx/${POCKETSPHINX_RELEASE}.tar.gz ]; then | ||
| echo "Please follow the readme instrunctions on how to download ${POCKETSPHINX_PKG}" | ||
| exit 1 | ||
| fi | ||
|
|
||
| cd cmusphinx | ||
| rm -f build.log > /dev/null 2>&1 | ||
|
|
||
| for SPHINX_PROJECT in ${SPHINXBASE_RELEASE} ${POCKETSPHINX_RELEASE} | ||
| do | ||
| #Delete previous build directory if found | ||
| if [ -d ${SPHINX_PROJECT} ]; then | ||
| rm -rf ${SPHINX_PROJECT} | ||
| fi | ||
| tarfile=${SPHINX_PROJECT}.tar.gz | ||
| echo "Decompressing ${tarfile}..." | ||
| tar zxf $tarfile || exit 1 | ||
| done | ||
|
|
||
| #Copy build scripts | ||
| cp -f ../ios-build-sphinxbase.sh ${SPHINXBASE_RELEASE}/ | ||
| cp -f ../ios-build-pocketsphinx.sh ${POCKETSPHINX_RELEASE}/ | ||
|
|
||
| #Compile SphinxBase | ||
| cd $SPHINXBASE_RELEASE | ||
| ./ios-build-sphinxbase.sh || exit 1 | ||
| cd .. | ||
| #Compile PocketSphinx | ||
| cd $POCKETSPHINX_RELEASE | ||
| ./ios-build-pocketsphinx.sh || exit 1 | ||
| cd .. | ||
|
|
||
| #rm -rf ../../../lib/*sphinx* | ||
| #rm -rf ../../../include/*sphinx* | ||
|
|
||
| cd $SPHINXBASE_RELEASE | ||
| echo | ||
| echo "Installing SphinxBase libraries..." | ||
| cp -f bin/arm64/lib/libsphinx*.a ../../../lib/sphinxbase/arm64/ && | ||
| cp -f bin/armv7/lib/libsphinx*.a ../../../lib/sphinxbase/armv7/ && | ||
| cp -f bin/armv7s/lib/libsphinx*.a ../../../lib/sphinxbase/armv7s/ && | ||
| cp -f bin/i386/lib/libsphinx*.a ../../../lib/sphinxbase/i386/ && | ||
| cp -f bin/x86_64/lib/libsphinx*.a ../../../lib/sphinxbase/x86_64/ && | ||
| cp -f bin/libsphinxad.a ../../../lib/sphinxbase/ && | ||
| cp -f bin/libsphinxbase.a ../../../lib/sphinxbase/ || exit 1 | ||
| echo | ||
| echo "Installing SphinxBase header..." | ||
| cp -f include/sphinxbase/*.h ../../../include/sphinxbase/ && | ||
| cp -f include/sphinx_config.h ../../../include/sphinxbase/ || exit 1 | ||
| cd .. | ||
|
|
||
| cd $POCKETSPHINX_RELEASE | ||
| echo | ||
| echo "Installing PocketSphinx libraries..." | ||
| cp -f bin/arm64/lib/libpocketsphinx.a ../../../lib/pocketsphinx/arm64/ && | ||
| cp -f bin/armv7/lib/libpocketsphinx.a ../../../lib/pocketsphinx/armv7/ && | ||
| cp -f bin/armv7s/lib/libpocketsphinx.a ../../../lib/pocketsphinx/armv7s/ && | ||
| cp -f bin/i386/lib/libpocketsphinx.a ../../../lib/pocketsphinx/i386/ && | ||
| cp -f bin/x86_64/lib/libpocketsphinx.a ../../../lib/pocketsphinx/x86_64/ && | ||
| cp -f bin/libpocketsphinx.a ../../../lib/pocketsphinx/ || exit 1 | ||
| echo | ||
| echo "Installing PocketSphinx headers..." | ||
| cp -vf include/*.h ../../../include/pocketsphinx/ || exit 1 | ||
|
|
||
| cd .. | ||
| echo Done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| #!/bin/sh | ||
|
|
||
| SCRATCH="scratch" | ||
| DEST=`pwd`/"bin" | ||
|
|
||
| ARCHS="arm64 armv7 armv7s x86_64 i386" | ||
|
|
||
| if [ "$*" ] | ||
| then | ||
| ARCHS="$*" | ||
| fi | ||
|
|
||
| if [ "${SPHINX_VERSION_REQ}" != "" ]; then | ||
| SPHINX_VERSION_SUFFIX="-${SPHINX_VERSION_REQ}" | ||
| fi | ||
|
|
||
| CWD=`pwd` | ||
|
|
||
| for ARCH in $ARCHS | ||
| do | ||
| SPHINXBASE_DIR=`pwd`/../sphinxbase${SPHINX_VERSION_SUFFIX}/bin/$ARCH | ||
| echo "building $ARCH..." | ||
| mkdir -p "$SCRATCH/$ARCH" | ||
| cd "$SCRATCH/$ARCH" | ||
|
|
||
| MIN_IOS_VERSION="8.0" | ||
| if [[ "${ARCH}" == "arm64" || "${ARCH}" == "x86_64" ]]; then | ||
| MIN_IOS_VERSION="7.0" # 7.0 as this is the minimum for these architectures | ||
| fi | ||
|
|
||
| if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ] | ||
| then | ||
| PLATFORM="iPhoneSimulator" | ||
| IOS_CFLAGS="-arch $ARCH -mios-simulator-version-min=$MIN_IOS_VERSION" | ||
| else | ||
| PLATFORM="iPhoneOS" | ||
| IOS_CFLAGS="-arch $ARCH -mios-version-min=$MIN_IOS_VERSION -fembed-bitcode" | ||
| fi | ||
|
|
||
| HOST_TYPE="${ARCH}-apple-darwin" | ||
| if [ "${ARCH}" == "arm64" ]; then | ||
| # Fix unknown type for arm64 cpu (which is aarch64) | ||
| HOST_TYPE="aarch64-apple-darwin" | ||
| fi | ||
|
|
||
| export DEVELOPER=`xcode-select --print-path` | ||
| export DEVROOT="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer" | ||
| export SDKROOT="${DEVROOT}/SDKs/${PLATFORM}${IPHONE_SDK}.sdk" | ||
| export CC=`xcrun -find clang` | ||
| export LD=`xcrun -find ld` | ||
| export CFLAGS="-O3 ${IOS_CFLAGS} -isysroot ${SDKROOT}" | ||
| export LDFLAGS="${IOS_CFLAGS} -isysroot ${SDKROOT}" | ||
| export CPPFLAGS="${CFLAGS}" | ||
|
|
||
| $CWD/configure \ | ||
| --host="${HOST_TYPE}" \ | ||
| --prefix="$DEST/$ARCH" \ | ||
| --without-lapack \ | ||
| --without-python \ | ||
| --with-sphinxbase="$SPHINXBASE_DIR" \ | ||
| || exit 1 | ||
|
|
||
| make -j3 install || exit 1 | ||
| cd $CWD | ||
| done | ||
|
|
||
| PROJECT=pocketsphinx | ||
|
|
||
| if [ ! "$*" ] | ||
| then | ||
| LIPO_ARGS="-output $DEST/lib$PROJECT.a" | ||
| for ARCH in $ARCHS | ||
| do | ||
| LIPO_ARGS="$LIPO_ARGS $DEST/$ARCH/lib/lib$PROJECT.a" | ||
| done | ||
| lipo -create $LIPO_ARGS || exit 1 | ||
| fi | ||
|
|
||
| echo Done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| #!/bin/sh | ||
|
|
||
| SCRATCH="scratch" | ||
| DEST=`pwd`/"bin" | ||
|
|
||
| ARCHS="arm64 armv7 armv7s x86_64 i386" | ||
|
|
||
| if [ "$*" ] | ||
| then | ||
| ARCHS="$*" | ||
| fi | ||
|
|
||
| if [ "${SPHINX_VERSION_REQ}" != "" ]; then | ||
| SPHINX_PKG_SUFFIX="-${SPHINX_VERSION_REQ}" | ||
| fi | ||
|
|
||
| CWD=`pwd` | ||
|
|
||
| for ARCH in $ARCHS | ||
| do | ||
| SPHINXBASE_DIR=`pwd`/../sphinxbase${SPHINX_VERSION_SUFFIX}/bin/$ARCH | ||
| echo "building $ARCH..." | ||
| mkdir -p "$SCRATCH/$ARCH" | ||
| cd "$SCRATCH/$ARCH" | ||
|
|
||
| MIN_IOS_VERSION="8.0" | ||
| if [[ "${ARCH}" == "arm64" || "${ARCH}" == "x86_64" ]]; then | ||
| MIN_IOS_VERSION="7.0" # 7.0 as this is the minimum for these architectures | ||
| fi | ||
|
|
||
| if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ] | ||
| then | ||
| PLATFORM="iPhoneSimulator" | ||
| IOS_CFLAGS="-arch $ARCH -mios-simulator-version-min=$MIN_IOS_VERSION" | ||
| else | ||
| PLATFORM="iPhoneOS" | ||
| IOS_CFLAGS="-arch $ARCH -mios-version-min=$MIN_IOS_VERSION -fembed-bitcode" | ||
| fi | ||
|
|
||
| HOST_TYPE="${ARCH}-apple-darwin" | ||
| if [ "${ARCH}" == "arm64" ]; then | ||
| # Fix unknown type for arm64 cpu (which is aarch64) | ||
| HOST_TYPE="aarch64-apple-darwin" | ||
| fi | ||
|
|
||
| export DEVELOPER=`xcode-select --print-path` | ||
| export DEVROOT="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer" | ||
| export SDKROOT="${DEVROOT}/SDKs/${PLATFORM}${IPHONE_SDK}.sdk" | ||
| export CC=`xcrun -find clang` | ||
| export LD=`xcrun -find ld` | ||
| export CFLAGS="-O3 ${IOS_CFLAGS} -isysroot ${SDKROOT}" | ||
| export LDFLAGS="${IOS_CFLAGS} -isysroot ${SDKROOT}" | ||
| export CPPFLAGS="${CFLAGS}" | ||
|
|
||
| $CWD/configure \ | ||
| --host="${HOST_TYPE}" \ | ||
| --prefix="$DEST/$ARCH" \ | ||
| --without-lapack \ | ||
| --without-python \ | ||
| --with-sphinxbase="$SPHINXBASE_DIR" \ | ||
| || exit 1 | ||
|
|
||
| make -j3 install || exit 1 | ||
| cd $CWD | ||
| done | ||
|
|
||
| PROJECT=sphinxbase | ||
|
|
||
| if [ ! "$*" ] | ||
| then | ||
| LIPO_ARGS="-output $DEST/lib$PROJECT.a" | ||
| for ARCH in $ARCHS | ||
| do | ||
| LIPO_ARGS="$LIPO_ARGS $DEST/$ARCH/lib/lib$PROJECT.a" | ||
| done | ||
| lipo -create $LIPO_ARGS || exit 1 | ||
| fi | ||
| # libsphinxad | ||
| if [ ! "$*" ] | ||
| then | ||
| LIPO_ARGS="-output $DEST/libsphinxad.a" | ||
| for ARCH in $ARCHS | ||
| do | ||
| LIPO_ARGS="$LIPO_ARGS $DEST/$ARCH/lib/libsphinxad.a" | ||
| done | ||
| lipo -create $LIPO_ARGS || exit 1 | ||
| fi | ||
|
|
||
| echo Done |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo: feint should be faint