rules.mak 2.86 KB
Newer Older
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
1
2
# FFmpeg

Rafaël Carré's avatar
Rafaël Carré committed
3
4
FFMPEG_SNAPURL := http://git.videolan.org/?p=ffmpeg.git;a=snapshot;h=HEAD;sf=tgz
#FFMPEG_SNAPURL := http://git.libav.org/?p=libav.git;a=snapshot;h=HEAD;sf=tgz
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
5

6
7
FFMPEGCONF = \
	--cc="$(CC)" \
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
8
9
	--disable-doc \
	--disable-decoder=libvpx \
10
	--enable-libgsm \
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
11
	--enable-libvpx \
12
	--enable-libopenjpeg \
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
13
14
15
16
17
18
19
	--disable-debug \
	--enable-gpl \
	--enable-postproc \
	--disable-ffprobe \
	--disable-ffserver \
	--disable-ffmpeg \
	--disable-ffplay \
20
	--disable-avconv \
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
21
22
23
24
	--disable-devices \
	--disable-protocols \
	--disable-avfilter \
	--disable-network
25
DEPS_ffmpeg = zlib gsm vpx $(DEPS_vpx) openjpeg
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
26
27
28

# Optional dependencies
ifdef BUILD_ENCODERS
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
29
30
FFMPEGCONF += --enable-libmp3lame
DEPS_ffmpeg += lame $(DEPS_lame)
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
31
32
33
34
35
36
37
else
FFMPEGCONF += --disable-encoders --disable-muxers
# XXX: REVISIT --enable-small ?
endif

# XXX: REVISIT
#ifndef HAVE_FPU
38
#FFMPEGCONF += --disable-mpegaudio-hp
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
39
40
#endif

41
42
43
44
ifdef HAVE_CROSS_COMPILE
FFMPEGCONF += --enable-cross-compile --cross-prefix=$(HOST)-
endif

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# ARM stuff
ifeq ($(ARCH),arm)
FFMPEGCONF += --disable-runtime-cpudetect
endif

# Darwin
ifdef HAVE_DARWIN_OS
FFMPEGCONF += --arch=$(ARCH) --target-os=darwin
FFMPEG_CFLAGS += -DHAVE_LRINTF
endif
ifdef HAVE_MACOSX
ifneq ($(findstring $(ARCH),i386 x86_64),)
FFMPEGCONF += --enable-memalign-hack
endif
ifeq ($(ARCH),x86_64)
FFMPEGCONF += --cpu=core2
endif
endif

# Linux
ifdef HAVE_LINUX
FFMPEGCONF += --target-os=linux --enable-pic
endif

# Windows
ifdef HAVE_WIN32
71
DEPS_ffmpeg += directx
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
72
73
74
FFMPEGCONF += --target-os=mingw32 --enable-memalign-hack
FFMPEGCONF += --enable-w32threads \
	--disable-bzlib --disable-bsfs \
75
76
	--disable-decoder=dca --disable-encoder=vorbis \
	--enable-dxva2
77

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
ifdef HAVE_WIN64
FFMPEGCONF += --cpu=athlon64 --arch=x86_64
else # !WIN64
FFMPEGCONF+= --cpu=i686 --arch=x86
endif
else
FFMPEGCONF += --enable-pthreads
endif

ifdef HAVE_WINCE
FFMPEGCONF += --target-os=mingw32ce --arch=armv4l --cpu=armv4t \
	--disable-decoder=snow --disable-decoder=vc9 \
	--disable-decoder=wmv3 --disable-decoder=vorbis \
	--disable-decoder=dvdsub --disable-decoder=dvbsub
endif

FFMPEG_CFLAGS += --std=gnu99

# Build

98
PKGS += ffmpeg
99
100
101
ifeq ($(call need_pkg,"libavcodec libavformat libswscale"),)
PKGS_FOUND += ffmpeg
endif
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
102

Rafaël Carré's avatar
Rafaël Carré committed
103
104
$(TARBALLS)/ffmpeg-git.tar.gz:
	$(call download,$(FFMPEG_SNAPURL))
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
105

Rafaël Carré's avatar
Rafaël Carré committed
106
FFMPEG_VERSION := git
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
107
108
109
110
111
112

.sum-ffmpeg: $(TARBALLS)/ffmpeg-$(FFMPEG_VERSION).tar.gz
	$(warning Not implemented.)
	touch $@

ffmpeg: ffmpeg-$(FFMPEG_VERSION).tar.gz .sum-ffmpeg
113
114
	rm -Rf $@ $@-git
	mkdir -p $@-git
115
	$(ZCAT) "$<" | (cd $@-git && tar xv --strip-components=1)
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
116
117
118
ifdef HAVE_WIN32
	sed -i "s/std=c99/std=gnu99/" $@-$(FFMPEG_VERSION)/configure
endif
119
	$(APPLY) $(SRC)/ffmpeg/vda.patch
120
	$(MOVE)
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
121
122
123
124
125
126
127
128

.ffmpeg: ffmpeg
	cd $< && $(HOSTVARS) ./configure \
		--extra-cflags="$(FFMPEG_CFLAGS) -DHAVE_STDINT_H"  \
		--extra-ldflags="$(LDFLAGS)" $(FFMPEGCONF) \
		--prefix="$(PREFIX)" --enable-static --disable-shared
	cd $< && $(MAKE) install-libs install-headers
	touch $@