tvheadend/Makefile.ffmpeg

249 lines
7.1 KiB
Text
Raw Permalink Normal View History

#
# 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
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
2014-10-17 20:53:57 +02:00
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
2014-10-13 13:33:35 +02:00
YASM = yasm-1.3.0
YASM_TB = $(YASM).tar.gz
YASM_URL = http://www.tortall.net/projects/yasm/releases/$(YASM_TB)
YASM_SHA1 = b7574e9f0826bedef975d64d3825f75fbaeef55e
2014-10-13 13:33:35 +02:00
.PHONY: build
build: $(LIBAVDIR)/$(FFMPEG)/.tvh_build
2014-10-13 13:33:35 +02:00
#
# YASM
#
$(LIBAVDIR)/$(YASM)/.tvh_download:
$(call DOWNLOAD,$(YASM_URL),$(LIBAVDIR)/$(YASM_TB),$(YASM_SHA1))
2014-10-13 13:33:35 +02:00
$(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: \
2014-10-13 13:33:35 +02:00
$(LIBAVDIR)/$(YASM)/.tvh_build \
$(LIBAVDIR)/$(LIBOGG)/.tvh_download
cd $(LIBAVDIR)/$(LIBOGG) && ./configure \
--prefix=/ffmpeg \
--enable-static \
--disable-shared
DESTDIR=$(LIBAVDIR)/build \
2014-10-13 13:33:35 +02:00
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 \
2014-10-13 13:33:35 +02:00
$(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 \
2014-10-13 13:33:35 +02:00
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: \
2014-10-13 13:33:35 +02:00
$(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 \
2014-10-13 13:33:35 +02:00
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: \
2014-10-13 13:33:35 +02:00
$(LIBAVDIR)/$(LIBVPX)/.tvh_download \
$(LIBAVDIR)/$(YASM)/.tvh_build
cd $(LIBAVDIR)/$(LIBVPX) && ./configure \
--prefix=/ffmpeg \
--enable-static \
--disable-shared
DIST_DIR=$(LIBAVDIR)/build/ffmpeg \
2014-10-13 13:33:35 +02:00
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: \
2014-10-13 13:33:35 +02:00
$(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 \
2014-10-13 13:33:35 +02:00
make -C $(LIBAVDIR)/$(FFMPEG) install
@touch $@
.PHONY: static_libav_clean
static_libav_clean:
@rm -rf $(LIBAVDIR)