This repository has been archived by the owner on Oct 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
test-ffmpeg
executable file
·199 lines (174 loc) · 6.54 KB
/
test-ffmpeg
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#!/bin/bash
set -e
resultsdir="$(pwd)/results"
ffmpegurl='http://ffmpeg.org/releases/ffmpeg-3.0.2.tar.bz2'
ffmpegfile='ffmpeg-3.0.2.tar.bz2'
inputfileurl='http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_480p_stereo.avi'
localdir='ffmpeg-3.0.2'
pathdir="$(pwd)/.env/lib/hardening-wrapper/bin"
JOBS=$(nproc||echo 1)
if [ ! -f "$ffmpegfile" ]
then
echo -e "Downloading ffmpeg source files..."
curl -O "$ffmpegurl"
else
echo -e "ffmpeg already downloaded. Continuing..."
fi
if [ ! -d "$localdir" ]
then
tar -xvf "$ffmpegfile"
else
echo -e "ffmpeg alreday extracted. Continuing..."
fi
if [ ! -d "$pathdir" ]
then
echo -e "ERROR: pathdir does not exist, try 'make setup'"
exit 1
fi
cd "$localdir"
CONFIGURE_OPTIONS="--prefix='/usr'
--disable-debug
--disable-static
--disable-stripping
--enable-avisynth
--enable-avresample
--enable-fontconfig
--enable-gnutls
--enable-gpl
--enable-ladspa
--enable-libass
--enable-libbluray
--enable-libdcadec
--enable-libfreetype
--enable-libfribidi
--enable-libgsm
--enable-libiec61883
--enable-libmodplug
--enable-libmp3lame
--enable-libopencore_amrnb
--enable-libopencore_amrwb
--enable-libopenjpeg
--enable-libopus
--enable-libpulse
--enable-libschroedinger
--enable-libsoxr
--enable-libspeex
--enable-libssh
--enable-libtheora
--enable-libv4l2
--enable-libvidstab
--enable-libvorbis
--enable-libvpx
--enable-libwebp
--enable-libx264
--enable-libx265
--enable-libxvid
--enable-netcdf
--enable-shared
--enable-version3
--enable-x11grab"
curl -o input.avi "$inputfileurl"
if [ -z "$1" ] || [ "1" == "$1" ]; then
echo -e "Compiling with -fstack-protector-strong and partial relro"
LDFLAGS='-Wl,-O1,--sort-common,--as-needed,-z,relro' \
CFLAGS='-fstack-protector-strong -pipe -O2' \
CXXFLAGS='-fstack-protector-strong -pipe -O2' \
CPPFLAGS='-D_FORTIFY_SOURCE=2' \
./configure ${CONFIGURE_OPTIONS}
make clean
make -j${JOBS}
echo -e "Compilation finished, running test 1"
./ffmpeg -benchmark -i input.avi -f null - |& tee "$resultsdir"/ffmpeg-test1-`date +%Y-%m-%d.%H:%M:%S`
echo -e "Test 1 completed."
fi
if [ -z "$1" ] || [ "2" == "$1" ]; then
echo -e "Compiling with -fstack-protector-strong, partial relro, and -fstack-check"
LDFLAGS='-Wl,-O1,--sort-common,--as-needed,-z,relro' \
CFLAGS='-fstack-protector-strong -fstack-check -pipe -O2' \
CXXFLAGS='-fstack-protector-strong -fstack-check -pipe -O2' \
CPPFLAGS='-D_FORTIFY_SOURCE=2' \
./configure ${CONFIGURE_OPTIONS}
make clean
make -j${JOBS}
echo -e "Compilation finished, running test 2"
./ffmpeg -benchmark -i input.avi -f null - |& tee "$resultsdir"/ffmpeg-test2-`date +%Y-%m-%d.%H:%M:%S`
echo -e "Test 2 completed."
fi
if [ -z "$1" ] || [ "3" == "$1" ]; then
echo -e "Compiling with -fstack-protector-strong, partial relro, and PIE"
LDFLAGS='-Wl,-O1,--sort-common,--as-needed,-z,relro' \
CFLAGS='-fstack-protector-strong -pipe -O2 -fno-stack-check' \
CXXFLAGS='-fstack-protector-strong -pipe -O2 -fno-stack-check' \
CPPFLAGS='-D_FORTIFY_SOURCE=2' \
./configure ${CONFIGURE_OPTIONS}
make clean
PATH="${pathdir}:${PATH}" HARDENING_BINDNOW=0 make -j${JOBS}
echo -e "Compilation finished, running test 3"
./ffmpeg -benchmark -i input.avi -f null - |& tee "$resultsdir"/ffmpeg-test3-`date +%Y-%m-%d.%H:%M:%S`
echo -e "Test 3 completed."
fi
if [ -z "$1" ] || [ "4" == "$1" ]; then
echo -e "Compiling with -fstack-protector-strong, partial relro, PIE, and -fstack-check"
LDFLAGS='-Wl,-O1,--sort-common,--as-needed,-z,relro' \
CFLAGS='-fstack-protector-strong -fstack-check -pipe -O2' \
CXXFLAGS='-fstack-protector-strong -fstack-check -pipe -O2' \
CPPFLAGS='-D_FORTIFY_SOURCE=2' \
./configure ${CONFIGURE_OPTIONS}
make clean
PATH="${pathdir}:${PATH}" HARDENING_BINDNOW=0 make -j${JOBS}
echo -e "Compilation finished, running test 4"
./ffmpeg -benchmark -i input.avi -f null - |& tee "$resultsdir"/ffmpeg-test4-`date +%Y-%m-%d.%H:%M:%S`
echo -e "Test 4 completed."
fi
if [ -z "$1" ] || [ "5" == "$1" ]; then
echo -e "Compiling with -fstack-protector-strong, full relro, PIE"
LDFLAGS='-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' \
CFLAGS='-fstack-protector-strong -pipe -O2 -fno-stack-check' \
CXXFLAGS='-fstack-protector-strong -pipe -O2 -fno-stack-check' \
CPPFLAGS='-D_FORTIFY_SOURCE=2' \
./configure ${CONFIGURE_OPTIONS}
make clean
PATH="${pathdir}:${PATH}" make -j${JOBS}
echo -e "Compilation finished, running test 5"
./ffmpeg -benchmark -i input.avi -f null - |& tee "$resultsdir"/ffmpeg-test5-`date +%Y-%m-%d.%H:%M:%S`
echo -e "Test 5 completed."
fi
if [ -z "$1" ] || [ "6" == "$1" ]; then
echo -e "Compiling with -fstack-protector-strong, full relro, PIE, -fstack-check"
LDFLAGS='-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' \
CFLAGS='-fstack-protector-strong -fstack-check -pipe -O2' \
CXXFLAGS='-fstack-protector-strong -fstack-check -pipe -O2' \
CPPFLAGS='-D_FORTIFY_SOURCE=2' \
./configure ${CONFIGURE_OPTIONS}
make clean
PATH="${pathdir}:${PATH}" make -j${JOBS}
echo -e "Compilation finished, running test 6"
./ffmpeg -benchmark -i input.avi -f null - |& tee "$resultsdir"/ffmpeg-test6-`date +%Y-%m-%d.%H:%M:%S`
echo -e "Test 6 completed."
fi
if [ -z "$1" ] || [ "7" == "$1" ]; then
echo -e "Compiling with -fstack-protector-strong, full relro, PIE, -fno-plt"
LDFLAGS='-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' \
CFLAGS='-fstack-protector-strong -fno-plt -pipe -O2 -fno-stack-check' \
CXXFLAGS='-fstack-protector-strong -fno-plt -pipe -O2 -fno-stack-check' \
CPPFLAGS='-D_FORTIFY_SOURCE=2' \
./configure ${CONFIGURE_OPTIONS}
make clean
PATH="${pathdir}:${PATH}" make -j${JOBS}
echo -e "Compilation finished, running test 7"
./ffmpeg -benchmark -i input.avi -f null - |& tee "$resultsdir"/ffmpeg-test7-`date +%Y-%m-%d.%H:%M:%S`
echo -e "Test 7 completed."
fi
if [ -z "$1" ] || [ "8" == "$1" ]; then
echo -e "Compiling with -fstack-protector-strong, full relro, PIE, -fno-plt, and -fstack-check"
LDFLAGS='-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' \
CFLAGS='-fstack-protector-strong -fno-plt -fstack-check -pipe -O2' \
CXXFLAGS='-fstack-protector-strong -fno-plt -fstack-check -pipe -O2' \
CPPFLAGS='-D_FORTIFY_SOURCE=2' \
./configure ${CONFIGURE_OPTIONS}
make clean
PATH="${pathdir}:${PATH}" make -j${JOBS}
echo -e "Compilation finished, running test 8"
./ffmpeg -benchmark -i input.avi -f null - |& tee "$resultsdir"/ffmpeg-test8-`date +%Y-%m-%d.%H:%M:%S`
echo -e "Test 8 completed."
fi