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
#install auto-log
47
python -c "import auto_log"
48 49
if [ $? != 0 ]; then
    info_msg "Install auto_log into default system path"
50
    test -d AutoLog || git clone https://github.com/LDOUBLEV/AutoLog
51 52 53 54 55
    if [ $? != 0 ]; then
        error_msg "Download auto_log failed !!!"
        exit 1
    fi
    cd AutoLog
56 57
    pip install -r requirements.txt
    python setup.py install 
58 59 60 61
    cd ..
    rm -rf AutoLog
fi 

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

75

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

85

86
info_msg "Install all dependencies successfully."