Project

General

Profile

RE: Wrong 'as' invocation for libvpx ยป Makefile.ffmpeg

Example usage of ASFLAGS with --defsym - Luis Mendes, 2022-01-09 17:04

 
1
#
2
#  Static Audio/Video libs (ffmpeg version) build
3
#  Copyright (C) 2014 Jaroslav Kysela
4
#
5
#  This program is free software: you can redistribute it and/or modify
6
#  it under the terms of the GNU General Public License as published by
7
#  the Free Software Foundation, either version 3 of the License, or
8
#  (at your option) any later version.
9
#
10
#  This program is distributed in the hope that it will be useful,
11
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
#  GNU General Public License for more details.
14
#
15
#  You should have received a copy of the GNU General Public License
16
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
#
18

    
19
DIR :=  $(dir $(lastword $(MAKEFILE_LIST)))
20
include $(DIR)/.config.mk
21

    
22
ifneq (,$(filter i386 i486 i586 i686 pentium,$(ARCH)))
23
FFMPEG_HOST   := $(ARCH)-linux-gnu
24
FFMPEG_TARGET := x86-linux-gcc
25
endif
26

    
27
unexport CFLAGS
28
unexport LDFLAGS
29

    
30

    
31
# ##############################################################################
32
# Upstream Packages
33
# ##############################################################################
34

    
35
EXTLIBS        =
36
COMPONENTS     = avutil avcodec avformat swscale avresample swresample avfilter
37
PROTOCOLS      = file http https hls mmsh mmst rtmp rtmpe rtmps rtmpt rtmpte rtmpts \
38
                 ffrtmpcrypt ffrtmphttp rtp srtp tcp udp udplite unix crypto
