-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_dependencies_linux.sh
executable file
·107 lines (83 loc) · 2.83 KB
/
build_dependencies_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
#!/bin/bash
export DIR=`dirname $0`
cd $DIR # Go to scripts living directory
export ABSDIR=`cd .;pwd`
echo "ABSDIR=$ABSDIR"
# If you want to debug
# export FFMPEG_EXTRA="--enable-debug=2 --disable-stripping --disable-optimizations"
# If you want to get some extra testcases running
# export FFMPEG_EXTRA="$FFMPEG_EXTRA --enable-decoder=h264 --enable-decoder=flv --enable-demuxer=flv"
# Fail on errors
set -e
# Directories
export SRC_DIR=$ABSDIR/dependencies_source
export INSTALL_DIR=$ABSDIR/dependencies
# Create target directory
mkdir -p $INSTALL_DIR # where to compile to
echo "SRC_DIR: $SRC_DIR"
echo "INSTALL_DIR: $INSTALL_DIR"
cd $SRC_DIR
mkdir -p linux
# download and install polarssl
#if [ -e $INSTALL_DIR/lib/libpolarssl.a ]; then
# echo "PolarSSL already seems to exist"
#else
echo "Compiling PolarSSL"
cd polarssl
git checkout polarssl-1.2.0
make clean
make SYS=posix DESTDIR=$INSTALL_DIR SHARED=1 CC="gcc -fPIC" lib
make SYS=posix DESTDIR=$INSTALL_DIR install
cd ../
#fi
# rtmpdump
#if [ -e $INSTALL_DIR/bin/rtmpdump ]; then
# echo "rtmpdump seems to already exist"
#else
cd rtmpdump
make clean
LIBZ="-lssl -lcrypto -ldl" make SYS=posix CRYPTO=POLARSSL prefix=$INSTALL_DIR \
XCFLAGS="-I$INSTALL_DIR/include -fPIC" XLDFLAGS=-L$INSTALL_DIR/lib install
cd ..
#fi
# libx264
if [ -e $INSTALL_DIR/bin/x264 ]; then
echo "x264 seems to already exist"
else
cd x264
./configure --enable-shared --prefix=$INSTALL_DIR --extra-ldflags="-L$INSTALL_DIR/lib" --extra-clfags="-I$INSTALL_DIR/include"
make -j2
make install
cd ..
fi
# ffmpeg
if [ -e $INSTALL_DIR/bin/ffmpeg ]; then
echo "ffmpeg seems to already exist"
else
cd ffmpeg
if [ "$(uname -m)" = "x86_64" ]; then
echo "This is an x86_64 Linux"
export ADDPIC="--enable-pic"
else
echo "This seems 32bit Linux"
export ADDPIC=""
fi
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$INSTALL_DIR/lib/pkgconfig
echo "Compiling ffmpeg"
./configure $ADDPIC --enable-shared --enable-gpl --enable-libx264 --disable-everything \
--enable-encoder=libx264 --enable-muxer=flv --enable-protocol=rtmps --enable-protocol=rtmp \
--enable-protocol=rtmpte --enable-protocol=rtmpts \
--enable-protocol=file --enable-protocol=tcp --enable-protocol=rtp --enable-librtmp \
--prefix=$INSTALL_DIR --extra-ldflags=-L$INSTALL_DIR/lib --extra-libs="-lrtmp -lpolarssl" --extra-cflags="-I$INSTALL_DIR/include" --extra-cxxflags=-I$INSTALL_DIR/include $FFMPEG_EXTRA
make -j2
make install
cd ..
fi
# gtest (just fetching, will be build via CMake)
if [ -d gtest-1.6.0 ]; then
echo "gtest seems already downloaded"
else
curl -fL http://googletest.googlecode.com/files/gtest-1.6.0.zip > gtest-1.6.0.zip
unzip gtest-1.6.0.zip
rm gtest-1.6.0.zip
fi