1
- #! /bin/sh
1
+ #! /bin/bash
2
2
3
- # http ://www. github.com/markus-perl
4
- # Version 0.2
3
+ # https ://github.com/markus-perl/ffmpeg-build-script
4
+ # Version 0.3
5
5
6
6
CWD=` pwd`
7
7
PACKAGES=" $CWD /packages"
@@ -24,13 +24,12 @@ remove_dir () {
24
24
if [ -d $1 ]; then
25
25
rm -r " $1 "
26
26
fi
27
-
28
27
}
29
28
30
29
download () {
31
30
if [ ! -f " $PACKAGES /$2 " ]; then
32
31
33
- printf " Downloading $1 "
32
+ echo " Downloading $1 "
34
33
curl -L --silent -o " $PACKAGES /$2 " " $1 "
35
34
EXITCODE=$?
36
35
if [ $EXITCODE -ne 0 ]; then
@@ -39,7 +38,7 @@ download () {
39
38
exit 1
40
39
fi
41
40
42
- printf " ... Done\n "
41
+ echo " ... Done"
43
42
44
43
if ! tar -xvf " $PACKAGES /$2 " -C " $PACKAGES " 2> /dev/null > /dev/null; then
45
44
echo " Failed to extract $2 " ;
@@ -59,7 +58,6 @@ execute () {
59
58
echo " Failed to Execute $@ " >&2
60
59
exit 1
61
60
fi
62
-
63
61
}
64
62
65
63
build () {
@@ -73,16 +71,21 @@ build () {
73
71
return 1
74
72
fi
75
73
76
-
77
-
78
74
return 0
79
75
}
80
76
81
- build_done () {
82
- touch " $PACKAGES /$1 .done"
77
+ command_exists () {
78
+ if ! [ -x " $( command -v $1 ) " ]; then
79
+ return 1
80
+ fi
81
+
82
+ return 0
83
83
}
84
84
85
85
86
+ build_done () {
87
+ touch " $PACKAGES /$1 .done"
88
+ }
86
89
87
90
case " $1 " in
88
91
" --cleanup" )
@@ -103,14 +106,21 @@ case "$1" in
103
106
;;
104
107
esac
105
108
106
-
107
-
108
109
make_dir $PACKAGES
109
110
make_dir $WORKSPACE
110
111
make_dir $CMPL
111
112
112
113
export PATH=${WORKSPACE} /bin:$PATH
113
114
115
+ if ! command_exists " make" ; then
116
+ echo " make not installed." ;
117
+ exit 1
118
+ fi
119
+
120
+ if ! command_exists " g++" ; then
121
+ echo " g++ not installed." ;
122
+ exit 1
123
+ fi
114
124
115
125
if build " yasm" ; then
116
126
download " http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz" " yasm-1.3.0.tar.gz"
@@ -121,7 +131,6 @@ if build "yasm"; then
121
131
build_done " yasm"
122
132
fi
123
133
124
-
125
134
if build " opencore" ; then
126
135
download " http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fopencore-amr%2Ffiles%2Fopencore-amr%2F&ts=1442256558&use_mirror=netassist" " opencore-amr-0.1.3.tar.gz"
127
136
cd $PACKAGES /opencore-amr-0.1.3
@@ -132,8 +141,8 @@ if build "opencore"; then
132
141
fi
133
142
134
143
if build " libvpx" ; then
135
- download " http ://storage.googleapis. com/downloads. webmproject.org/releases/webm/libvpx-1.4 .0.tar.bz2 " " libvpx-1.4 .0.tar.bz2 "
136
- cd $PACKAGES /libvpx*
144
+ download " https ://github. com/webmproject/libvpx/archive/v1.5 .0.tar.gz " " libvpx-1.5 .0.tar.gz "
145
+ cd $PACKAGES /libvpx*
137
146
sed -e ' s/cp -p/cp/' -i build/make/Makefile
138
147
execute ./configure --prefix=${WORKSPACE} --disable-unit-tests --disable-shared
139
148
execute make -j 4
@@ -165,7 +174,6 @@ if build "xvidcore"; then
165
174
build_done " xvidcore"
166
175
fi
167
176
168
-
169
177
if build " x264" ; then
170
178
download " ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2" " last_x264.tar.bz2"
171
179
cd $PACKAGES /x264-snapshot-*
@@ -185,10 +193,9 @@ if build "libogg"; then
185
193
build_done " libogg"
186
194
fi
187
195
188
-
189
196
if build " libvorbis" ; then
190
- download " http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4 .tar.gz" " libvorbis-1.3.4 .tar.gz"
191
- cd $PACKAGES /libvorbis-1.3.4
197
+ download " http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5 .tar.gz" " libvorbis-1.3.5 .tar.gz"
198
+ cd $PACKAGES /libvorbis-1.3.5
192
199
execute ./configure --prefix=${WORKSPACE} --with-ogg-libraries=${WORKSPACE} /lib --with-ogg-includes=${WORKSPACE} /include/ --enable-static --disable-shared --disable-oggtest
193
200
execute make -j 4
194
201
execute make install
@@ -208,16 +215,16 @@ if build "libtheora"; then
208
215
fi
209
216
210
217
if build " pkg-config" ; then
211
- download " http://pkgconfig.freedesktop.org/releases/pkg-config-0.28. tar.gz" " pkg-config-0.28 .tar.gz"
212
- cd $PACKAGES /pkg-config-0.28
218
+ download " http://pkgconfig.freedesktop.org/releases/pkg-config-0.29.1. tar.gz" " pkg-config-0.29.1 .tar.gz"
219
+ cd $PACKAGES /pkg-config-0.29.1
213
220
execute ./configure --silent --prefix=${WORKSPACE} --with-pc-path=${WORKSPACE} /lib/pkgconfig --with-internal-glib
214
221
execute make -j 4
215
222
execute make install
216
223
build_done " pkg-config"
217
224
fi
218
225
219
226
if build " cmake" ; then
220
- download " http ://www. cmake.org/files/v3.0 /cmake-3.0.2. tar.gz" " cmake-3.0.2 .tar.gz"
227
+ download " https ://cmake.org/files/v3.5 /cmake-3.5.0. tar.gz" " cmake-3.5.0 .tar.gz"
221
228
cd $PACKAGES /cmake*
222
229
rm Modules/FindJava.cmake
223
230
perl -p -i -e " s/get_filename_component.JNIPATH/#get_filename_component(JNIPATH/g" Tests/CMakeLists.txt
@@ -238,7 +245,7 @@ if build "vid_stab"; then
238
245
fi
239
246
240
247
if build " x265" ; then
241
- download " https://bitbucket.org/multicoreware/x265/downloads/x265_1.9.tar.gz" " x265-1.7 .tar.gz"
248
+ download " https://bitbucket.org/multicoreware/x265/downloads/x265_1.9.tar.gz" " x265-1.9 .tar.gz"
242
249
cd $PACKAGES /x265_1.9
243
250
cd source
244
251
execute cmake -DCMAKE_INSTALL_PREFIX:PATH=${WORKSPACE} -DENABLE_SHARED:bool=off .
@@ -250,8 +257,7 @@ if build "x265"; then
250
257
fi
251
258
252
259
if build " fdk_aac" ; then
253
- # download "http://downloads.sourceforge.net/project/opencore-amr/fdk-aac/fdk-aac-0.1.3.tar.gz" "fdk-aac-0.1.3.tar.gz"
254
- download " http://ftp.cc.uoc.gr/mirrors/linux/lfs/LFS/7.6/f/fdk-aac-0.1.3.tar.gz" " fdk-aac-0.1.3.tar.gz"
260
+ download " http://downloads.sourceforge.net/project/opencore-amr/fdk-aac/fdk-aac-0.1.4.tar.gz?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fopencore-amr%2Ffiles%2Ffdk-aac%2F&ts=1457561564&use_mirror=kent" " fdk-aac-0.1.4.tar.gz"
255
261
256
262
cd $PACKAGES /fdk-aac*
257
263
execute ./configure --prefix=${WORKSPACE} --disable-shared --enable-static
@@ -269,15 +275,20 @@ execute ./configure --arch=64 --prefix=${WORKSPACE} --extra-cflags="-I$WORKSPAC
269
275
execute make -j 4
270
276
execute make install
271
277
278
+ INSTALL_FOLDER=" /usr/bin"
279
+ if [[ " $OSTYPE " == " darwin" * ]]; then
280
+ INSTALL_FOLDER=" /usr/local/bin"
281
+ fi
282
+
272
283
echo " "
273
284
echo " Building done. The binary can be found here: $WORKSPACE /bin/ffmpeg"
274
285
echo " "
275
- read -r -p " Install the binary to your /usr/bin/ folder? [Y/n] " response
286
+ read -r -p " Install the binary to your $INSTALL_FOLDER folder? [Y/n] " response
276
287
277
288
case $response in
278
289
[yY][eE][sS]|[yY])
279
- sudo cp " $WORKSPACE /bin/ffmpeg" " /usr/bin /ffmpeg"
280
- sudo cp " $WORKSPACE /bin/ffprobe" " /usr/bin /ffprobe"
290
+ sudo cp " $WORKSPACE /bin/ffmpeg" " $INSTALL_FOLDER /ffmpeg"
291
+ sudo cp " $WORKSPACE /bin/ffprobe" " $INSTALL_FOLDER /ffprobe"
281
292
echo " Done. ffmpeg is now installed to your system"
282
293
;;
283
294
esac
0 commit comments