Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
build system: add --enable-hdhomerun_static option
  • Loading branch information
perexg committed Oct 14, 2014
1 parent b67d741 commit 2b2a4cf
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 11 deletions.
37 changes: 30 additions & 7 deletions Makefile
Expand Up @@ -49,18 +49,24 @@ LDFLAGS += -lrt
endif
endif

ifeq ($(COMPILER), clang)
CFLAGS += -Wno-microsoft -Qunused-arguments -Wno-unused-function
CFLAGS += -Wno-unused-value -Wno-tautological-constant-out-of-range-compare
CFLAGS += -Wno-parentheses-equality -Wno-incompatible-pointer-types
endif

ifeq ($(CONFIG_LIBFFMPEG_STATIC),yes)
CFLAGS += -I${ROOTDIR}/libav_static/build/ffmpeg/include
LDFLAGS += -L${ROOTDIR}/libav_static/build/ffmpeg/lib -Wl,-Bstatic \
-lavresample -lswresample -lswscale -lavutil -lavformat -lavcodec -lavutil \
-lavresample -lswresample -lswscale \
-lavutil -lavformat -lavcodec -lavutil \
-lvorbisenc -lvorbis -logg -lx264 -lvpx \
-Wl,-Bdynamic
endif

ifeq ($(COMPILER), clang)
CFLAGS += -Wno-microsoft -Qunused-arguments -Wno-unused-function
CFLAGS += -Wno-unused-value -Wno-tautological-constant-out-of-range-compare
CFLAGS += -Wno-parentheses-equality -Wno-incompatible-pointer-types
ifeq ($(CONFIG_HDHOMERUN_STATIC),yes)
CFLAGS += -I${ROOTDIR}/libhdhomerun_static
LDFLAGS += -L${ROOTDIR}/libhdhomerun_static/libhdhomerun \
-Wl,-Bstatic -lhdhomerun -Wl,-Bdynamic
endif

vpath %.c $(ROOTDIR)
Expand Down Expand Up @@ -259,9 +265,10 @@ SRCS-${CONFIG_SATIP_CLIENT} += \
src/input/mpegts/satip/satip_rtsp.c

# HDHOMERUN
SRCS-${CONFIG_HDHOMERUN_CLIENT} += \
SRCS_HDHOMERUN = \
src/input/mpegts/tvhdhomerun/tvhdhomerun.c \
src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c
SRCS-${CONFIG_HDHOMERUN_CLIENT} += $(SRCS_HDHOMERUN)

# IPTV
SRCS-${CONFIG_IPTV} += \
Expand Down Expand Up @@ -365,6 +372,9 @@ DEPS = ${OBJS:%.o=%.d}
ifeq ($(CONFIG_LIBFFMPEG_STATIC),yes)
DEPS += ${BUILDDIR}/libffmpeg_stamp
endif
ifeq ($(CONFIG_HDHOMERUN_STATIC),yes)
DEPS += ${BUILDDIR}/libhdhomerun_stamp
endif

#
# Build Rules
Expand Down Expand Up @@ -444,6 +454,19 @@ ${BUILDDIR}/libffmpeg_stamp: ${ROOTDIR}/libav_static/build/ffmpeg/lib/libavcodec
${ROOTDIR}/libav_static/build/ffmpeg/lib/libavcodec.a:
$(MAKE) -f Makefile.ffmpeg build

# Static HDHOMERUN library

ifeq ($(CONFIG_LIBHDHOMERUN_STATIC),yes)
${ROOTDIR}/src/input/mpegts/tvhdhomerun/tvhdhomerun_private.h: ${BUILDDIR}/libhdhomerun_stamp
${SRCS_HDHOMERUN}: ${BUILDDIR}/libhdhomerun_stamp
endif

${BUILDDIR}/libhdhomerun_stamp: ${ROOTDIR}/libhdhomerun_static/libhdhomerun/libhdhomerun.a
@touch $@

${ROOTDIR}/libhdhomerun_static/libhdhomerun/libhdhomerun.a:
$(MAKE) -f Makefile.hdhomerun build

# linuxdvb git tree
$(ROOTDIR)/data/dvb-scan/.stamp:
@echo "Receiving data/dvb-scan/dvb-t from http://linuxtv.org/git/dtv-scan-tables.git"
Expand Down
76 changes: 76 additions & 0 deletions Makefile.hdhomerun
@@ -0,0 +1,76 @@
#
# HDhomerun library 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 $(LIBHDHRDIR)/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
endef

define UNTAR
tar x -C $(LIBHDHRDIR) -$(2)f $(LIBHDHRDIR)/$(1)
endef

LIBHDHRDIR = $(ROOTDIR)/libhdhomerun_static

export PATH := $(LIBHDHRDIR)/build/bin:$(PATH)

LIBHDHR = libhdhomerun_20140604
LIBHDHR_TB = $(LIBHDHR).tgz
LIBHDHR_URL = http://download.silicondust.com/hdhomerun/$(LIBHDHR_TB)

.PHONY: build
build: $(LIBHDHRDIR)/$(LIBHDHR)/.tvh_build

#
# libhdhomerun
#

-include $(LIBHDHRDIR)/$(LIBHDHR)/Makefile

OBJS = $(foreach file,$(LIBSRCS),$(LIBHDHRDIR)/$(LIBHDHR)/$(basename $(file)).o)

$(LIBHDHRDIR)/$(LIBHDHR)/%.o: $(LIBHDHRDIR)/$(LIBHDHR)/%.c
$(CC) -MD -MP $(CFLAGS) -c -o $@ $<

$(LIBHDHRDIR)/$(LIBHDHR)/libhdhomerun.a: $(OBJS)
$(AR) rcs $@ $^

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

$(LIBHDHRDIR)/$(LIBHDHR)/.tvh_build: \
$(LIBHDHRDIR)/$(LIBHDHR)/.tvh_download
$(MAKE) -f Makefile.hdhomerun $(LIBHDHRDIR)/$(LIBHDHR)/libhdhomerun.a
@touch $@

.PHONY: static_libhdhr_clean
static_libhdhr_clean:
@rm -rf $(LIBHDHRDIR)
17 changes: 13 additions & 4 deletions configure
Expand Up @@ -23,6 +23,7 @@ OPTIONS=(
"linuxdvb:yes"
"satip_client:yes"
"hdhomerun_client:auto"
"hdhomerun_static:no"
"iptv:yes"
"tsfile:yes"
"dvbscan:yes"
Expand Down Expand Up @@ -229,11 +230,19 @@ fi
#
# HDHomeRun - libhdhomerun
#
if enabled_or_auto hdhomerun_client; then
if ! check_cc_lib hdhomerun; then
enable hdhomerun_client
LDFLAGS="$LDFLAGS -lhdhomerun"
if enabled hdhomerun_static; then

enable hdhomerun_client

else

if enabled_or_auto hdhomerun_client; then
if ! check_cc_lib hdhomerun; then
enable hdhomerun_client
LDFLAGS="$LDFLAGS -lhdhomerun"
fi
fi

fi

#
Expand Down

0 comments on commit 2b2a4cf

Please sign in to comment.