]> git.sesse.net Git - vlc/blob - contrib/src/ffmpeg/rules.mak
contrib: use $(MAKE)
[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         --enable-libgsm \
11         --enable-libopenjpeg \
12         --disable-debug \
13         --enable-gpl \
14         --enable-postproc \
15         --disable-avconv \
16         --disable-devices \
17         --disable-avfilter
18
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
24
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 # XXX: REVISIT --enable-small ?
32 endif
33
34 # XXX: REVISIT
35 #ifndef HAVE_FPU
36 #FFMPEGCONF += --disable-mpegaudio-hp
37 #endif
38
39 ifdef HAVE_CROSS_COMPILE
40 FFMPEGCONF += --enable-cross-compile --cross-prefix=$(HOST)-
41 endif
42
43 # ARM stuff
44 ifeq ($(ARCH),arm)
45 FFMPEGCONF += --disable-runtime-cpudetect --arch=arm
46 ifdef HAVE_NEON
47 FFMPEGCONF += --cpu=cortex-a8 --enable-neon
48 FFMPEG_CFLAGS +=-mfloat-abi=softfp -mfpu=neon
49 endif
50 endif
51
52 # Darwin
53 ifdef HAVE_DARWIN_OS
54 FFMPEGCONF += --arch=$(ARCH) --target-os=darwin
55 FFMPEG_CFLAGS += -DHAVE_LRINTF
56 endif
57 ifdef HAVE_MACOSX
58 ifneq ($(findstring $(ARCH),i386 x86_64),)
59 FFMPEGCONF += --enable-memalign-hack
60 endif
61 ifeq ($(ARCH),x86_64)
62 FFMPEGCONF += --cpu=core2
63 endif
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 DEPS_ffmpeg += directx
74 FFMPEGCONF += --target-os=mingw32 --enable-memalign-hack
75 FFMPEGCONF += --enable-w32threads \
76         --disable-bzlib --disable-bsfs \
77         --disable-decoder=dca --disable-encoder=vorbis \
78         --enable-dxva2
79
80 ifdef HAVE_WIN64
81 FFMPEGCONF += --cpu=athlon64 --arch=x86_64
82 else # !WIN64
83 FFMPEGCONF+= --cpu=i686 --arch=x86
84 endif
85 else
86 FFMPEGCONF += --enable-pthreads
87 endif
88
89 ifdef HAVE_WINCE
90 FFMPEGCONF += --target-os=mingw32ce --arch=armv4l --cpu=armv4t \
91         --disable-decoder=snow --disable-decoder=vc9 \
92         --disable-decoder=wmv3 --disable-decoder=vorbis \
93         --disable-decoder=dvdsub --disable-decoder=dvbsub
94 endif
95
96 FFMPEG_CFLAGS += --std=gnu99
97
98 # Build
99
100 PKGS += ffmpeg
101 ifeq ($(call need_pkg,"libavcodec libavformat libswscale"),)
102 PKGS_FOUND += ffmpeg
103 endif
104
105 $(TARBALLS)/ffmpeg-git.tar.gz:
106         $(call download,$(FFMPEG_SNAPURL))
107
108 FFMPEG_VERSION := git
109
110 .sum-ffmpeg: $(TARBALLS)/ffmpeg-$(FFMPEG_VERSION).tar.gz
111         $(warning Not implemented.)
112         touch $@
113
114 ffmpeg: ffmpeg-$(FFMPEG_VERSION).tar.gz .sum-ffmpeg
115         rm -Rf $@ $@-git
116         mkdir -p $@-git
117         $(ZCAT) "$<" | (cd $@-git && tar xv --strip-components=1)
118 ifdef HAVE_WIN32
119         sed -i "s/std=c99/std=gnu99/" $@-$(FFMPEG_VERSION)/configure
120 endif
121         $(MOVE)
122
123 .ffmpeg: ffmpeg
124         cd $< && $(HOSTVARS) ./configure \
125                 --extra-cflags="$(FFMPEG_CFLAGS) -DHAVE_STDINT_H"  \
126                 --extra-ldflags="$(LDFLAGS)" $(FFMPEGCONF) \
127                 --prefix="$(PREFIX)" --enable-static --disable-shared
128         cd $< && $(MAKE) install-libs install-headers
129         touch $@