39
DECODERS       = mpeg2video mp2 aac vorbis ac3 eac3 aac_latm opus h264 hevc theora flac
40
ENCODERS       = mpeg2video mp2 aac vorbis flac
41
MUXERS         = mpegts matroska mp4
42
DEMUXERS       = mpegts matroska hls flv live_flv
43
BSFS           = h264_mp4toannexb hevc_mp4toannexb
44
FILTERS        = yadif format hwupload hwdownload scale null aresample anull
45
HWACCELS       =
46

    
47
NASM_VER       = 2.15.05
48
NASM           = nasm-$(NASM_VER)
49
NASM_TB        = $(NASM).tar.gz
50
NASM_URL       = https://www.nasm.us/pub/nasm/releasebuilds/$(NASM_VER)/$(NASM_TB)
51
NASM_SHA1      = 8a2a60b01d563c32dd216f94a99a20e6e31fd8aa
52
NASM_DIFFS     = remove-invalid-pure_func-qualifiers.diff
53

    
54
LIBX264_VER    = d2907f67227cbf38ac957efed84c532b12ce19cc
55
LIBX264        = x264-$(LIBX264_VER)
56
LIBX264_TB     = $(LIBX264).tar.bz2
57
LIBX264_URL    = https://code.videolan.org/videolan/x264/-/archive/$(LIBX264_VER)/$(LIBX264_TB)
58
LIBX264_SHA1   = 6b69f9af34ddfb9bc0bbfedb0b41a0b8b6c2771a
59

    
60
LIBX265_VER    = 3.5
61
LIBX265        = x265_$(LIBX265_VER)
62
LIBX265_TB     = $(LIBX265).tar.gz
63
LIBX265_URL    = https://bitbucket.org/multicoreware/x265_git/downloads/$(LIBX265_TB)
64
LIBX265_SHA1   = dc8e70f441991289a9a34fd37e1649d59435bfae
65
ifeq ($(CONFIG_PIE),yes)
66
LIBX265_DIFFS  = libx265.pie.diff
67
else
68
LIBX265_DIFFS  = libx265.pic.diff
69
endif
70
LIBX265_DIFFS  += libx265-silence.patch
71

    
72
LIBVPX_VER     = 1.9.0
73
LIBVPX         = libvpx-$(LIBVPX_VER)
74
LIBVPX_TB      = $(LIBVPX).tar.gz
75
LIBVPX_URL     = https://github.com/webmproject/libvpx/archive/v$(LIBVPX_VER)/$(LIBVPX_TB)
76
LIBVPX_SHA1    = 2ab8203ad8922bdf3256e4a197d1348fa8db9a62
77

    
78
LIBOGG         = libogg-1.3.4
79
LIBOGG_TB      = $(LIBOGG).tar.gz
80
LIBOGG_URL     = https://ftp.osuosl.org/pub/xiph/releases/ogg/$(LIBOGG_TB)
81
LIBOGG_SHA1    = 851cef020b346d44893e5d1c3dab83c675d479d9
82

    
83
LIBTHEORA      = libtheora-1.2.0alpha1
84
LIBTHEORA_TB   = $(LIBTHEORA).tar.gz
85
LIBTHEORA_URL  = https://ftp.osuosl.org/pub/xiph/releases/theora/$(LIBTHEORA_TB)
86
LIBTHEORA_SHA1 = f03e6b1648b7574a249ee19cd386ff3d5c9deb84
87

    
88
LIBVORBIS      = libvorbis-1.3.7
89
LIBVORBIS_TB   = $(LIBVORBIS).tar.gz
90
LIBVORBIS_URL  = https://ftp.osuosl.org/pub/xiph/releases/vorbis/$(LIBVORBIS_TB)
91
LIBVORBIS_SHA1 = 2b415495f89b103138a23da5017a2a00837c6c94
92

    
93

    
94
LIBFDKAAC_VER  = 2.0.2
95
LIBFDKAAC      = fdk-aac-$(LIBFDKAAC_VER)
96
LIBFDKAAC_TB   = v$(LIBFDKAAC_VER).tar.gz
97
LIBFDKAAC_URL  = https://github.com/mstorsjo/fdk-aac/archive/refs/tags/$(LIBFDKAAC_TB)
98
LIBFDKAAC_SHA1 = 8d711c298d1a562f8e5bedb0ca8dc39365efe93b
99

    
100
LIBOPUS        = opus-1.3.1
101
LIBOPUS_TB     = $(LIBOPUS).tar.gz
102
LIBOPUS_URL    = https://archive.mozilla.org/pub/opus/$(LIBOPUS_TB)
103
LIBOPUS_SHA1   = ed226536537861c9f0f1ef7ca79dffc225bc181b
104

    
105
FFNVCODEC_VER  = 11.1.5.0
106
FFNVCODEC      = nv-codec-headers-$(FFNVCODEC_VER)
107
FFNVCODEC_TB   = $(FFNVCODEC).tar.gz
108
FFNVCODEC_URL  = https://github.com/FFmpeg/nv-codec-headers/releases/download/n$(FFNVCODEC_VER)/nv-codec-headers-$(FFNVCODEC_VER).tar.gz
109
FFNVCODEC_SHA1 = 89bee0d3025b813c513084ad8546b0261623fbb0
110

    
111
FFMPEG         = ffmpeg-4.4.1
112
FFMPEG_TB      = $(FFMPEG).tar.bz2
113
FFMPEG_URL     = https://ffmpeg.org/releases/$(FFMPEG_TB)
114
FFMPEG_SHA1    = 49306f284475014b8e68bff886aaeeaf0723810c
115

    
116

    
117
# ##############################################################################
118
# Library Config
119
# ##############################################################################
120

    
121
LIB_NAME  := ffmpeg
122
LIB_ROOT  := $(BUILDDIR)/$(LIB_NAME)
123
EBUILDIR  := $(LIB_ROOT)/build
124
EPREFIX0  := ffmpeg
125
EPREFIX   := $(EBUILDIR)/$(EPREFIX0)
126
LIB_FILES := \
127
		$(LIB_ROOT)/$(NASM)/.tvh_download \
128
		$(LIB_ROOT)/$(NASM)/.tvh_build \
129
		$(LIB_ROOT)/$(LIBX264)/.tvh_download \
130
		$(LIB_ROOT)/$(LIBX264)/.tvh_build \
131
		$(LIB_ROOT)/$(LIBX265)/.tvh_download \
132
		$(LIB_ROOT)/$(LIBX265)/.tvh_build \
133
		$(LIB_ROOT)/$(LIBVPX)/.tvh_download \
134
		$(LIB_ROOT)/$(LIBVPX)/.tvh_build \
135
		$(LIB_ROOT)/$(LIBTHEORA)/.tvh_download \
136
		$(LIB_ROOT)/$(LIBTHEORA)/.tvh_build \
137
		$(LIB_ROOT)/$(LIBOGG)/.tvh_download \
138
		$(LIB_ROOT)/$(LIBOGG)/.tvh_build \
139
		$(LIB_ROOT)/$(LIBVORBIS)/.tvh_download \
