1 | #!/bin/bash |
---|
2 | |
---|
3 | ### ffmpeg ### |
---|
4 | |
---|
5 | cd ${SRC} |
---|
6 | LOG=ffmpeg-blfs.log |
---|
7 | |
---|
8 | SELF=`basename ${0}` |
---|
9 | set_buildenv |
---|
10 | set_libdirname |
---|
11 | setup_multiarch |
---|
12 | if [ ! "${libdirname}" = "lib" ]; then |
---|
13 | extra_conf="--libdir=/usr/${libdirname}" |
---|
14 | fi |
---|
15 | |
---|
16 | unpack_tarball FFMpeg-${FFMPEG_VER} |
---|
17 | cd ${PKGDIR} |
---|
18 | |
---|
19 | # Set this if you want to build a shared postproc library |
---|
20 | use_shared_pp="Y" |
---|
21 | |
---|
22 | #------------------------------------------------------------------------------- |
---|
23 | # Configure doesn't actually check if anything exists, we do it |
---|
24 | # manually here... |
---|
25 | |
---|
26 | # Do we have faad2? If so, do we also have faac? |
---|
27 | if [ -f /usr/include/faad.h -a -f /usr/${libdirname}/libfaad.a ]; then |
---|
28 | extra_conf="${extra_conf} --enable-faad" |
---|
29 | echo " - enabling faad2 support" |
---|
30 | if [ -f /usr/bin/faad ]; then |
---|
31 | extra_conf="${extra_conf} --enable-faadbin" |
---|
32 | echo " - enabling faad2bin support" |
---|
33 | fi |
---|
34 | if [ -f /usr/include/faac.h -a -f /usr/${libdirname}/libfaac.a ]; then |
---|
35 | extra_conf="${extra_conf} --enable-faac" |
---|
36 | echo " - enabling faac support" |
---|
37 | fi |
---|
38 | fi |
---|
39 | |
---|
40 | # Do we have xvid? |
---|
41 | if [ -f /usr/include/xvid.h -a -f /usr/${libdirname}/libxvidcore.a ]; then |
---|
42 | extra_conf="${extra_conf} --enable-xvid" |
---|
43 | echo " - enabling xvid support" |
---|
44 | fi |
---|
45 | |
---|
46 | # Do we have lame? |
---|
47 | if [ -f /usr/include/lame/lame.h -a -f /usr/${libdirname}/libmp3lame.a ]; then |
---|
48 | extra_conf="${extra_conf} --enable-mp3lame" |
---|
49 | echo " - enabling mp3lame support" |
---|
50 | fi |
---|
51 | |
---|
52 | # Do we have ogg? If so, check if we have vorbis and theora |
---|
53 | if [ -f /usr/include/ogg/ogg.h -a -f /usr/${libdirname}/libogg.a ]; then |
---|
54 | extra_conf="${extra_conf} --enable-libogg" |
---|
55 | echo " - enabling libogg support" |
---|
56 | |
---|
57 | # Do we have vorbis? |
---|
58 | if [ -f /usr/include/vorbis/codec.h -a -f /usr/${libdirname}/libvorbis.a ] |
---|
59 | then |
---|
60 | extra_conf="${extra_conf} --enable-vorbis" |
---|
61 | echo " - enabling vorbis support" |
---|
62 | fi |
---|
63 | # Do we have theora? |
---|
64 | if [ -f /usr/include/theora/theora.h -a -f /usr/${libdirname}/libtheora.a ] |
---|
65 | then |
---|
66 | extra_conf="${extra_conf} --enable-theora" |
---|
67 | echo " - enabling theora support" |
---|
68 | fi |
---|
69 | fi |
---|
70 | |
---|
71 | # Do we have libgsm? |
---|
72 | if [ -f /usr/include/gsm.h -a -f /usr/${libdirname}/libgsm.a ]; then |
---|
73 | extra_conf="${extra_conf} --enable-libgsm" |
---|
74 | echo " - enabling libgsm support" |
---|
75 | fi |
---|
76 | #------------------------------------------------------------------------------- |
---|
77 | |
---|
78 | # Fix configure to generate pkgconfig files which set libdir properly |
---|
79 | sed -i -e 's@^\(libdir=\)\\\${exec_prefix}/lib@\1${libdir}@g' \ |
---|
80 | configure |
---|
81 | |
---|
82 | # Fix issues with liba52 |
---|
83 | sed -i -e "s/static uint64/const uint64/" \ |
---|
84 | libavcodec/liba52/resample_mmx.c |
---|
85 | |
---|
86 | # Stop the vhook build bitching and moaning because it cant find the created |
---|
87 | # libavcodec, libavformat and (if shared pp lib built) libpostproc |
---|
88 | vhook_add_libs="-L../libavcodec -lavcodec -L../libavformat -lavformat" |
---|
89 | |
---|
90 | if [ "${use_shared_pp}" = "Y" ]; then |
---|
91 | extra_conf="${extra_conf} --enable-shared-pp" |
---|
92 | vhook_add_libs="${vhook_add_libs} -L../libavcodec/libpostproc -lpostproc" |
---|
93 | fi |
---|
94 | |
---|
95 | sed -i -e "s@\$<@\$< ${vhook_add_libs}@g" \ |
---|
96 | vhook/Makefile |
---|
97 | |
---|
98 | # Hoorah, configure checks for -m32 in CFLAGS and configures amd64 build as |
---|
99 | # a standard X86 build :-) So we define ARCH_CFLAGS in CFLAGS as well as |
---|
100 | # with CC (still need it there for shared lib creation) |
---|
101 | max_log_init ffmpeg ${FFMPEG_VER} "blfs (shared)" ${CONFLOGS} ${LOG} |
---|
102 | CFLAGS="${ARCH_CFLAGS} -pipe ${TGT_CFLAGS}" \ |
---|
103 | ./configure --prefix=/usr ${extra_conf} \ |
---|
104 | --cc="${CC-gcc} ${ARCH_CFLAGS}" \ |
---|
105 | --mandir=/usr/share/man \ |
---|
106 | --enable-gpl \ |
---|
107 | --enable-a52 \ |
---|
108 | --enable-pp \ |
---|
109 | --enable-shared \ |
---|
110 | --enable-pthreads \ |
---|
111 | >> ${LOGFILE} 2>&1 && |
---|
112 | echo " o Configure OK" && |
---|
113 | |
---|
114 | min_log_init ${BUILDLOGS} && |
---|
115 | make \ |
---|
116 | >> ${LOGFILE} 2>&1 && |
---|
117 | echo " o Build OK" && |
---|
118 | |
---|
119 | min_log_init ${INSTLOGS} && |
---|
120 | make install \ |
---|
121 | >> ${LOGFILE} 2>&1 && |
---|
122 | echo " o ALL OK" || barf |
---|
123 | |
---|