setup.sh 1.8 KB
Newer Older
Y
Yibing Liu 已提交
1
#! /usr/bin/env  bash
Y
yangyaming 已提交
2

3 4 5
source utils/log.sh


H
Hui Zhang 已提交
6 7 8 9 10
SUDO='sudo'
if [ $(id -u) -eq 0 ]; then
  SUDO=''
fi

11 12 13 14 15 16 17
if [ -e /etc/lsb-release ];then
    #${SUDO} apt-get update
    ${SUDO} apt-get install -y vim tig tree sox pkg-config libflac-dev libogg-dev libvorbis-dev libboost-dev swig python3-dev
    if [ $? != 0 ]; then
        error_msg "Please using Ubuntu or install pkg-config libflac-dev libogg-dev libvorbis-dev libboost-dev swig python3-dev by user."
        exit -1
    fi
H
Hui Zhang 已提交
18 19
fi

Y
yangyaming 已提交
20
# install python dependencies
21
if [ -f "requirements.txt" ]; then
H
Hui Zhang 已提交
22
    pip3 install -r requirements.txt
Y
yangyaming 已提交
23 24
fi
if [ $? != 0 ]; then
25
    error_msg "Install python dependencies failed !!!"
Y
yangyaming 已提交
26 27 28
    exit 1
fi

29
# install package libsndfile
H
Hui Zhang 已提交
30
python3 -c "import soundfile"
Y
yangyaming 已提交
31
if [ $? != 0 ]; then
32
    info_msg "Install package libsndfile into default system path."
L
Luo Tao 已提交
33
    wget "http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.28.tar.gz"
L
Luo Tao 已提交
34
    if [ $? != 0 ]; then
35
        error_msg "Download libsndfile-1.0.28.tar.gz failed !!!"
L
Luo Tao 已提交
36 37 38 39
        exit 1
    fi
    tar -zxvf libsndfile-1.0.28.tar.gz
    cd libsndfile-1.0.28
40
    ./configure > /dev/null && make > /dev/null && make install > /dev/null
L
Luo Tao 已提交
41 42 43
    cd ..
    rm -rf libsndfile-1.0.28
    rm libsndfile-1.0.28.tar.gz
Y
yangyaming 已提交
44
fi
Y
yangyaming 已提交
45

Y
Yibing Liu 已提交
46
# install decoders
H
Hui Zhang 已提交
47
python3 -c "import pkg_resources; pkg_resources.require(\"swig_decoders==1.1\")"
Y
Yibing Liu 已提交
48
if [ $? != 0 ]; then
H
Hui Zhang 已提交
49
    cd deepspeech/decoders/swig > /dev/null
Y
Yibing Liu 已提交
50
    sh setup.sh
Y
Yibing Liu 已提交
51
    cd - > /dev/null
Y
Yibing Liu 已提交
52
fi
53 54 55 56 57
python3 -c "import pkg_resources; pkg_resources.require(\"swig_decoders==1.1\")"
if [ $? != 0 ]; then
   error_msg "Please check why decoder install error!"
   exit -1
fi
Y
Yibing Liu 已提交
58

59

H
Hui Zhang 已提交
60 61 62
# install third_party
pushd third_party
bash install.sh
63
if [ $? != 0 ]; then
H
Hui Zhang 已提交
64
   error_msg "Please check why third_party install error!"
65 66 67 68
   exit -1
fi
popd

69
info_msg "Install all dependencies successfully."