forked from tvheadend/tvheadend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.ffmpeg
250 lines (210 loc) · 7.15 KB
/
Makefile.ffmpeg
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
#
# Static Audio/Video libs (ffmpeg version) build
# Copyright (C) 2014 Jaroslav Kysela
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
include $(dir $(lastword $(MAKEFILE_LIST))).config.mk
unexport CFLAGS
unexport LDFLAGS
define DOWNLOAD
@mkdir -p $(LIBAVDIR)/build
if test -z "$${TVHEADEND_FILE_CACHE}"; then \
wget --no-verbose -O $(2) $(1); \
else \
file=$$(basename $(2)); \
cp "$$TVHEADEND_FILE_CACHE/$$(file)" $(2); \
fi
@{ \
sum=$$(sha1sum $(2) | cut -d ' ' -f 1); \
printf "SHA1SUM test '$${sum}' == '$(3)': "; \
test "y$${sum}" = "y$(3)"; \
}
@echo "OK"
endef
define UNTAR
tar x -C $(LIBAVDIR) -$(2)f $(LIBAVDIR)/$(1)
endef
LIBAVDIR = $(ROOTDIR)/libav_static
export PATH := $(LIBAVDIR)/build/ffmpeg/bin:$(PATH)
ECFLAGS = -I$(LIBAVDIR)/build/ffmpeg/include
ELIBS = -L$(LIBAVDIR)/build/ffmpeg/lib -ldl
CONFIGURE = PKG_CONFIG=/tmp/nobin/pkg-config ./configure
FFMPEG = ffmpeg-2.4.2
FFMPEG_TB = $(FFMPEG).tar.bz2
FFMPEG_URL = http://ffmpeg.org/releases/$(FFMPEG_TB)
FFMPEG_SHA1 = 8fedc6f235d8510f716bca1784faa8cbe5d9cf78
EXTLIBS = libx264 libvorbis libvpx
COMPONENTS = avutil avformat avcodec swresample swscale avresample
DECODERS = mpeg2video mp2 ac3 eac3 h264 h264_vdpau aac aac_latm vorbis libvorbis
ENCODERS = mpeg2video mp2 libx264 libvpx_vp8 libvpx_vp9 aac libaacplus vorbis libvorbis
MUXERS = mpegts mpeg2dvd matroska webm
BSFS = h264_mp4toannexb
LIBOGG = libogg-1.3.2
LIBOGG_TB = $(LIBOGG).tar.gz
LIBOGG_URL = http://downloads.xiph.org/releases/ogg/$(LIBOGG_TB)
LIBOGG_SHA1 = df7f3977bbeda67306bc2a427257dd7375319d7d
LIBVORBIS = libvorbis-1.3.4
LIBVORBIS_TB = $(LIBVORBIS).tar.gz
LIBVORBIS_URL = http://downloads.xiph.org/releases/vorbis/$(LIBVORBIS_TB)
LIBVORBIS_SHA1 = 1602716c187593ffe4302124535240cec2079df3
LIBX264 = x264-snapshot-20141012-2245
LIBX264_TB = $(LIBX264).tar.bz2
LIBX264_URL = ftp://ftp.videolan.org/pub/x264/snapshots/$(LIBX264_TB)
LIBX264_SHA1 = 392cd6b0e723192e009d731fe44db01b55c97fba
LIBVPX = libvpx-v1.3.0
LIBVPX_TB = $(LIBVPX).tar.bz2
LIBVPX_URL = https://webm.googlecode.com/files/$(LIBVPX_TB)
LIBVPX_SHA1 = 191b95817aede8c136cc3f3745fb1b8c50e6d5dc
YASM = yasm-1.3.0
YASM_TB = $(YASM).tar.gz
YASM_URL = http://www.tortall.net/projects/yasm/releases/$(YASM_TB)
YASM_SHA1 = b7574e9f0826bedef975d64d3825f75fbaeef55e
.PHONY: build
build: $(LIBAVDIR)/$(FFMPEG)/.tvh_build
#
# YASM
#
$(LIBAVDIR)/$(YASM)/.tvh_download:
$(call DOWNLOAD,$(YASM_URL),$(LIBAVDIR)/$(YASM_TB),$(YASM_SHA1))
$(call UNTAR,$(YASM_TB),z)
@touch $@
$(LIBAVDIR)/$(YASM)/.tvh_build: \
$(LIBAVDIR)/$(YASM)/.tvh_download
cd $(LIBAVDIR)/$(YASM) && $(CONFIGURE) \
--prefix=/ffmpeg
DESTDIR=$(LIBAVDIR)/build \
make -C $(LIBAVDIR)/$(YASM) install
@touch $@
#
# libogg & libvorbis
#
$(LIBAVDIR)/$(LIBOGG)/.tvh_download:
$(call DOWNLOAD,$(LIBOGG_URL),$(LIBAVDIR)/$(LIBOGG_TB),$(LIBOGG_SHA1))
$(call UNTAR,$(LIBOGG_TB),z)
@touch $@
$(LIBAVDIR)/$(LIBOGG)/.tvh_build: \
$(LIBAVDIR)/$(YASM)/.tvh_build \
$(LIBAVDIR)/$(LIBOGG)/.tvh_download
cd $(LIBAVDIR)/$(LIBOGG) && $(CONFIGURE) \
--prefix=/ffmpeg \
--enable-static \
--disable-shared
DESTDIR=$(LIBAVDIR)/build \
make -C $(LIBAVDIR)/$(LIBOGG) install
@touch $@
$(LIBAVDIR)/$(LIBVORBIS)/.tvh_download: \
$(LIBAVDIR)/$(LIBOGG)/.tvh_download
$(call DOWNLOAD,$(LIBVORBIS_URL),$(LIBAVDIR)/$(LIBVORBIS_TB),$(LIBVORBIS_SHA1))
$(call UNTAR,$(LIBVORBIS_TB),z)
@touch $@
$(LIBAVDIR)/$(LIBVORBIS)/.tvh_build: \
$(LIBAVDIR)/$(LIBVORBIS)/.tvh_download \
$(LIBAVDIR)/$(YASM)/.tvh_build \
$(LIBAVDIR)/$(LIBOGG)/.tvh_build
cd $(LIBAVDIR)/$(LIBVORBIS) && $(CONFIGURE) \
--prefix=/ffmpeg \
--enable-static \
--disable-shared \
--with-ogg=$(LIBAVDIR)/build/ffmpeg
DESTDIR=$(LIBAVDIR)/build \
make -C $(LIBAVDIR)/$(LIBVORBIS) install
@touch $@
#
# libx264
#
ARCH = $(shell $(CC) -dumpmachine | cut -d '-' -f 1)
ifneq (,$(filter i386 i486 i586 i686 pentium,$(ARCH)))
$(LIBAVDIR)/$(LIBX264)/.tvh_download:
@echo "***** PLEASE FIX !!!! libx264 build for i386 *****"
@mkdir -p $(LIBAVDIR)/$(LIBX264)
@touch $@
$(LIBAVDIR)/$(LIBX264)/.tvh_build: $(LIBAVDIR)/$(LIBX264)/.tvh_download
@touch $@
else
$(LIBAVDIR)/$(LIBX264)/.tvh_download:
$(call DOWNLOAD,$(LIBX264_URL),$(LIBAVDIR)/$(LIBX264_TB),$(LIBX264_SHA1))
#rm -rf $(LIBAVDIR)/x264-snapshot-*
$(call UNTAR,$(LIBX264_TB),j)
#{ ln -sf $$(basename $(LIBAVDIR)/x264-snapshot-*) $(LIBAVDIR)/$(LIBX264); }
@touch $@
$(LIBAVDIR)/$(LIBX264)/.tvh_build: \
$(LIBAVDIR)/$(LIBX264)/.tvh_download \
$(LIBAVDIR)/$(YASM)/.tvh_build
cd $(LIBAVDIR)/$(LIBX264) && $(CONFIGURE) \
--prefix=/ffmpeg \
--enable-static \
--disable-shared \
--disable-avs \
--disable-swscale \
--disable-lavf \
--disable-ffms \
--disable-gpac \
--disable-lsmash
DESTDIR=$(LIBAVDIR)/build \
make -C $(LIBAVDIR)/$(LIBX264) install
@touch $@
endif
#
# libvpx (VP8)
#
$(LIBAVDIR)/$(LIBVPX)/.tvh_download:
@mkdir -p $(LIBAVDIR)
$(call DOWNLOAD,$(LIBVPX_URL),$(LIBAVDIR)/$(LIBVPX_TB),$(LIBVPX_SHA1))
$(call UNTAR,$(LIBVPX_TB),j)
@touch $@
$(LIBAVDIR)/$(LIBVPX)/.tvh_build: \
$(LIBAVDIR)/$(LIBVPX)/.tvh_download \
$(LIBAVDIR)/$(YASM)/.tvh_build
cd $(LIBAVDIR)/$(LIBVPX) && $(CONFIGURE) \
--prefix=/ffmpeg \
--enable-static \
--disable-shared
DIST_DIR=$(LIBAVDIR)/build/ffmpeg \
make -C $(LIBAVDIR)/$(LIBVPX) install
@touch $@
#
# FFMPEG
#
$(LIBAVDIR)/$(FFMPEG)/.tvh_download:
@mkdir -p $(LIBAVDIR)/build
$(call DOWNLOAD,$(FFMPEG_URL),$(LIBAVDIR)/$(FFMPEG_TB),$(FFMPEG_SHA1))
$(call UNTAR,$(FFMPEG_TB),j)
@touch $@
$(LIBAVDIR)/$(FFMPEG)/.tvh_build: \
$(LIBAVDIR)/$(YASM)/.tvh_build \
$(LIBAVDIR)/$(LIBVORBIS)/.tvh_build \
$(LIBAVDIR)/$(LIBX264)/.tvh_build \
$(LIBAVDIR)/$(LIBVPX)/.tvh_build \
$(LIBAVDIR)/$(FFMPEG)/.tvh_download
cd $(LIBAVDIR)/$(FFMPEG) && $(CONFIGURE) \
--prefix=/ffmpeg \
--disable-all \
--enable-static \
--disable-shared \
--enable-gpl \
--extra-cflags="$(ECFLAGS)" \
--extra-libs="$(ELIBS)" \
$(foreach extlib,$(EXTLIBS),--enable-$(extlib)) \
$(foreach component,$(COMPONENTS),--enable-$(component)) \
$(foreach decoder,$(DECODERS),--enable-decoder=$(decoder)) \
$(foreach encoder,$(ENCODERS),--enable-encoder=$(encoder)) \
$(foreach muxer,$(MUXERS),--enable-muxer=$(muxer)) \
$(foreach bsf,$(BSFS),--enable-bsf=$(bsf))
DESTDIR=$(LIBAVDIR)/build \
make -C $(LIBAVDIR)/$(FFMPEG) install
@touch $@
.PHONY: static_libav_clean
static_libav_clean:
@rm -rf $(LIBAVDIR)