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