140
		$(LIB_ROOT)/$(LIBVORBIS)/.tvh_build \
141
		$(LIB_ROOT)/$(LIBFDKAAC)/.tvh_download \
142
		$(LIB_ROOT)/$(LIBFDKAAC)/.tvh_build \
143
		$(LIB_ROOT)/$(LIBOPUS)/.tvh_download \
144
		$(LIB_ROOT)/$(LIBOPUS)/.tvh_build \
145
		$(LIB_ROOT)/$(FFNVCODEC)/.tvh_download \
146
		$(LIB_ROOT)/$(FFNVCODEC)/.tvh_build \
147
		$(LIB_ROOT)/$(FFMPEG)/.tvh_download \
148
		$(LIB_ROOT)/$(FFMPEG)/.tvh_build \
149
		$(EPREFIX)
150

    
151
include $(DIR)/Makefile.static
152

    
153
.PHONY: build $(PHONY)
154
build: $(LIB_ROOT)/$(FFMPEG)/.tvh_build
155
	$(call LIBCACHEGET_TIMESTAMP)
156

    
157

    
158
# ##############################################################################
159
# Build Rules
160
# ##############################################################################
161

    
162
export PATH := $(LIB_ROOT)/build/ffmpeg/bin:$(PATH)
163

    
164
ifeq ($(CONFIG_PIE),yes)
165
CFLAGS_PI = -fPIE
166
else
167
CFLAGS_PI = -fPIC
168
endif
169

    
170
ECFLAGS   := -I$(EPREFIX)/include $(CFLAGS_PI)
171
ELIBS     := -L$(EPREFIX)/lib -ldl
172

    
173
AUTOGEN   := ./autogen.sh
174

    
175
CONFIGURE := FFMPEG_PREFIX=$(EPREFIX) \
176
             PKG_CONFIG=$(ROOTDIR)/support/pkg-config.ffmpeg \
177
             ./configure --prefix=/ffmpeg --enable-static --disable-shared
178
CONFIGURE_PI := CC="$(COMPILER) $(CFLAGS_PI)" $(CONFIGURE)
179
CONFIGURE_FFMPEG := $(CONFIGURE)
180

    
181
# ##############################################################################
182
# NASM
183
#
184

    
185
$(LIB_ROOT)/$(NASM)/.tvh_download:
186
	$(call DOWNLOAD,$(NASM_URL),$(LIB_ROOT)/$(NASM_TB),$(NASM_SHA1))
187
	$(call UNTAR,$(NASM_TB),z)
188
	$(call PATCH,$(NASM),$(NASM_DIFFS))
189
	@touch $@
190

    
191
$(LIB_ROOT)/$(NASM)/.tvh_build: \
192
		$(LIB_ROOT)/$(NASM)/.tvh_download
193
	cd $(LIB_ROOT)/$(NASM) && $(CONFIGURE_PI) \
194
		--libdir=/$(EPREFIX0)/lib
195
	DESTDIR=$(EBUILDIR) \
196
		$(MAKE) -C $(LIB_ROOT)/$(NASM) install
197
	@touch $@
198

    
199

    
200
# ##############################################################################
201
# LIBX264
202
#
203

    
204
ifeq (yes,$(CONFIG_LIBX264))
205

    
206
EXTLIBS  += libx264
207
ENCODERS += libx264
208
FFMPEG_DIFFS += ffmpeg.libx264.diff
209

    
210
endif
211

    
212

    
213
ifeq (yes,$(CONFIG_LIBX264_STATIC))
214

    
215
ifneq (,$(DEB_BUILD_GNU_TYPE))
216
LIBX264_HOST := --host=$(DEB_BUILD_GNU_TYPE)
217
endif
218

    
219
ifeq (,$(LIBX264_HOST))
220
ifneq (,$(FFMPEG_HOST))
221
LIBX264_HOST := --host=$(FFMPEG_HOST)
222
endif
223
endif
224

    
225
$(LIB_ROOT)/$(LIBX264)/.tvh_download:
226
	$(call DOWNLOAD,$(LIBX264_URL),$(LIB_ROOT)/$(LIBX264_TB),$(LIBX264_SHA1))
227
	$(call UNTAR,$(LIBX264_TB),j)
228
	@touch $@
229

    
230
$(LIB_ROOT)/$(LIBX264)/.tvh_build: \
231
		$(LIB_ROOT)/$(NASM)/.tvh_build \
232
		$(LIB_ROOT)/$(LIBX264)/.tvh_download
