contrib: ffmpeg: Use -mincoming-stack-boundary=4
[vlc.git] / contrib / src / ffmpeg / rules.mak
blob032c4a167ccd1a15ce0e66eda96270de6251c235
1 # FFmpeg
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
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 --disable-avdevice \
15 --disable-devices \
16 --disable-avfilter \
17 --disable-filters
19 # Those tools are named differently in FFmpeg and Libav
20 # --disable-ffserver \
21 # --disable-ffplay \
22 # --disable-ffprobe
23 DEPS_ffmpeg = zlib gsm openjpeg
25 # Optional dependencies
26 ifdef BUILD_ENCODERS
27 FFMPEGCONF += --enable-libmp3lame --enable-libvpx
28 DEPS_ffmpeg += lame $(DEPS_lame) vpx $(DEPS_vpx)
29 else
30 FFMPEGCONF += --disable-encoders --disable-muxers
31 endif
33 ifdef ENABLE_SMALL
34 FFMPEGCONF += --enable-small --optflags=-O2
35 ifeq ($(ARCH),arm)
36 ifdef HAVE_NEON
37 # XXX: assumes CPU >= cortex-a8, and thus thumb2 able
38 FFMPEGCONF += --enable-thumb
39 endif
40 endif
41 endif
43 # XXX: REVISIT
44 #ifndef HAVE_FPU
45 #FFMPEGCONF += --disable-mpegaudio-hp
46 #endif
48 ifdef HAVE_CROSS_COMPILE
49 FFMPEGCONF += --enable-cross-compile
50 ifndef HAVE_IOS
51 FFMPEGCONF += --cross-prefix=$(HOST)-
52 endif
53 endif
55 # ARM stuff
56 ifeq ($(ARCH),arm)
57 FFMPEGCONF += --disable-runtime-cpudetect --arch=arm
58 ifdef HAVE_NEON
59 FFMPEGCONF += --cpu=cortex-a8 --enable-neon
60 FFMPEG_CFLAGS +=-mfloat-abi=softfp -mfpu=neon
61 endif
62 endif
64 # x86 stuff
65 ifeq ($(ARCH),i386)
66 FFMPEGCONF += --arch=x86
67 endif
69 # Darwin
70 ifdef HAVE_DARWIN_OS
71 FFMPEGCONF += --arch=$(ARCH) --target-os=darwin
72 FFMPEG_CFLAGS += -DHAVE_LRINTF
73 ifneq ($(findstring $(ARCH),i386 x86_64),)
74 FFMPEGCONF += --enable-memalign-hack
75 endif
76 ifeq ($(ARCH),x86_64)
77 FFMPEGCONF += --cpu=core2
78 endif
79 endif
80 ifdef HAVE_IOS
81 FFMPEGCONF += --enable-pic --as="$(AS)" --disable-decoder=snow
82 ifeq ($(ARCH), arm)
83 FFMPEGCONF += --cpu=cortex-a8
84 endif
85 endif
87 # Linux
88 ifdef HAVE_LINUX
89 FFMPEGCONF += --target-os=linux --enable-pic
91 ifeq ($(ANDROID_ABI), x86)
92 ifdef HAVE_ANDROID
93 # Android-x86 gcc doesn't guarantee an aligned stack, but this is
94 # handled by __attribute__((force_align_arg_pointer)) in libavcodec
95 # already, so we tell gcc to assume this alignment, so we don't need
96 # to waste a precious register in assembly functions to realign it.
97 FFMPEG_CFLAGS += -mincoming-stack-boundary=4
98 endif # HAVE_ANDROID
99 endif # x86
101 endif
103 # Windows
104 ifdef HAVE_WIN32
105 ifndef HAVE_MINGW_W64
106 DEPS_ffmpeg += directx
107 endif
108 FFMPEGCONF += --target-os=mingw32 --enable-memalign-hack
109 FFMPEGCONF += --enable-w32threads \
110 --disable-bzlib --disable-bsfs \
111 --disable-decoder=dca --disable-encoder=vorbis \
112 --enable-dxva2
114 ifdef HAVE_WIN64
115 FFMPEGCONF += --cpu=athlon64 --arch=x86_64
116 else # !WIN64
117 FFMPEGCONF+= --cpu=i686 --arch=x86
118 endif
119 else
120 FFMPEGCONF += --enable-pthreads
121 endif
123 ifdef HAVE_WINCE
124 FFMPEGCONF += --target-os=mingw32ce --arch=armv4l --cpu=armv4t \
125 --disable-decoder=snow --disable-decoder=vc9 \
126 --disable-decoder=wmv3 --disable-decoder=vorbis \
127 --disable-decoder=dvdsub --disable-decoder=dvbsub
128 endif
130 FFMPEG_CFLAGS += --std=gnu99
132 # Build
134 PKGS += ffmpeg
135 ifeq ($(call need_pkg,"libavcodec >= 52.25.0 libavformat >= 52.30.0 libswscale"),)
136 PKGS_FOUND += ffmpeg
137 endif
139 $(TARBALLS)/ffmpeg-git.tar.gz:
140 $(call download,$(FFMPEG_SNAPURL))
142 FFMPEG_VERSION := git
144 .sum-ffmpeg: $(TARBALLS)/ffmpeg-$(FFMPEG_VERSION).tar.gz
145 $(warning Not implemented.)
146 touch $@
148 ffmpeg: ffmpeg-$(FFMPEG_VERSION).tar.gz .sum-ffmpeg
149 rm -Rf $@ $@-git
150 mkdir -p $@-git
151 $(ZCAT) "$<" | (cd $@-git && tar xv --strip-components=1)
152 ifdef HAVE_WIN32
153 sed -i "s/std=c99/std=gnu99/" $@-$(FFMPEG_VERSION)/configure
154 endif
155 $(MOVE)
157 .ffmpeg: ffmpeg
158 cd $< && $(HOSTVARS) ./configure \
159 --extra-cflags="$(FFMPEG_CFLAGS) -DHAVE_STDINT_H" \
160 --extra-ldflags="$(LDFLAGS)" $(FFMPEGCONF) \
161 --prefix="$(PREFIX)" --enable-static --disable-shared
162 cd $< && $(MAKE) install-libs install-headers
163 touch $@