rules.mak 2.95 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 \
11
	--enable-libopenjpeg \
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
12
13
14
15
16
17
18
	--disable-debug \
	--enable-gpl \
	--enable-postproc \
	--disable-ffprobe \
	--disable-ffserver \
	--disable-ffmpeg \
	--disable-ffplay \
19
	--disable-avconv \
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
20
21
22
23
	--disable-devices \
	--disable-protocols \
	--disable-avfilter \
	--disable-network
24
DEPS_ffmpeg = zlib gsm openjpeg
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
25
26
27

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

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

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

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
44
45
# ARM stuff
ifeq ($(ARCH),arm)
46
47
48
49
50
FFMPEGCONF += --disable-runtime-cpudetect --arch=arm
ifdef HAVE_NEON
FFMPEGCONF += --cpu=cortex-a8 --enable-neon
FFMPEG_CFLAGS +=-mfloat-abi=softfp -mfpu=neon
endif
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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
74
DEPS_ffmpeg += directx
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
75
76
77
FFMPEGCONF += --target-os=mingw32 --enable-memalign-hack
FFMPEGCONF += --enable-w32threads \
	--disable-bzlib --disable-bsfs \
78
79
	--disable-decoder=dca --disable-encoder=vorbis \
	--enable-dxva2
80

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
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

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

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

Rafaël Carré's avatar
Rafaël Carré committed
109
FFMPEG_VERSION := git
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
110
111
112
113
114
115

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

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

.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 $@