233
	cd $(LIB_ROOT)/$(LIBX264) && $(CONFIGURE) \
234
		--extra-asflags="-DPIC" \
235
		--extra-cflags="$(CFLAGS_PI)" \
236
		--disable-cli \
237
		--disable-swscale \
238
		--disable-lavf \
239
		--disable-avs \
240
		--disable-ffms \
241
		--disable-gpac \
242
		--disable-lsmash \
243
		$(LIBX264_HOST)
244
	DESTDIR=$(EBUILDIR) \
245
		$(MAKE) -C $(LIB_ROOT)/$(LIBX264) install
246
	@touch $@
247

    
248
else
249

    
250
$(LIB_ROOT)/$(LIBX264)/.tvh_download:
251
	@mkdir -p $(LIB_ROOT)/$(LIBX264)
252
	@touch $@
253

    
254
$(LIB_ROOT)/$(LIBX264)/.tvh_build: \
255
	$(LIB_ROOT)/$(LIBX264)/.tvh_download
256
	@touch $@
257

    
258
endif
259

    
260

    
261
# ##############################################################################
262
# LIBX265
263
#
264

    
265
ifeq (yes,$(CONFIG_LIBX265))
266

    
267
EXTLIBS  += libx265
268
ENCODERS += libx265
269

    
270
endif
271

    
272

    
273
ifeq (yes,$(CONFIG_LIBX265_STATIC))
274

    
275
$(LIB_ROOT)/$(LIBX265)/.tvh_download:
276
	$(call DOWNLOAD,$(LIBX265_URL),$(LIB_ROOT)/$(LIBX265_TB),$(LIBX265_SHA1))
277
	$(call UNTAR,$(LIBX265_TB),z)
278
	$(call PATCH,$(LIBX265),$(LIBX265_DIFFS))
279
	@touch $@
280

    
281
$(LIB_ROOT)/$(LIBX265)/.tvh_build: \
282
		$(LIB_ROOT)/$(NASM)/.tvh_build \
283
		$(LIB_ROOT)/$(LIBX265)/.tvh_download
284
	cd $(LIB_ROOT)/$(LIBX265)/build/linux && cmake -G "Unix Makefiles" \
285
		-DCMAKE_INSTALL_PREFIX="/ffmpeg" \
286
		-DENABLE_SHARED:BOOL=OFF \
287
		../../source
288
	DESTDIR=$(EBUILDIR) \
289
		$(MAKE) -C $(LIB_ROOT)/$(LIBX265)/build/linux install
290
	mv $(EPREFIX)/lib/pkgconfig/x265.pc $(EPREFIX)/lib/pkgconfig/x265.pc.old
291
	sed -e 's,-ldl,-ldl -lpthread,g' \
292
		< $(EPREFIX)/lib/pkgconfig/x265.pc.old \
293
		> $(EPREFIX)/lib/pkgconfig/x265.pc
294
	@touch $@
295

    
296
else
297

    
298
$(LIB_ROOT)/$(LIBX265)/.tvh_download:
299
	@mkdir -p $(LIB_ROOT)/$(LIBX265)
300
	@touch $@
301

    
302
$(LIB_ROOT)/$(LIBX265)/.tvh_build: \
303
	$(LIB_ROOT)/$(LIBX265)/.tvh_download
304
	@touch $@
305

    
306
endif
307

    
308

    
309
# ##############################################################################
310
# LIBVPX
311
#
312

    
313
ifeq (yes,$(CONFIG_LIBVPX))
314

    
315
EXTLIBS  += libvpx
316
ENCODERS += libvpx_vp8 libvpx_vp9
317

    
318
endif
319

    
320

    
321
ifeq (yes,$(CONFIG_LIBVPX_STATIC))
322

    
323
ifneq (,$(FFMPEG_TARGET))
324
LIBVPX_TARGET := --target=$(FFMPEG_TARGET)
325
endif
326

    
327
$(LIB_ROOT)/$(LIBVPX)/.tvh_download:
328
	$(call DOWNLOAD,$(LIBVPX_URL),$(LIB_ROOT)/$(LIBVPX_TB),$(LIBVPX_SHA1))
329
	$(call UNTAR,$(LIBVPX_TB),z)
330
	@touch $@
331

    
332
$(LIB_ROOT)/$(LIBVPX)/.tvh_build: \
333
		$(LIB_ROOT)/$(NASM)/.tvh_build \
