-
Notifications
You must be signed in to change notification settings - Fork 7
/
build_linux.sh
executable file
·116 lines (103 loc) · 2.91 KB
/
build_linux.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/sh
# FFmpegAVS2 build script
#
# Copyright (c) 2018~ Yiqun Xu
# 2018~ Falei Luo
# 2018~ Huiwen Ren
# 2018~ VCL, NELVT, PKU
touch build.log
echo "BUILD TIME: $(date +%Y-%m-%d)" > build.log
if test -t 1 && which tput >/dev/null 2>&1; then
ncolors=$(tput colors)
if test -n "$ncolors" && test $ncolors -ge 8; then
msg_color=$(tput setaf 3)$(tput bold)
error_color=$(tput setaf 1)$(tput bold)
reset_color=$(tput sgr0)
fi
ncols=$(tput cols)
fi
checkfail()
{
echo "$error_color""ERROR: $@ failed.$reset_color"
exit 1
}
printLog()
{
echo ">>> $@" >> $build_dir/build.log
$@ >> $build_dir/build.log
}
###############################
# Sync repositories
###############################
checkGitSources()
{
echo ">>>>"
echo " -------------------------------------------------------------------------- "
echo " dir: $1 "
echo " url: $2 "
echo " -------------------------------------------------------------------------- "
if [ ! -d $1 ]; then
echo "$1 source not found, cloning"
git clone $2 $1 || checkfail "$1 source: git clone failed"
else
echo "$1 source found!"
fi
echo "synchronizing sources..."
curdir=$(pwd)
cd $1
git pull
cd $curdir
echo "success..."
}
###############################
## install pkg-config
#### for ubuntu
###############################
# sudo apt-get install pkg-config
# current dir
build_dir=`pwd`
# sync sources
checkGitSources FFmpegAVS2 https://github.com/pkuvcl/FFmpegAVS2.git
checkGitSources xavs2 https://github.com/pkuvcl/xavs2.git
checkGitSources davs2 https://github.com/pkuvcl/davs2.git
###############################
# build xavs2 encoder
###############################
echo "$msg_color[Start building xAVS2 encoder]$reset_color"
cd xavs2/build/linux # xAVS2 directory
printLog ./configure --prefix=$build_dir/avs2_lib \
--enable-pic \
--enable-shared
printLog make -j8 || checkfail "make failed"
printLog make install
cd -
###############################
# build davs2 decoder
###############################
echo "$msg_color[Start building dAVS2 decoder]$reset_color"
cd davs2/build/linux # dAVS2 directory
printLog ./configure --prefix=$build_dir/avs2_lib \
--enable-pic \
--enable-shared
printLog make -j8 || checkfail "make failed"
printLog make install
cd -
###############################
# build ffmpeg decoder
###############################
echo "$msg_color[Start building FFmpegAVS2]$reset_color"
cd FFmpegAVS2
git checkout avs2
export PKG_CONFIG_PATH=$build_dir/avs2_lib/lib/pkgconfig
printLog ./configure \
--prefix=$build_dir/avs2_lib \
--enable-gpl \
--enable-libxavs2 \
--enable-libdavs2 \
--enable-shared \
--enable-static
printLog make -j8 || checkfail "make failed"
printLog make install
# tar -czvf ./ffmpeg_lib.tar.gz ./install
cd -
echo "Everything done!"