setup.sh 2.2 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

46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
#install auto-log
python3 -c "import auto_log"
if [ $? != 0 ]; then
    info_msg "Install auto_log into default system path"
    git clone https://github.com/LDOUBLEV/AutoLog
    if [ $? != 0 ]; then
        error_msg "Download auto_log failed !!!"
        exit 1
    fi
    cd AutoLog
    pip3 install -r requirements.txt
    python3 setup.py bdist_wheel
    pip3 install ./dist/[Aa]uto*.whl
    cd ..
    rm -rf AutoLog
fi 

Y
Yibing Liu 已提交
63
# install decoders
H
Hui Zhang 已提交
64
python3 -c "import pkg_resources; pkg_resources.require(\"swig_decoders==1.1\")"
Y
Yibing Liu 已提交
65
if [ $? != 0 ]; then
H
Hui Zhang 已提交
66
    cd deepspeech/decoders/swig > /dev/null
Y
Yibing Liu 已提交
67
    sh setup.sh
Y
Yibing Liu 已提交
68
    cd - > /dev/null
Y
Yibing Liu 已提交
69
fi
70 71 72 73 74
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 已提交
75

76

H
Hui Zhang 已提交
77 78 79
# install third_party
pushd third_party
bash install.sh
80
if [ $? != 0 ]; then
H
Hui Zhang 已提交
81
   error_msg "Please check why third_party install error!"
82 83 84 85
   exit -1
fi
popd

86

87
info_msg "Install all dependencies successfully."