334
		$(LIB_ROOT)/$(LIBVPX)/.tvh_download
335
	cd $(LIB_ROOT)/$(LIBVPX) && \
336
		ASFLAGS="--defsym ENABLE_PIC=1 --defsym DPIC=1" $(CONFIGURE) \
337
		--extra-cflags="$(CFLAGS_PI)" \
338
		--disable-examples \
339
		--disable-docs \
340
		--disable-unit-tests \
341
		$(LIBVPX_TARGET)
342
	DIST_DIR=$(EPREFIX) \
343
		$(MAKE) -C $(LIB_ROOT)/$(LIBVPX) install
344
	@touch $@
345

    
346
else
347

    
348
$(LIB_ROOT)/$(LIBVPX)/.tvh_download:
349
	@mkdir -p $(LIB_ROOT)/$(LIBVPX)
350
	@touch $@
351

    
352
$(LIB_ROOT)/$(LIBVPX)/.tvh_build: \
353
	$(LIB_ROOT)/$(LIBVPX)/.tvh_download
354
	@touch $@
355

    
356
endif
357

    
358

    
359
# ##############################################################################
360
# LIBOGG
361
#
362

    
363
ifeq (yes,$(CONFIG_LIBOGG_STATIC))
364

    
365
$(LIB_ROOT)/$(LIBOGG)/.tvh_download:
366
	$(call DOWNLOAD,$(LIBOGG_URL),$(LIB_ROOT)/$(LIBOGG_TB),$(LIBOGG_SHA1))
367
	$(call UNTAR,$(LIBOGG_TB),z)
368
	@touch $@
369

    
370
$(LIB_ROOT)/$(LIBOGG)/.tvh_build: \
371
		$(LIB_ROOT)/$(NASM)/.tvh_build \
372
		$(LIB_ROOT)/$(LIBOGG)/.tvh_download
373
	cd $(LIB_ROOT)/$(LIBOGG) && \
374
		$(CONFIGURE_PI) \
375
		--libdir=/$(EPREFIX0)/lib
376
	DESTDIR=$(EBUILDIR) \
377
		$(MAKE) -C $(LIB_ROOT)/$(LIBOGG) install
378
	@touch $@
379

    
380
endif
381

    
382

    
383
# ##############################################################################
384
# LIBTHEORA
385
#
386

    
387
ifeq (yes,$(CONFIG_LIBTHEORA))
388

    
389
EXTLIBS  += libtheora
390
ENCODERS += libtheora
391

    
392
endif
393

    
394

    
395
ifeq (yes,$(CONFIG_LIBTHEORA_STATIC))
396

    
397
ifeq (,$(LIBTHEORA_HOST))
398
ifneq (,$(FFMPEG_HOST))
399
LIBTHEORA_HOST := --host=$(FFMPEG_HOST)
400
endif
401
endif
402

    
403
$(LIB_ROOT)/$(LIBTHEORA)/.tvh_download:
404
	$(call DOWNLOAD,$(LIBTHEORA_URL),$(LIB_ROOT)/$(LIBTHEORA_TB),$(LIBTHEORA_SHA1))
405
	$(call UNTAR,$(LIBTHEORA_TB),z)
406
	@touch $@
407

    
408
$(LIB_ROOT)/$(LIBTHEORA)/.tvh_build: \
409
		$(LIB_ROOT)/$(NASM)/.tvh_build \
410
		$(LIB_ROOT)/$(LIBOGG)/.tvh_build \
411
		$(LIB_ROOT)/$(LIBTHEORA)/.tvh_download
412
	cd $(LIB_ROOT)/$(LIBTHEORA) && \
413
		$(CONFIGURE_PI) \
414
		--libdir=/$(EPREFIX0)/lib \
415
		--with-ogg=$(EPREFIX) \
416
		--disable-examples \
417
		--disable-spec \
418
		$(LIBTHEORA_HOST)
419
	DESTDIR=$(EBUILDIR) \
420
		$(MAKE) -C $(LIB_ROOT)/$(LIBTHEORA) install
421
	@touch $@
422

    
423
else
424

    
425
$(LIB_ROOT)/$(LIBTHEORA)/.tvh_download:
426
	@mkdir -p $(LIB_ROOT)/$(LIBTHEORA)
427
	@touch $@
428

    
429
$(LIB_ROOT)/$(LIBTHEORA)/.tvh_build: \
430
	$(LIB_ROOT)/$(LIBTHEORA)/.tvh_download
