]> git.sesse.net Git - vlc/blob - contrib/src/ffmpeg/rules.mak
Contribs: compile Bink decoder
[vlc] / contrib / src / ffmpeg / rules.mak
1 # FFmpeg
2
3 #Uncomment the one you want
4 #USE_LIBAV ?= 1
5 #USE_FFMPEG ?= 1
6
7 ifdef USE_FFMPEG
8 HASH=HEAD
9 FFMPEG_SNAPURL := http://git.videolan.org/?p=ffmpeg.git;a=snapshot;h=$(HASH);sf=tgz
10 else
11 HASH=HEAD
12 FFMPEG_SNAPURL := http://git.libav.org/?p=libav.git;a=snapshot;h=$(HASH);sf=tgz
13 endif
14
15 FFMPEGCONF = \
16         --cc="$(CC)" \
17         --disable-doc \
18         --disable-encoder=vorbis \
19         --enable-libgsm \
20         --enable-libopenjpeg \
21         --disable-debug \
22         --disable-avdevice \
23         --disable-devices \
24         --disable-avfilter \
25         --disable-filters \
26         --disable-bsfs \
27         --disable-bzlib \
28         --disable-programs \
29         --disable-avresample
30
31 ifdef USE_FFMPEG
32 FFMPEGCONF += \
33         --disable-swresample \
34         --disable-iconv
35 endif
36
37 DEPS_ffmpeg = zlib gsm openjpeg
38
39 # Optional dependencies
40 ifndef BUILD_NETWORK
41 FFMPEGCONF += --disable-network
42 endif
43 ifdef BUILD_ENCODERS
44 FFMPEGCONF += --enable-libmp3lame --enable-libvpx --disable-decoder=libvpx --disable-decoder=libvpx_vp8 --disable-decoder=libvpx_vp9
45 DEPS_ffmpeg += lame $(DEPS_lame) vpx $(DEPS_vpx)
46 else
47 FFMPEGCONF += --disable-encoders --disable-muxers
48 endif
49
50 # Small size
51 ifdef ENABLE_SMALL
52 FFMPEGCONF += --enable-small
53 endif
54 ifeq ($(ARCH),arm)
55 ifdef HAVE_ARMV7A
56 FFMPEGCONF += --enable-thumb
57 endif
58 endif
59
60 ifdef HAVE_CROSS_COMPILE
61 FFMPEGCONF += --enable-cross-compile
62 ifndef HAVE_DARWIN_OS
63 FFMPEGCONF += --cross-prefix=$(HOST)-
64 endif
65 endif
66
67 # ARM stuff
68 ifeq ($(ARCH),arm)
69 ifndef HAVE_DARWIN_OS
70 FFMPEGCONF += --arch=arm
71 endif
72 ifdef HAVE_NEON
73 FFMPEGCONF += --enable-neon
74 endif
75 ifdef HAVE_ARMV7A
76 FFMPEGCONF += --cpu=cortex-a8
77 endif
78 ifdef HAVE_ARMV6
79 FFMPEGCONF += --cpu=armv6 --disable-neon
80 endif
81 endif
82
83 # MIPS stuff
84 ifeq ($(ARCH),mipsel)
85 FFMPEGCONF += --arch=mips
86 endif
87
88 # x86 stuff
89 ifeq ($(ARCH),i386)
90 ifndef HAVE_DARWIN_OS
91 FFMPEGCONF += --arch=x86
92 endif
93 endif
94
95 # Darwin
96 ifdef HAVE_DARWIN_OS
97 FFMPEGCONF += --arch=$(ARCH) --target-os=darwin
98 ifeq ($(ARCH),x86_64)
99 FFMPEGCONF += --cpu=core2
100 endif
101 endif
102 ifdef HAVE_IOS
103 FFMPEGCONF += --enable-pic
104 ifdef HAVE_NEON
105 FFMPEGCONF += --as="$(AS)"
106 endif
107 endif
108 ifdef HAVE_MACOSX
109 FFMPEGCONF += --enable-vda
110 endif
111
112 # Linux
113 ifdef HAVE_LINUX
114 FFMPEGCONF += --target-os=linux --enable-pic
115
116 endif
117
118 # Windows
119 ifdef HAVE_WIN32
120 ifndef HAVE_MINGW_W64
121 DEPS_ffmpeg += directx
122 endif
123 FFMPEGCONF += --target-os=mingw32 --enable-memalign-hack
124 FFMPEGCONF += --enable-w32threads --enable-dxva2 \
125         --disable-decoder=dca
126
127 ifdef HAVE_WIN64
128 FFMPEGCONF += --cpu=athlon64 --arch=x86_64
129 else # !WIN64
130 FFMPEGCONF+= --cpu=i686 --arch=x86
131 endif
132
133 else # !Windows
134 FFMPEGCONF += --enable-pthreads
135 endif
136
137 # Build
138 PKGS += ffmpeg
139 ifeq ($(call need_pkg,"libavcodec >= 54.25.0 libavformat >= 53.21.0 libswscale"),)
140 PKGS_FOUND += ffmpeg
141 endif
142
143 $(TARBALLS)/ffmpeg-$(HASH).tar.gz:
144         $(call download,$(FFMPEG_SNAPURL))
145
146 .sum-ffmpeg: $(TARBALLS)/ffmpeg-$(HASH).tar.gz
147         $(warning Not implemented.)
148         touch $@
149
150 ffmpeg: ffmpeg-$(HASH).tar.gz .sum-ffmpeg
151         rm -Rf $@ $@-$(HASH)
152         mkdir -p $@-$(HASH)
153         $(ZCAT) "$<" | (cd $@-$(HASH) && tar xv --strip-components=1)
154         $(MOVE)
155
156 .ffmpeg: ffmpeg
157         cd $< && $(HOSTVARS) ./configure \
158                 --extra-ldflags="$(LDFLAGS)" $(FFMPEGCONF) \
159                 --prefix="$(PREFIX)" --enable-static --disable-shared
160         cd $< && $(MAKE) install-libs install-headers
161         touch $@