]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
build system: add --enable-hdhomerun_static option
authorJaroslav Kysela <perex@perex.cz>
Tue, 14 Oct 2014 13:16:44 +0000 (15:16 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 14 Oct 2014 13:16:44 +0000 (15:16 +0200)
Makefile
Makefile.hdhomerun [new file with mode: 0644]
configure

index 08714d2b50e64a9179b10b530b15dd8fa92effa0..ddcc47e19e606892a2ce320aca059df69ef41e8a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -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)
@@ -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} += \
@@ -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
@@ -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"
diff --git a/Makefile.hdhomerun b/Makefile.hdhomerun
new file mode 100644 (file)
index 0000000..85585da
--- /dev/null
@@ -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)
index 441257ade99bf41f0d587bb44f792910a750fbbf..fa7df53fd371e98fa96e6eecc6f0750263d159f4 100755 (executable)
--- a/configure
+++ b/configure
@@ -23,6 +23,7 @@ OPTIONS=(
   "linuxdvb:yes"
   "satip_client:yes"
   "hdhomerun_client:auto"
+  "hdhomerun_static:no"
   "iptv:yes"
   "tsfile:yes"
   "dvbscan:yes"
@@ -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
 
 #