431
	@touch $@
432

    
433
endif
434

    
435

    
436
# ##############################################################################
437
# LIBVORBIS
438
#
439

    
440
ifeq (yes,$(CONFIG_LIBVORBIS))
441

    
442
EXTLIBS  += libvorbis
443
DECODERS += libvorbis
444
ENCODERS += libvorbis
445

    
446
endif
447

    
448

    
449
ifeq (yes,$(CONFIG_LIBVORBIS_STATIC))
450

    
451
$(LIB_ROOT)/$(LIBVORBIS)/.tvh_download:
452
	$(call DOWNLOAD,$(LIBVORBIS_URL),$(LIB_ROOT)/$(LIBVORBIS_TB),$(LIBVORBIS_SHA1))
453
	$(call UNTAR,$(LIBVORBIS_TB),z)
454
	@touch $@
455

    
456
$(LIB_ROOT)/$(LIBVORBIS)/.tvh_build: \
457
		$(LIB_ROOT)/$(NASM)/.tvh_build \
458
		$(LIB_ROOT)/$(LIBOGG)/.tvh_build \
459
		$(LIB_ROOT)/$(LIBVORBIS)/.tvh_download
460
	cd $(LIB_ROOT)/$(LIBVORBIS) && \
461
		$(CONFIGURE_PI) \
462
		--libdir=/$(EPREFIX0)/lib \
463
		--with-ogg=$(EPREFIX)
464
	DESTDIR=$(EBUILDIR) \
465
		$(MAKE) -C $(LIB_ROOT)/$(LIBVORBIS) install
466
	@touch $@
467

    
468
else
469

    
470
$(LIB_ROOT)/$(LIBVORBIS)/.tvh_download:
471
	@mkdir -p $(LIB_ROOT)/$(LIBVORBIS)
472
	@touch $@
473

    
474
$(LIB_ROOT)/$(LIBVORBIS)/.tvh_build: \
475
	$(LIB_ROOT)/$(LIBVORBIS)/.tvh_download
476
	@touch $@
477

    
478
endif
479

    
480

    
481
# ##############################################################################
482
# LIBFDKAAC
483
#
484

    
485
ifeq (yes,$(CONFIG_LIBFDKAAC))
486

    
487
EXTLIBS  += libfdk-aac
488
ENCODERS += libfdk_aac
489

    
490
endif
491

    
492

    
493
ifeq (yes,$(CONFIG_LIBFDKAAC_STATIC))
494

    
495
$(LIB_ROOT)/$(LIBFDKAAC)/.tvh_download:
496
	$(call DOWNLOAD,$(LIBFDKAAC_URL),$(LIB_ROOT)/$(LIBFDKAAC_TB),$(LIBFDKAAC_SHA1))
497
	$(call UNTAR,$(LIBFDKAAC_TB),z)
498
	@touch $@
499

    
500
$(LIB_ROOT)/$(LIBFDKAAC)/.tvh_build: \
501
		$(LIB_ROOT)/$(LIBFDKAAC)/.tvh_download
502
	cd $(LIB_ROOT)/$(LIBFDKAAC) && $(AUTOGEN) && CXXFLAGS="-std=c++98 -fPIC" $(CONFIGURE_PI) \
503
		--libdir=/$(EPREFIX0)/lib
504
	DESTDIR=$(EBUILDIR) \
505
		$(MAKE) -C $(LIB_ROOT)/$(LIBFDKAAC) install
506
	@touch $@
507

    
508
else
509

    
510
$(LIB_ROOT)/$(LIBFDKAAC)/.tvh_download:
511
	@mkdir -p $(LIB_ROOT)/$(LIBFDKAAC)
512
	@touch $@
513

    
514
$(LIB_ROOT)/$(LIBFDKAAC)/.tvh_build: \
515
	$(LIB_ROOT)/$(LIBFDKAAC)/.tvh_download
516
	@touch $@
517

    
518
endif
519

    
520

    
521
# ##############################################################################
522
# LIBOPUS
523
#
524

    
525
ifeq (yes,$(CONFIG_LIBOPUS))
526

    
527
EXTLIBS  += libopus
528
ENCODERS += libopus
529

    
530
endif
531

    
532

    
533
ifeq (yes,$(CONFIG_LIBOPUS_STATIC))
534

    
535
$(LIB_ROOT)/$(LIBOPUS)/.tvh_download:
536
	$(call DOWNLOAD,$(LIBOPUS_URL),$(LIB_ROOT)/$(LIBOPUS_TB),$(LIBOPUS_SHA1))
