]> git.sesse.net Git - vlc/blob - contrib/src/ffmpeg/rules.mak
contrib: robustify and fix gsm
[vlc] / contrib / src / ffmpeg / rules.mak
1 # FFmpeg
2
3 FFMPEG_VERSION=0.4.8
4 FFMPEG_URL=$(SF)/ffmpeg/ffmpeg-$(FFMPEG_VERSION).tar.gz
5 FFMPEG_SVN=svn://svn.ffmpeg.org/ffmpeg/trunk
6 FFMPEG_SVN_REV=26400
7
8 FFMPEGCONF = \
9         --cc="$(CC)" \
10         --disable-doc \
11         --disable-decoder=libvpx \
12         --enable-libgsm \
13         --disable-debug \
14         --enable-gpl \
15         --enable-postproc \
16         --disable-ffprobe \
17         --disable-ffserver \
18         --disable-ffmpeg \
19         --disable-ffplay \
20         --disable-devices \
21         --disable-protocols \
22         --disable-avfilter \
23         --disable-network
24 DEPS_ffmpeg = zlib gsm
25
26 # Optional dependencies
27 ifdef BUILD_ENCODERS
28 # TODO:
29 #FFMPEGCONF += --enable-libmp3lame
30 #DEPS_ffmpeg += lame $(DEPS_lame)
31 else
32 FFMPEGCONF += --disable-encoders --disable-muxers
33 # XXX: REVISIT --enable-small ?
34 endif
35
36 #FFMPEGCONF += --enable-libvpx
37 #DEPS_ffmpeg += vpx $(DEPS_vpx)
38
39 # XXX: REVISIT
40 #ifndef HAVE_FPU
41 #FFMPEGCONF += --disable-mpegaudio-hp
42 #endif
43
44 ifdef HAVE_CROSS_COMPILE
45 FFMPEGCONF += --enable-cross-compile --cross-prefix=$(HOST)-
46 endif
47
48 # ARM stuff
49 ifeq ($(ARCH),arm)
50 FFMPEGCONF += --disable-runtime-cpudetect
51 endif
52
53 # Darwin
54 ifdef HAVE_DARWIN_OS
55 FFMPEGCONF += --arch=$(ARCH) --target-os=darwin
56 FFMPEG_CFLAGS += -DHAVE_LRINTF
57 endif
58 ifdef HAVE_MACOSX
59 ifneq ($(findstring $(ARCH),i386 x86_64),)
60 FFMPEGCONF += --enable-memalign-hack
61 endif
62 ifeq ($(ARCH),x86_64)
63 FFMPEGCONF += --cpu=core2
64 endif
65 DEPS_ffmpeg += yasm $(DEPS_yasm)
66 endif
67
68 # Linux
69 ifdef HAVE_LINUX
70 FFMPEGCONF += --target-os=linux --enable-pic
71 endif
72
73 # Windows
74 ifdef HAVE_WIN32
75 FFMPEGCONF += --target-os=mingw32 --enable-memalign-hack
76 FFMPEGCONF += --enable-w32threads \
77         --disable-bzlib --disable-bsfs \
78         --disable-decoder=dca --disable-encoder=vorbis
79
80 ifdef HAVE_WIN64
81 FFMPEGCONF += --disable-dxva2
82
83 FFMPEGCONF += --cpu=athlon64 --arch=x86_64
84 else # !WIN64
85 FFMPEGCONF += --enable-dxva2
86 DEPS_ffmpeg += directx
87
88 FFMPEGCONF+= --cpu=i686 --arch=x86
89 endif
90 else
91 FFMPEGCONF += --enable-pthreads
92 endif
93
94 ifdef HAVE_WINCE
95 FFMPEGCONF += --target-os=mingw32ce --arch=armv4l --cpu=armv4t \
96         --disable-decoder=snow --disable-decoder=vc9 \
97         --disable-decoder=wmv3 --disable-decoder=vorbis \
98         --disable-decoder=dvdsub --disable-decoder=dvbsub
99 endif
100
101 FFMPEG_CFLAGS += --std=gnu99
102
103 # Build
104
105 PKGS += ffmpeg
106 ifeq ($(call need_pkg,"libavcodec libavformat libswscale"),)
107 PKGS_FOUND += ffmpeg
108 endif
109
110 ffmpeg-$(FFMPEG_VERSION).tar.gz:
111         $(error FFmpeg snapshot is too old, VCS must be used!)
112         $(call download,$(FFMPEG_URL))
113
114 $(TARBALLS)/ffmpeg-svn.tar.gz:
115         $(SVN) export $(FFMPEG_SVN) ffmpeg-svn
116         tar cvz ffmpeg-svn > $@
117
118 FFMPEG_VERSION := svn
119
120 .sum-ffmpeg: $(TARBALLS)/ffmpeg-$(FFMPEG_VERSION).tar.gz
121         $(warning Not implemented.)
122         touch $@
123
124 ffmpeg: ffmpeg-$(FFMPEG_VERSION).tar.gz .sum-ffmpeg
125         $(UNPACK)
126 ifdef HAVE_WIN64
127         $(APPLY) $(SRC)/ffmpeg/ffmpeg-win64.patch
128 endif
129 ifdef HAVE_WIN32
130         sed -i "s/std=c99/std=gnu99/" $@-$(FFMPEG_VERSION)/configure
131 endif
132         $(APPLY) $(SRC)/ffmpeg/libavformat-ape.c.patch
133         $(MOVE)
134
135 .ffmpeg: ffmpeg
136         cd $< && $(HOSTVARS) ./configure \
137                 --extra-cflags="$(FFMPEG_CFLAGS) -DHAVE_STDINT_H"  \
138                 --extra-ldflags="$(LDFLAGS)" $(FFMPEGCONF) \
139                 --prefix="$(PREFIX)" --enable-static --disable-shared
140         cd $< && $(MAKE) install-libs install-headers
141         touch $@