macosx: FIXME for ModuleListConfigControl's resetValues
[vlc.git] / 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 ifeq ($(ARCH),arm)
37 ifdef HAVE_NEON
38 # XXX: assumes CPU >= cortex-a8, and thus thumb2 able
39 FFMPEGCONF += --enable-thumb
40 endif
41 endif
42 endif
43
44 # XXX: REVISIT
45 #ifndef HAVE_FPU
46 #FFMPEGCONF += --disable-mpegaudio-hp
47 #endif
48
49 ifdef HAVE_CROSS_COMPILE
50 FFMPEGCONF += --enable-cross-compile
51 ifndef HAVE_IOS
52 FFMPEGCONF += --cross-prefix=$(HOST)-
53 endif
54 endif
55
56 # ARM stuff
57 ifeq ($(ARCH),arm)
58 FFMPEGCONF += --disable-runtime-cpudetect --arch=arm
59 ifdef HAVE_NEON
60 FFMPEGCONF += --cpu=cortex-a8 --enable-neon
61 FFMPEG_CFLAGS +=-mfloat-abi=softfp -mfpu=neon
62 endif
63 endif
64
65 # Darwin
66 ifdef HAVE_DARWIN_OS
67 FFMPEGCONF += --arch=$(ARCH) --target-os=darwin
68 FFMPEG_CFLAGS += -DHAVE_LRINTF
69 ifneq ($(findstring $(ARCH),i386 x86_64),)
70 FFMPEGCONF += --enable-memalign-hack
71 endif
72 ifeq ($(ARCH),x86_64)
73 FFMPEGCONF += --cpu=core2
74 endif
75 endif
76 ifdef HAVE_IOS
77 FFMPEGCONF += --enable-pic --as="$(AS)" --disable-decoder=snow
78 ifeq ($(ARCH), arm)
79 FFMPEGCONF += --cpu=cortex-a8
80 endif
81 endif
82
83 # Linux
84 ifdef HAVE_LINUX
85 FFMPEGCONF += --target-os=linux --enable-pic
86 endif
87
88 # Windows
89 ifdef HAVE_WIN32
90 ifndef HAVE_MINGW_W64
91 DEPS_ffmpeg += directx
92 endif
93 FFMPEGCONF += --target-os=mingw32 --enable-memalign-hack
94 FFMPEGCONF += --enable-w32threads \
95         --disable-bzlib --disable-bsfs \
96         --disable-decoder=dca --disable-encoder=vorbis \
97         --enable-dxva2
98
99 ifdef HAVE_WIN64
100 FFMPEGCONF += --cpu=athlon64 --arch=x86_64
101 else # !WIN64
102 FFMPEGCONF+= --cpu=i686 --arch=x86
103 endif
104 else
105 FFMPEGCONF += --enable-pthreads
106 endif
107
108 ifdef HAVE_WINCE
109 FFMPEGCONF += --target-os=mingw32ce --arch=armv4l --cpu=armv4t \
110         --disable-decoder=snow --disable-decoder=vc9 \
111         --disable-decoder=wmv3 --disable-decoder=vorbis \
112         --disable-decoder=dvdsub --disable-decoder=dvbsub
113 endif
114
115 FFMPEG_CFLAGS += --std=gnu99
116
117 # Build
118
119 PKGS += ffmpeg
120 ifeq ($(call need_pkg,"libavcodec >= 52.25.0 libavformat >= 52.30.0 libswscale"),)
121 PKGS_FOUND += ffmpeg
122 endif
123
124 $(TARBALLS)/ffmpeg-git.tar.gz:
125         $(call download,$(FFMPEG_SNAPURL))
126
127 FFMPEG_VERSION := git
128
129 .sum-ffmpeg: $(TARBALLS)/ffmpeg-$(FFMPEG_VERSION).tar.gz
130         $(warning Not implemented.)
131         touch $@
132
133 ffmpeg: ffmpeg-$(FFMPEG_VERSION).tar.gz .sum-ffmpeg
134         rm -Rf $@ $@-git
135         mkdir -p $@-git
136         $(ZCAT) "$<" | (cd $@-git && tar xv --strip-components=1)
137 ifdef HAVE_WIN32
138         sed -i "s/std=c99/std=gnu99/" $@-$(FFMPEG_VERSION)/configure
139 endif
140         $(MOVE)
141
142 .ffmpeg: ffmpeg
143         cd $< && $(HOSTVARS) ./configure \
144                 --extra-cflags="$(FFMPEG_CFLAGS) -DHAVE_STDINT_H"  \
145                 --extra-ldflags="$(LDFLAGS)" $(FFMPEGCONF) \
146                 --prefix="$(PREFIX)" --enable-static --disable-shared
147         cd $< && $(MAKE) install-libs install-headers
148         touch $@