rules.mak 3.34 KB
Newer Older
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# 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


FFMPEGCONF = --cc="$(CC)" \
	--disable-doc \
	--disable-decoder=libvpx \
	--disable-debug \
	--enable-gpl \
	--enable-postproc \
	--disable-ffprobe \
	--disable-ffserver \
	--disable-ffmpeg \
	--disable-ffplay \
	--disable-devices \
	--disable-protocols \
	--disable-avfilter \
	--disable-network

# Optional dependencies
ifdef BUILD_ENCODERS
# TODO:
#FFMPEGCONF+= --enable-libmp3lame
#.ffmpeg: .lame
else
FFMPEGCONF += --disable-encoders --disable-muxers
# XXX: REVISIT --enable-small ?
endif

ifdef HAVE_CROSS_COMPILE
FFMPEGCONF += --enable-cross-compile --cross-prefix=$(HOST)-
endif
# XXX: REVISIT: gsm and vpx not used by VLC so should in PKGS?
ifneq ($(filter gsm,$(PKGS)),)
#FFMPEGCONF+= --enable-libgsm
#.ffmpeg: .gsm
endif
ifneq ($(filter vpx,$(PKGS)),)
#FFMPEGCONF += --enable-libvpx
#.ffmpeg: .vpx
endif

# XXX: REVISIT
#ifndef HAVE_FPU
#FFMPEGCONF+= --disable-mpegaudio-hp
#endif

# ARM stuff
ifeq ($(ARCH),arm)
FFMPEGCONF += --disable-runtime-cpudetect
# TODO: define HAVE_ARM_NEON or something
ifdef HAVE_ARM_NEON
# XXX: REVISIT choice of CPU?
FFMPEGCONF += --cpu=cortex-a8 --enable-neon
endif
# TODO: --enable-iwmmxt if anyone still cares
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
.ffmpeg: .yasm
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
ifdef HAVE_WIN64
FFMPEGCONF += --disable-dxva2
FFMPEGCONF += --cpu=athlon64 --arch=x86_64
else # !WIN64
FFMPEGCONF += --enable-dxva2
.ffmpeg: .directx
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

PKGS += libav

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
	tar cv ffmpeg-svn | gzip > $@

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
	(cd $@-$(FFMPEG_VERSION)/libswscale && patch -p0) < $(SRC)/ffmpeg/ffmpeg-win64.patch
endif
ifdef HAVE_WIN32
	sed -i "s/std=c99/std=gnu99/" $@-$(FFMPEG_VERSION)/configure
endif
	(cd $@-$(FFMPEG_VERSION) && patch -p1) < $(SRC)/ffmpeg/libavformat-ape.c.patch
	mv $@-$(FFMPEG_VERSION) $@
	touch $@

.ffmpeg: ffmpeg
	# TODO: .zlib
	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 $@