537
	$(call UNTAR,$(LIBOPUS_TB),z)
538
	@touch $@
539

    
540
$(LIB_ROOT)/$(LIBOPUS)/.tvh_build: \
541
		$(LIB_ROOT)/$(NASM)/.tvh_build \
542
		$(LIB_ROOT)/$(LIBOPUS)/.tvh_download
543
	cd $(LIB_ROOT)/$(LIBOPUS) && $(CONFIGURE_PI) \
544
		--disable-doc \
545
		--disable-extra-programs
546
	DESTDIR=$(EBUILDIR) \
547
		$(MAKE) -C $(LIB_ROOT)/$(LIBOPUS) install
548
	@touch $@
549

    
550
else
551

    
552
$(LIB_ROOT)/$(LIBOPUS)/.tvh_download:
553
	@mkdir -p $(LIB_ROOT)/$(LIBOPUS)
554
	@touch $@
555

    
556
$(LIB_ROOT)/$(LIBOPUS)/.tvh_build: \
557
	$(LIB_ROOT)/$(LIBOPUS)/.tvh_download
558
	@touch $@
559

    
560
endif
561

    
562

    
563
# ##############################################################################
564
# NVENC
565
#
566

    
567
ifeq (yes,$(CONFIG_NVENC))
568

    
569
## YOU MUST INSTALL CUDA from NVIDIA for "libnpp" 
570
EXTLIBS   += nvenc cuvid libnpp
571
ENCODERS  += h264_nvenc hevc_nvenc
572
DECODERS  += h264_cuvid hevc_cuvid
573
HWACCELS  += h264_nvdec hevc_nvdec vp8_nvdec vp9_nvdec mjpeg_nvdec mpeg1_nvdec mpeg2_nvdec mpeg4_nvdec
574
ECFLAGS   += -I/usr/local/cuda/include
575

    
576
## NVIDIA LIB for "libnpp" 
577
CONFIGURE_FFMPEG += --extra-ldflags=-L/usr/local/cuda/lib64
578

    
579
$(LIB_ROOT)/$(FFNVCODEC)/.tvh_download:
580
	$(call DOWNLOAD,$(FFNVCODEC_URL),$(LIB_ROOT)/$(FFNVCODEC_TB),$(FFNVCODEC_SHA1))
581
	$(call UNTAR,$(FFNVCODEC_TB),z)
582
	@touch $@
583

    
584
$(LIB_ROOT)/$(FFNVCODEC)/.tvh_build: \
585
		$(LIB_ROOT)/$(FFNVCODEC)/.tvh_download
586
	mv $(LIB_ROOT)/$(FFNVCODEC)/Makefile $(LIB_ROOT)/$(FFNVCODEC)/Makefile.old
587
	sed -e 's,PREFIX = /usr/local,PREFIX ?= /usr/local,g' \
588
		< $(LIB_ROOT)/$(FFNVCODEC)/Makefile.old \
589
		> $(LIB_ROOT)/$(FFNVCODEC)/Makefile
590
	DESTDIR=$(EBUILDIR) PREFIX=/ffmpeg \
591
		$(MAKE) -C $(LIB_ROOT)/$(FFNVCODEC) install
592
	@touch $@
593

    
594
else
595

    
596
$(LIB_ROOT)/$(FFNVCODEC)/.tvh_download:
597
	@mkdir $(LIB_ROOT)/$(FFNVCODEC)
598
	@touch $@
599

    
600
$(LIB_ROOT)/$(FFNVCODEC)/.tvh_build: \
601
		$(LIB_ROOT)/$(FFNVCODEC)/.tvh_download
602
	@touch $@
