setup.sh 1.5 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
if [ -e /etc/lsb-release ]; then
H
Hui Zhang 已提交
12
    ${SUDO} apt-get install -y pkg-config libflac-dev libogg-dev libvorbis-dev libboost-dev swig python3-dev
13
else
H
Hui Zhang 已提交
14
    error_msg "Please using Ubuntu or install pkg-config libflac-dev libogg-dev libvorbis-dev libboost-dev swig python3-dev by user."
15
    exit -1
H
Hui Zhang 已提交
16 17
fi

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

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

Y
Yibing Liu 已提交
44
# install decoders
H
Hui Zhang 已提交
45
python3 -c "import pkg_resources; pkg_resources.require(\"swig_decoders==1.1\")"
Y
Yibing Liu 已提交
46
if [ $? != 0 ]; then
H
Hui Zhang 已提交
47
    cd deepspeech/decoders/swig > /dev/null
Y
Yibing Liu 已提交
48
    sh setup.sh
Y
Yibing Liu 已提交
49
    cd - > /dev/null
Y
Yibing Liu 已提交
50
fi
51 52 53 54 55
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 已提交
56

57
info_msg "Install all dependencies successfully."