Mercurial > vanilla
comparison multimedia/ffmpeg/ffmpeg.sh @ 746:2f3982164f57
multimedia/ffmpeg: initial import, closes #1256
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 07 Aug 2019 20:10:00 +0200 |
parents | |
children | e91fbcb3d1ef |
comparison
equal
deleted
inserted
replaced
745:59a2fa6992bc | 746:2f3982164f57 |
---|---|
1 #!/bin/sh | |
2 # | |
3 # Copyright (c) 2019 David Demelier <markand@malikania.fr> | |
4 # | |
5 # Permission to use, copy, modify, and/or distribute this software for any | |
6 # purpose with or without fee is hereby granted, provided that the above | |
7 # copyright notice and this permission notice appear in all copies. | |
8 # | |
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
16 # | |
17 | |
18 # TODO: add the following options once the dependencies are available: | |
19 # | |
20 # OPENAL | |
21 # CHROMAPRINT | |
22 # FREI0R | |
23 # LADSPA | |
24 # AOM | |
25 # CACA | |
26 # CELT | |
27 # CDIO | |
28 # AAC (libfdk-aac) | |
29 # FLITE | |
30 # GME | |
31 # GSM | |
32 # MODPLUG | |
33 # OPENCV | |
34 # H264 | |
35 # JPEG (openjpeg) | |
36 # SAMBA | |
37 # SNAPPY | |
38 # SOX | |
39 # TENSORFLOW | |
40 # MP2 | |
41 # V4L | |
42 # VPX | |
43 # WAVPACK | |
44 # X264 | |
45 # SDL2 | |
46 | |
47 PKGNAME=ffmpeg | |
48 PKGVERSION=4.2 | |
49 PKGREVISION=1 | |
50 PKGLICENSE="LGPLv21+" | |
51 PKGSUMMARY="cross-platform solution to convert audio and video" | |
52 PKGDOWNLOAD="https://ffmpeg.org/releases/$PKGNAME-4.2.tar.bz2" | |
53 PKGDEPENDS="" | |
54 PKGOPTIONS="ALSA | |
55 BLURAY | |
56 BZIP2 | |
57 CRYPTO | |
58 FONTCONFIG | |
59 FREETYPE | |
60 FRIBIDI | |
61 GMP | |
62 JACK | |
63 LZMA | |
64 MP3 | |
65 OPENGL | |
66 OPUS | |
67 PULSEAUDIO | |
68 SPEEX | |
69 SSH | |
70 SSL | |
71 SVG | |
72 THEORA | |
73 VORBIS | |
74 WEBP | |
75 X | |
76 X265 | |
77 XML | |
78 ZLIB" | |
79 | |
80 : ${ALSA:=yes} | |
81 : ${BLURAY:=no} | |
82 : ${BZIP2:=yes} | |
83 : ${CRYPTO:=no} | |
84 : ${FONTCONFIG:=no} | |
85 : ${FREETYPE:=no} | |
86 : ${FRIBIDI:=no} | |
87 : ${GMP:=no} | |
88 : ${JACK:=no} | |
89 : ${LZMA:=yes} | |
90 : ${MP3:=yes} | |
91 : ${OPENGL:=no} | |
92 : ${OPUS:=no} | |
93 : ${PULSEAUDIO:=no} | |
94 : ${SPEEX:=no} | |
95 : ${SSH:=no} | |
96 : ${SSL:=no} | |
97 : ${SVG:=no} | |
98 : ${THEORA:=no} | |
99 : ${VORBIS:=no} | |
100 : ${WEBP:=no} | |
101 : ${X265:=no} | |
102 : ${X:=no} | |
103 : ${XML:=no} | |
104 : ${ZLIB:=no} | |
105 | |
106 if [ "$ALSA" = "yes" ]; then | |
107 PKGDEPENDS="audio/alsa-lib $PKGDEPENDS" | |
108 with_alsa="--enable-alsa" | |
109 else | |
110 with_alsa="--disable-alsa" | |
111 fi | |
112 | |
113 if [ "$BLURAY" = "yes" ]; then | |
114 PKGDEPENDS="multimedia/libbluray $PKGDEPENDS" | |
115 with_bluray="--enable-libbluray" | |
116 else | |
117 with_bluray="--disable-libbluray" | |
118 fi | |
119 | |
120 if [ "$BZIP2" = "yes" ]; then | |
121 PKGDEPENDS="compression/bzip2 $PKGDEPENDS" | |
122 with_bzip2="--enable-bzlib" | |
123 else | |
124 with_bzip2="--disable-bzlib" | |
125 fi | |
126 | |
127 if [ "$CRYPTO" = "yes" ]; then | |
128 PKGDEPENDS="crypto/libgcrypt $PKGDEPENDS" | |
129 with_crypto="--enable-gcrypt" | |
130 else | |
131 with_crypto="--disable-gcrypt" | |
132 fi | |
133 | |
134 if [ "$FONTCONFIG" = "yes" ]; then | |
135 PKGDEPENDS="fonts/fontconfig $PKGDEPENDS" | |
136 with_fontconfig="--enable-fontconfig" | |
137 else | |
138 with_fontconfig="--disable-fontconfig" | |
139 fi | |
140 | |
141 if [ "$FREETYPE" = "yes" ]; then | |
142 PKGDEPENDS="fonts/freetype $PKGDEPENDS" | |
143 with_freetype="--enable-libfreetype" | |
144 else | |
145 with_freetype="--disable-libfreetype" | |
146 fi | |
147 | |
148 if [ "$FRIBIDI" = "yes" ]; then | |
149 PKGDEPENDS="fonts/fribidi $PKGDEPENDS" | |
150 with_fribidi="--enable-libfribidi" | |
151 else | |
152 with_fribidi="--disable-libfribidi" | |
153 fi | |
154 | |
155 if [ "$GMP" = "yes" ]; then | |
156 PKGDEPENDS="lib/gmp $PKGDEPENDS" | |
157 with_gmp="--enable-gmp" | |
158 else | |
159 with_gmp="--disable-gmp" | |
160 fi | |
161 | |
162 if [ "$JACK" = "yes" ]; then | |
163 PKGDEPENDS="audio/jack $PKGDEPENDS" | |
164 with_jack="--enable-libjack" | |
165 else | |
166 with_jack="--disable-libjack" | |
167 fi | |
168 | |
169 if [ "$LZMA" = "yes" ]; then | |
170 PKGDEPENDS="compression/xz $PKGDEPENDS" | |
171 with_lzma="--enable-lzma" | |
172 else | |
173 with_lzma="--disable-lzma" | |
174 fi | |
175 | |
176 if [ "$MP3" = "yes" ]; then | |
177 PKGDEPENDS="audio/lame $PKGDEPENDS" | |
178 with_mp3="--enable-libmp3lame" | |
179 else | |
180 with_mp3="--disable-libmp3lame" | |
181 fi | |
182 | |
183 if [ "$OPENGL" = "yes" ]; then | |
184 PKGDEPENDS="graphics/mesa $PKGDEPENDS" | |
185 with_opengl="--enable-opengl" | |
186 else | |
187 with_opengl="--disable-opengl" | |
188 fi | |
189 | |
190 if [ "$OPUS" = "yes" ]; then | |
191 PKGDEPENDS="audio/opus $PKGDEPENDS" | |
192 with_opus="--enable-libopus" | |
193 else | |
194 with_opus="--disable-libopus" | |
195 fi | |
196 | |
197 if [ "$PULSEAUDIO" = "yes" ]; then | |
198 PKGDEPENDS="audio/pulseaudio $PKGDEPENDS" | |
199 with_pulseaudio="--enable-libpulse" | |
200 else | |
201 with_pulseaudio="--disable-libpulse" | |
202 fi | |
203 | |
204 if [ "$SPEEX" = "yes" ]; then | |
205 PKGDEPENDS="audio/speex $PKGDEPENDS" | |
206 with_speex="--enable-libspeex" | |
207 else | |
208 with_speex="--disable-libspeex" | |
209 fi | |
210 | |
211 if [ "$SSH" = "yes" ]; then | |
212 PKGDEPENDS="network/libssh $PKGDEPENDS" | |
213 with_ssh="--enable-libssh" | |
214 else | |
215 with_ssh="--disable-libssh" | |
216 fi | |
217 | |
218 if [ "$SSL" = "yes" ] || [ "$SSL" = "libressl" ]; then | |
219 PKGDEPENDS="crypto/libressl $PKGDEPENDS" | |
220 with_ssl="--enable-libtls" | |
221 elif [ "$SSL" = "gnutls" ]; then | |
222 PKGDEPENDS="crypto/gnutls $PKGDEPENDS" | |
223 with_ssl="--enable-gnutls" | |
224 else | |
225 with_ssl="--disable-gnutls --disable-libtls --disable-openssl --disable-mbedtls" | |
226 fi | |
227 | |
228 if [ "$SVG" = "yes" ]; then | |
229 PKGDEPENDS="graphics/librsvg $PKGDEPENDS" | |
230 with_svg="--enable-librsvg" | |
231 else | |
232 with_svg="--disable-librsvg" | |
233 fi | |
234 | |
235 if [ "$THEORA" = "yes" ]; then | |
236 PKGDEPENDS="multimedia/libtheora $PKGDEPENDS" | |
237 with_theora="--enable-libtheora" | |
238 else | |
239 with_theora="--disable-libtheora" | |
240 fi | |
241 | |
242 if [ "$VORBIS" = "yes" ]; then | |
243 PKGDEPENDS="audio/libvorbis $PKGDEPENDS" | |
244 with_vorbis="--enable-libvorbis" | |
245 else | |
246 with_vorbis="--disable-libvorbis" | |
247 fi | |
248 | |
249 if [ "$WEBP" = "yes" ]; then | |
250 PKGDEPENDS="graphics/libwebp $PKGDEPENDS" | |
251 with_webp="--enable-libwebp" | |
252 else | |
253 with_webp="--disable-libwebp" | |
254 fi | |
255 | |
256 if [ "$X265" = "yes" ]; then | |
257 PKGDEPENDS="multimedia/x265 $PKGDEPENDS" | |
258 with_x265="--enable-libx265" | |
259 else | |
260 with_x265="--disable-libx265" | |
261 fi | |
262 | |
263 if [ "$X" = "yes" ]; then | |
264 PKGDEPENDS="x11/libx11 x11/libxcb $PKGDEPENDS" | |
265 with_x="--enable-xlib" | |
266 with_x="--enable-libxcb $with_x" | |
267 with_x="--enable-libxcb-shm $with_x" | |
268 with_x="--enable-libxcb-xfixes $with_x" | |
269 with_x="--enable-libxcb-shape $with_x" | |
270 else | |
271 with_x="--disable-xlib" | |
272 with_x="--disable-libxcb $with_x" | |
273 with_x="--disable-libxcb-shm $with_x" | |
274 with_x="--disable-libxcb-xfixes $with_x" | |
275 with_x="--disable-libxcb-shape $with_x" | |
276 fi | |
277 | |
278 if [ "$XML" = "yes" ]; then | |
279 PKGDEPENDS="text/libxml2 $PKGDEPENDS" | |
280 with_xml="--enable-libxml2" | |
281 else | |
282 with_xml="--disable-libxml2" | |
283 fi | |
284 | |
285 if [ "$ZLIB" = "yes" ]; then | |
286 PKGDEPENDS="compression/zlib $PKGDEPENDS" | |
287 with_zlib="--enable-zlib" | |
288 else | |
289 with_zlib="--disable-zlib" | |
290 fi | |
291 | |
292 : ${CC:=clang} | |
293 : ${CFLAGS:=-O2} | |
294 : ${CXX:=clang++} | |
295 : ${CXXFLAGS:=-O2} | |
296 : ${LDFLAGS:=} | |
297 : ${LIBS:=} | |
298 | |
299 build() | |
300 { | |
301 rm -rf $PKGNAME-$PKGVERSION | |
302 tar xvf $PKGNAME-$PKGVERSION.tar.bz2 | |
303 cd $PKGNAME-$PKGVERSION | |
304 | |
305 CC="$CC" \ | |
306 CFLAGS="$CFLAGS" \ | |
307 CXX="$CXX" \ | |
308 CXXFLAGS="$CXXFLAGS" \ | |
309 LDFLAGS="$LDFLAGS" \ | |
310 LIBS="$LIBS" \ | |
311 ./configure \ | |
312 --prefix=/. \ | |
313 --enable-shared \ | |
314 $with_alsa \ | |
315 $with_bluray \ | |
316 $with_bzip2 \ | |
317 $with_crypto \ | |
318 $with_fontconfig \ | |
319 $with_freetype \ | |
320 $with_fribidi \ | |
321 $with_gmp \ | |
322 $with_jack \ | |
323 $with_lzma \ | |
324 $with_mp3 \ | |
325 $with_opengl \ | |
326 $with_opus \ | |
327 $with_pulseaudio \ | |
328 $with_speex \ | |
329 $with_ssh \ | |
330 $with_ssl \ | |
331 $with_svg \ | |
332 $with_theora \ | |
333 $with_vorbis \ | |
334 $with_webp \ | |
335 $with_x265 \ | |
336 $with_x \ | |
337 $with_xml \ | |
338 $with_zlib | |
339 make | |
340 make install DESTDIR=$DESTDIR | |
341 | |
342 cd .. | |
343 rm -rf $PKGNAME-$PKGVERSION | |
344 } |