603

    
604
endif
605

    
606

    
607
# ##############################################################################
608
# VAAPI
609
#
610

    
611
ifeq (yes,$(CONFIG_VAAPI))
612

    
613
EXTLIBS  += vaapi
614
ENCODERS += h264_vaapi hevc_vaapi vp8_vaapi vp9_vaapi
615
HWACCELS += mpeg2_vaapi h264_vaapi hevc_vaapi vp9_vaapi
616
FILTERS  += deinterlace_vaapi scale_vaapi
617
FFMPEG_DIFFS += ffmpeg.vaapi_encode.diff
618

    
619
endif
620

    
621

    
622
# ##############################################################################
623
# MMAL
624
#
625

    
626
ifeq (yes,$(CONFIG_MMAL))
627

    
628
EXTLIBS  += mmal
629
HWACCELS += h264_mmal mpeg2_mmal
630
DECODERS += h264_mmal
631

    
632
endif
633

    
634

    
635
# ##############################################################################
636
# OMX
637
#
638

    
639
ifeq (yes,$(CONFIG_OMX))
640

    
641
EXTLIBS  += omx
642
ENCODERS += h264_omx
643

    
644
endif
645

    
646
ifeq (yes,$(CONFIG_OMX_RPI))
647

    
648
EXTLIBS  += omx_rpi
649

    
650
endif
651

    
652

    
653
# ##############################################################################
654
# Misc.
655
#
656

    
657
ifneq (,$(filter yes,$(CONFIG_LIBVORBIS) $(CONFIG_LIBTHEORA)))
658

    
659
MUXERS += ogg
660

    
661
endif
662

    
663

    
664
ifneq (,$(filter yes,$(CONFIG_NVENC) $(CONFIG_LIBFDKAAC)))
665

    
666
EXTLIBS += nonfree
667

    
668
endif
669

    
670

    
671
# ##############################################################################
672
# FFMPEG
673
#
674

    
675
$(LIB_ROOT)/$(FFMPEG)/.tvh_download:
676
	@mkdir -p $(EBUILDIR)
677
	$(call DOWNLOAD,$(FFMPEG_URL),$(LIB_ROOT)/$(FFMPEG_TB),$(FFMPEG_SHA1))
678
	$(call UNTAR,$(FFMPEG_TB),j)
679
	$(call PATCH,$(FFMPEG),$(FFMPEG_DIFFS))
680
	@touch $@
681

    
682
$(LIB_ROOT)/$(FFMPEG)/.tvh_build: \
683
		$(LIB_ROOT)/$(NASM)/.tvh_build \
684
		$(LIB_ROOT)/$(LIBX264)/.tvh_build \
685
		$(LIB_ROOT)/$(LIBX265)/.tvh_build \
686
		$(LIB_ROOT)/$(LIBVPX)/.tvh_build \
687
		$(LIB_ROOT)/$(LIBTHEORA)/.tvh_build \
688
		$(LIB_ROOT)/$(LIBVORBIS)/.tvh_build \
689
		$(LIB_ROOT)/$(LIBFDKAAC)/.tvh_build \
690
		$(LIB_ROOT)/$(LIBOPUS)/.tvh_build \
691
		$(LIB_ROOT)/$(FFNVCODEC)/.tvh_build \
692
		$(LIB_ROOT)/$(FFMPEG)/.tvh_download
693
	cd $(LIB_ROOT)/$(FFMPEG) && $(CONFIGURE_FFMPEG) \
694
		--disable-all \
695
		--enable-gpl \
696
		--enable-nonfree \
697
		--extra-cflags="$(ECFLAGS)" \
698
		--extra-libs="$(ELIBS)" \
699
		--pkg-config="$(ROOTDIR)/support/pkg-config.ffmpeg" \
700
		--enable-openssl \
701
		$(foreach component,$(COMPONENTS),--enable-$(component)) \
702
		$(foreach extlib,$(EXTLIBS),--enable-$(extlib)) \
703
		$(foreach protocol,$(PROTOCOLS),--enable-protocol=$(protocol)) \
704
		$(foreach decoder,$(DECODERS),--enable-decoder=$(decoder)) \
705
		$(foreach encoder,$(ENCODERS),--enable-encoder=$(encoder)) \
706
		$(foreach demuxer,$(DEMUXERS),--enable-demuxer=$(demuxer)) \
707
		$(foreach muxer,$(MUXERS),--enable-muxer=$(muxer)) \
708
		$(foreach bsf,$(BSFS),--enable-bsf=$(bsf)) \
709
		$(foreach filter,$(FILTERS),--enable-filter=$(filter)) \
710
		$(foreach hwaccel,$(HWACCELS),--enable-hwaccel=$(hwaccel)) \
711
                --disable-programs \
712
                --disable-doc \
713
                --disable-htmlpages \
714
                --disable-manpages \
715
                --disable-podpages \
716
                --disable-txtpages
717
	DESTDIR=$(EBUILDIR) \
718
		$(MAKE) -C $(LIB_ROOT)/$(FFMPEG) install
719
	@touch $@
    (1-1/1)