Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Makefile.ffmpeg,hdhomerun: add sha1sum tests to avoid hijacking
  • Loading branch information
perexg committed Oct 15, 2014
1 parent f064ccc commit b7c8a30
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
24 changes: 18 additions & 6 deletions Makefile.ffmpeg
Expand Up @@ -29,6 +29,12 @@ define DOWNLOAD
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
Expand All @@ -45,6 +51,7 @@ 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
Expand All @@ -55,22 +62,27 @@ MUXERS = mpegts mpeg2dvd
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
Expand All @@ -80,7 +92,7 @@ build: $(LIBAVDIR)/$(FFMPEG)/.tvh_build
#

$(LIBAVDIR)/$(YASM)/.tvh_download:
$(call DOWNLOAD,$(YASM_URL),$(LIBAVDIR)/$(YASM_TB))
$(call DOWNLOAD,$(YASM_URL),$(LIBAVDIR)/$(YASM_TB),$(YASM_SHA1))
$(call UNTAR,$(YASM_TB),z)
@touch $@

Expand All @@ -97,7 +109,7 @@ $(LIBAVDIR)/$(YASM)/.tvh_build: \
#

$(LIBAVDIR)/$(LIBOGG)/.tvh_download:
$(call DOWNLOAD,$(LIBOGG_URL),$(LIBAVDIR)/$(LIBOGG_TB))
$(call DOWNLOAD,$(LIBOGG_URL),$(LIBAVDIR)/$(LIBOGG_TB),$(LIBOGG_SHA1))
$(call UNTAR,$(LIBOGG_TB),z)
@touch $@

Expand All @@ -114,7 +126,7 @@ $(LIBAVDIR)/$(LIBOGG)/.tvh_build: \

$(LIBAVDIR)/$(LIBVORBIS)/.tvh_download: \
$(LIBAVDIR)/$(LIBOGG)/.tvh_download
$(call DOWNLOAD,$(LIBVORBIS_URL),$(LIBAVDIR)/$(LIBVORBIS_TB))
$(call DOWNLOAD,$(LIBVORBIS_URL),$(LIBAVDIR)/$(LIBVORBIS_TB),$(LIBVORBIS_SHA1))
$(call UNTAR,$(LIBVORBIS_TB),z)
@touch $@

Expand Down Expand Up @@ -150,7 +162,7 @@ $(LIBAVDIR)/$(LIBX264)/.tvh_build: $(LIBAVDIR)/$(LIBX264)/.tvh_download
else

$(LIBAVDIR)/$(LIBX264)/.tvh_download:
$(call DOWNLOAD,$(LIBX264_URL),$(LIBAVDIR)/$(LIBX264_TB))
$(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); }
Expand Down Expand Up @@ -181,7 +193,7 @@ endif

$(LIBAVDIR)/$(LIBVPX)/.tvh_download:
@mkdir -p $(LIBAVDIR)
$(call DOWNLOAD,$(LIBVPX_URL),$(LIBAVDIR)/$(LIBVPX_TB))
$(call DOWNLOAD,$(LIBVPX_URL),$(LIBAVDIR)/$(LIBVPX_TB),$(LIBVPX_SHA1))
$(call UNTAR,$(LIBVPX_TB),j)
@touch $@

Expand All @@ -202,7 +214,7 @@ $(LIBAVDIR)/$(LIBVPX)/.tvh_build: \

$(LIBAVDIR)/$(FFMPEG)/.tvh_download:
@mkdir -p $(LIBAVDIR)/build
$(call DOWNLOAD,$(FFMPEG_URL),$(LIBAVDIR)/$(FFMPEG_TB))
$(call DOWNLOAD,$(FFMPEG_URL),$(LIBAVDIR)/$(FFMPEG_TB),$(FFMPEG_SHA1))
$(call UNTAR,$(FFMPEG_TB),j)
@touch $@

Expand Down
9 changes: 8 additions & 1 deletion Makefile.hdhomerun
Expand Up @@ -29,6 +29,12 @@ define DOWNLOAD
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
Expand All @@ -42,6 +48,7 @@ export PATH := $(LIBHDHRDIR)/build/bin:$(PATH)
LIBHDHR = libhdhomerun_20140604
LIBHDHR_TB = $(LIBHDHR).tgz
LIBHDHR_URL = http://download.silicondust.com/hdhomerun/$(LIBHDHR_TB)
LIBHDHR_SHA1 = b8d910a5721c484a30b81662fd6991e3546ed67c

.PHONY: build
build: $(LIBHDHRDIR)/$(LIBHDHR)/.tvh_build
Expand All @@ -61,7 +68,7 @@ $(LIBHDHRDIR)/$(LIBHDHR)/libhdhomerun.a: $(OBJS)
$(AR) rcs $@ $^

$(LIBHDHRDIR)/$(LIBHDHR)/.tvh_download:
$(call DOWNLOAD,$(LIBHDHR_URL),$(LIBHDHRDIR)/$(LIBHDHR_TB))
$(call DOWNLOAD,$(LIBHDHR_URL),$(LIBHDHRDIR)/$(LIBHDHR_TB),$(LIBHDHR_SHA1))
$(call UNTAR,$(LIBHDHR_TB),z)
ln -sf libhdhomerun $(LIBHDHRDIR)/$(LIBHDHR)
@touch $@
Expand Down

0 comments on commit b7c8a30

Please sign in to comment.