]> git.sesse.net Git - vlc/blob - contrib/src/ffmpeg/rules.mak
Contribs: update LAME to 3.99.5 because of a .4 regression
[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=libvpx \
10         --disable-decoder=bink \
11         --enable-libgsm \
12         --enable-libopenjpeg \
13         --disable-debug \
14         --enable-gpl \
15         --disable-avdevice \
16         --disable-devices \
17         --disable-avfilter \
18         --disable-filters
19
20 # Those tools are named differently in FFmpeg and Libav
21 #       --disable-ffserver \
22 #       --disable-ffplay \
23 #       --disable-ffprobe
24 DEPS_ffmpeg = zlib gsm openjpeg
25
26 # Optional dependencies
27 ifdef BUILD_ENCODERS
28 FFMPEGCONF += --enable-libmp3lame --enable-libvpx
29 DEPS_ffmpeg += lame $(DEPS_lame) vpx $(DEPS_vpx)
30 else
31 FFMPEGCONF += --disable-encoders --disable-muxers
32 endif
33
34 ifdef ENABLE_SMALL
35 FFMPEGCONF += --enable-small --optflags=-O2
36 endif
37
38 # XXX: REVISIT
39 #ifndef HAVE_FPU
40 #FFMPEGCONF += --disable-mpegaudio-hp
41 #endif
42
43 ifdef HAVE_CROSS_COMPILE
44 FFMPEGCONF += --enable-cross-compile --cross-prefix=$(HOST)-
45 endif
46
47 # ARM stuff
48 ifeq ($(ARCH),arm)
49 FFMPEGCONF += --disable-runtime-cpudetect --arch=arm
50 ifdef HAVE_NEON
51 FFMPEGCONF += --cpu=cortex-a8 --enable-neon
52 FFMPEG_CFLAGS +=-mfloat-abi=softfp -mfpu=neon
53 endif
54 endif
55
56 # Darwin
57 ifdef HAVE_DARWIN_OS
58 FFMPEGCONF += --arch=$(ARCH) --target-os=darwin
59 FFMPEG_CFLAGS += -DHAVE_LRINTF
60 endif
61 ifdef HAVE_MACOSX
62 ifneq ($(findstring $(ARCH),i386 x86_64),)
63 FFMPEGCONF += --enable-memalign-hack
64 endif
65 ifeq ($(ARCH),x86_64)
66 FFMPEGCONF += --cpu=core2
67 endif
68 endif
69
70 # Linux
71 ifdef HAVE_LINUX
72 FFMPEGCONF += --target-os=linux --enable-pic
73 endif
74
75 # Windows
76 ifdef HAVE_WIN32
77 ifndef HAVE_MINGW_W64
78 DEPS_ffmpeg += directx
79 endif
80 FFMPEGCONF += --target-os=mingw32 --enable-memalign-hack
81 FFMPEGCONF += --enable-w32threads \
82         --disable-bzlib --disable-bsfs \
83         --disable-decoder=dca --disable-encoder=vorbis \
84         --enable-dxva2
85
86 ifdef HAVE_WIN64
87 FFMPEGCONF += --cpu=athlon64 --arch=x86_64
88 else # !WIN64
89 FFMPEGCONF+= --cpu=i686 --arch=x86
90 endif
91 else
92 FFMPEGCONF += --enable-pthreads
93 endif
94
95 ifdef HAVE_WINCE
96 FFMPEGCONF += --target-os=mingw32ce --arch=armv4l --cpu=armv4t \
97         --disable-decoder=snow --disable-decoder=vc9 \
98         --disable-decoder=wmv3 --disable-decoder=vorbis \
99         --disable-decoder=dvdsub --disable-decoder=dvbsub
100 endif
101
102 FFMPEG_CFLAGS += --std=gnu99
103
104 # Build
105
106 PKGS += ffmpeg
107 ifeq ($(call need_pkg,"libavcodec libavformat libswscale"),)
108 PKGS_FOUND += ffmpeg
109 endif
110
111 $(TARBALLS)/ffmpeg-git.tar.gz:
112         $(call download,$(FFMPEG_SNAPURL))
113
114 FFMPEG_VERSION := git
115
116 .sum-ffmpeg: $(TARBALLS)/ffmpeg-$(FFMPEG_VERSION).tar.gz
117         $(warning Not implemented.)
118         touch $@
119
120 ffmpeg: ffmpeg-$(FFMPEG_VERSION).tar.gz .sum-ffmpeg
121         rm -Rf $@ $@-git
122         mkdir -p $@-git
123         $(ZCAT) "$<" | (cd $@-git && tar xv --strip-components=1)
124 ifdef HAVE_WIN32
125         sed -i "s/std=c99/std=gnu99/" $@-$(FFMPEG_VERSION)/configure
126 endif
127         $(MOVE)
128
129 .ffmpeg: ffmpeg
130         cd $< && $(HOSTVARS) ./configure \
131                 --extra-cflags="$(FFMPEG_CFLAGS) -DHAVE_STDINT_H"  \
132                 --extra-ldflags="$(LDFLAGS)" $(FFMPEGCONF) \
133                 --prefix="$(PREFIX)" --enable-static --disable-shared
134         cd $< && $(MAKE) install-libs install-headers
135         touch $@