# 更新系统
sudo dnf update --assumeno
sudo dnf clean all
sudo dnf makecache
sudo dnf install epel-release -y

# 安装必要的依赖 
sudo dnf install -y \
  libmad \
  libmad-devel \
  libid3tag \
  libid3tag-devel \
  lame-devel \
  flac \
  flac-devel \
  libvorbis \
  libvorbis-devel \
  opus \
  opus-devel \
  yasm \
  nasm


# 安装 Python 包
pip install numpy==1.24.3 -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
pip3 install pytorch-lightning==1.9.3 -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
pip3 install unidecode -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
pip3 install inflect -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
pip3 install pytest==7.3.1 -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
pip3 install expecttest -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
pip3 install parameterized -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
pip3 install scipy -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
pip3 install scikit-learn -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
pip3 install urllib3==1.26.14 -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
pip install SentencePiece -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
pip install deep-phonemizer -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
pip install librosa -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
pip install Pillow -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
pip install flashlight -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
pip install kaldi_io -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
pip install flashlight-text -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
pip install tinytag -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com

# 设置 PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

# ffmpeg ffmpeg-4.1.11 -> ffmpeg-4.4.4  --enable-libmp3lame
wget --no-check-certificate https://www.ffmpeg.org/releases/ffmpeg-4.4.4.tar.gz
tar xzf ffmpeg-4.4.4.tar.gz
cd ffmpeg-4.4.4
./configure --enable-shared --enable-libmp3lame
make -j32
sudo make install
cd -

# opencore-amr-0.1.6
wget --no-check-certificate https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-0.1.6.tar.gz
tar xzf opencore-amr-0.1.6.tar.gz
cd opencore-amr-0.1.6
./configure
make -j32
sudo make install
cd -

# libao-1.2.0
wget http://downloads.xiph.org/releases/ao/libao-1.2.0.tar.gz
tar xzf libao-1.2.0.tar.gz
cd libao-1.2.0
./configure
make -j32
sudo make install
cd -

# libogg-1.3.5
wget http://downloads.xiph.org/releases/ogg/libogg-1.3.5.tar.xz
tar xf libogg-1.3.5.tar.xz
cd libogg-1.3.5
./configure --disable-static
make -j32
sudo make install
cd -

# opus-1.4
wget --no-check-certificate http://downloads.xiph.org/releases/opus/opus-1.4.tar.gz
tar xzf opus-1.4.tar.gz
cd opus-1.4
./configure
make -j32
sudo make install
cd -

# opusfile-0.12
wget http://downloads.xiph.org/releases/opus/opusfile-0.12.tar.gz
tar xzf opusfile-0.12.tar.gz
cd opusfile-0.12
./configure
make -j32
sudo make install
cd -

# libopusenc-0.2.1
wget --no-check-certificate https://archive.mozilla.org/pub/opus/libopusenc-0.2.1.tar.gz
tar xzf libopusenc-0.2.1.tar.gz
cd libopusenc-0.2.1
./configure
make -j32
sudo make install
cd -

# opus-tools-0.2
wget https://archive.mozilla.org/pub/opus/opus-tools-0.2.tar.gz
tar xzf opus-tools-0.2.tar.gz
cd opus-tools-0.2
./configure
make -j32
sudo make install
cd -
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

# wavpack-4.80.0
wget --no-check-certificate https://www.wavpack.com/wavpack-4.80.0.tar.bz2
tar -jxf wavpack-4.80.0.tar.bz2
cd wavpack-4.80.0
./configure
make -j32
sudo make install
cd -

# sox-14.4.2
wget --no-check-certificate https://sourceforge.net/projects/sox/files/sox/14.4.2/sox-14.4.2.tar.gz
tar xzf sox-14.4.2.tar.gz
cd sox-14.4.2
./configure
make -j32
sudo make install
cd -
