rules.mak 3.02 KB
Newer Older
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
1
2
3
4
5
6
7
# FFmpeg

FFMPEG_VERSION=0.4.8
FFMPEG_URL=$(SF)/ffmpeg/ffmpeg-$(FFMPEG_VERSION).tar.gz
FFMPEG_SVN=svn://svn.ffmpeg.org/ffmpeg/trunk
FFMPEG_SVN_REV=26400

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

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

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

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

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# 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
63
DEPS_ffmpeg += yasm $(DEPS_yasm)
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
64
65
66
67
68
69
70
71
72
73
74
75
76
endif

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

# Windows
ifdef HAVE_WIN32
FFMPEGCONF += --target-os=mingw32 --enable-memalign-hack
FFMPEGCONF += --enable-w32threads \
	--disable-bzlib --disable-bsfs \
	--disable-decoder=dca --disable-encoder=vorbis
77

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
78
79
ifdef HAVE_WIN64
FFMPEGCONF += --disable-dxva2
80

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
81
82
83
FFMPEGCONF += --cpu=athlon64 --arch=x86_64
else # !WIN64
FFMPEGCONF += --enable-dxva2
84
DEPS_ffmpeg += directx
85

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

103
PKGS += ffmpeg
104
105
106
ifeq ($(call need_pkg,"libavcodec libavformat libswscale"),)
PKGS_FOUND += ffmpeg
endif
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
107
108
109
110
111
112
113

ffmpeg-$(FFMPEG_VERSION).tar.gz:
	$(error FFmpeg snapshot is too old, VCS must be used!)
	$(call download,$(FFMPEG_URL))

$(TARBALLS)/ffmpeg-svn.tar.gz:
	$(SVN) export $(FFMPEG_SVN) ffmpeg-svn
114
	tar cvz ffmpeg-svn > $@
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
115
116
117
118
119
120
121
122
123
124

FFMPEG_VERSION := svn

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

ffmpeg: ffmpeg-$(FFMPEG_VERSION).tar.gz .sum-ffmpeg
	$(UNPACK)
ifdef HAVE_WIN64
125
	$(APPLY) $(SRC)/ffmpeg/ffmpeg-win64.patch
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
126
127
128
129
endif
ifdef HAVE_WIN32
	sed -i "s/std=c99/std=gnu99/" $@-$(FFMPEG_VERSION)/configure
endif
130
131
	$(APPLY) $(SRC)/ffmpeg/libavformat-ape.c.patch
	$(MOVE)
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
132
133
134
135
136
137
138
139

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