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