]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Rework file bundling and make configure take most standard args
authorAndreas Öman <andreas@lonelycoder.com>
Tue, 10 Apr 2012 18:43:43 +0000 (20:43 +0200)
committerAndreas Öman <andreas@lonelycoder.com>
Tue, 10 Apr 2012 18:51:09 +0000 (20:51 +0200)
Now ./configure should be able to be correctly invoked from standard
debian helper rules file

ChangeLog [deleted symlink]
Makefile
configure
src/main.c
src/tvheadend.h
src/webui/webui.c
support/dataroot/bundle.c [new file with mode: 0644]
support/dataroot/datadir.c [new file with mode: 0644]
support/dataroot/wd.c [new file with mode: 0644]
support/getver.sh [new file with mode: 0755]
support/posix.mk

diff --git a/ChangeLog b/ChangeLog
deleted file mode 120000 (symlink)
index d526672..0000000
--- a/ChangeLog
+++ /dev/null
@@ -1 +0,0 @@
-debian/changelog
\ No newline at end of file
index a0dacf291b14a646ca79c5c029c55902cbed2436..526945827a19b265b32cc7a4ee9a2fc1ffaab951 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -28,6 +28,8 @@ CFLAGS += -Wall -Werror -Wwrite-strings -Wno-deprecated-declarations
 CFLAGS += -Wmissing-prototypes
 LDFLAGS += -lrt -ldl
 
+BUNDLES += docs/html docs/docresources src/webui/static
+
 #
 # Core
 #
@@ -170,10 +172,21 @@ all: ${PROG}
 
 .PHONY:        clean distclean
 
-${PROG}: $(OBJS) $(BUNDLE_OBJS) ${OBJS_EXTRA} Makefile
-       @mkdir -p $(dir $@)
-       $(CC) -o $@ $(OBJS) $(BUNDLE_OBJS) $(LDFLAGS) ${LDFLAGS_cfg}
+#
+#
+#
+${PROG}: $(OBJS) $(ALLDEPS)  support/dataroot/wd.c
+       $(CC) -o $@ $(OBJS) support/dataroot/wd.c $(LDFLAGS) ${LDFLAGS_cfg}
 
+${PROG}.bundle: $(OBJS) $(BUNDLE_OBJS) $(ALLDEPS)  support/dataroot/bundle.c
+       $(CC) -o $@ $(OBJS) support/dataroot/bundle.c $(BUNDLE_OBJS) $(LDFLAGS) ${LDFLAGS_cfg}
+
+${PROG}.datadir: $(OBJS) $(ALLDEPS)  support/dataroot/datadir.c
+       $(CC) -o $@ $(OBJS) -iquote${BUILDDIR} support/dataroot/datadir.c $(LDFLAGS) ${LDFLAGS_cfg}
+
+#
+#
+#
 ${BUILDDIR}/%.o: %.c
        @mkdir -p $(dir $@)
        $(CC) -MD -MP $(CFLAGS_com) $(CFLAGS) $(CFLAGS_cfg) -c -o $@ $(CURDIR)/$<
index 7c01c60cca58d65be79db12541d330cb62d8662e..651b9c37f0d26afd7aa067bea65c57d61e37e6c4 100755 (executable)
--- a/configure
+++ b/configure
 # Copyright (c) 2005-2008 Mans Rullgard
 #
 
-PLATFORM=`uname`
-
+PLATFORM=linux
 source support/configure.inc
 
 CPU=generic
 ARCH=`uname -m`
 OSENV="posix"
-PREFIX=/usr/local
+prefix=/usr/local
+bindir="\${prefix}/bin"
+mandir="\${prefix}/share/man"
+datadir="\${prefix}/share/tvheadend"
 
 show_help(){
   echo "Usage: configure [options]"
@@ -26,7 +28,11 @@ show_help(){
   echo
   echo "Standard options:"
   echo "  --help                   print this message"
-  echo "  --prefix=PREFIX          install in PREFIX [$PREFIX]"
+  echo "  --prefix=PREFIX          Install in PREFIX [$prefix]"
+  echo "  --bindir=DIR             Install binaries in DIR [$bindir]"
+  echo "  --mandir=DIR             Install man pages in DIR [$mandir]"
+  echo "  --datadir=DIR            Install data files in DIR [$datadir]"
+  echo
   echo "  --arch=arch              Build for this architecture [$ARCH]"
   echo "  --cpu=cpu                Build and optimize for specific CPU"
   echo "  --cc=CC                  Build using the given compiler"
@@ -42,8 +48,6 @@ enable v4l
 for opt do
   optval="${opt#*=}"
   case "$opt" in
-  --prefix=*) PREFIX="$optval"
-  ;;
   --cpu=*) CPU="$optval"
   ;;
   --help) show_help
@@ -53,6 +57,33 @@ for opt do
   ;;
   --cc=*) CC="$optval"
   ;;
+  --prefix=*)
+  prefix="$optval"
+  ;;
+  --bindir=*)
+  bindir="$optval"
+  ;;
+  --mandir=*)
+  mandir="$optval"
+  ;;
+  --datadir=*)
+  datadir="$optval"
+  ;;
+  --includedir=*)
+  ;;
+  --infodir=*)
+  ;;
+  --sysconfdir=*)
+  ;;
+  --localstatedir=*)
+  ;;
+  --libexecdir=*)
+  ;;
+  --disable-maintainer-mode)
+  ;;
+  --disable-dependency-tracking)
+  ;;
+
   --enable-?*|--disable-?*)
   eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
   $action $option
@@ -155,37 +186,31 @@ else
 fi
 
 #
-# Configure paths, etc
+# Finalize
 #
-if [ ${RELEASE} != yes ]; then
-    echo  NOTE:
-    echo  NOTE: Development build. 
-    echo  NOTE: The generated binary will contained compild-in paths to
-    echo  NOTE: the current build tree. If you plan to install or move 
-    echo  NOTE: the binary, please reconfigure with '--release'.
-    echo  NOTE:
-
-    cat >> ${CONFIG_H} << EOF
-#define TVHEADEND_CONTENT_PATH "${TOPDIR}"
+cat >> ${CONFIG_MAK} << EOF 
+ARCH=$ARCH
+LDFLAGS_cfg += -lpthread
 EOF
 
-else
-
-    echo >>${CONFIG_MAK} "BUNDLES += docs/html docs/docresources src/webui/static"
-
-    cat >> ${CONFIG_H} << EOF
-#define TVHEADEND_CONTENT_PATH NULL
-EOF
-fi
 
 #
 # Finalize
 #
-cat >> ${CONFIG_MAK} << EOF 
-ARCH=$ARCH
-INSTALLPREFIX=$PREFIX
-LDFLAGS_cfg += -lpthread
-EOF
+echo
+echo "Installation paths:"
+echo "  Prefix:        ${prefix}"
+echo "  Binaries:      ${bindir}"
+echo "  Man pages:     ${mandir}"
+echo "  Data files:    ${datadir}"
+echo
+echo >>${CONFIG_MAK} "prefix=$prefix"
+echo >>${CONFIG_MAK} "bindir=\${DESTDIR}$bindir"
+echo >>${CONFIG_MAK} "mandir=\${DESTDIR}$mandir"
+echo >>${CONFIG_MAK} "datadir=\${DESTDIR}$datadir"
+echo >>${CONFIG_MAK} LDFLAGS_cfg += -lpthread -lrt -ldl
+eval datadirpath=${datadir}
+echo >>${CONFIG_H} "#define TVHEADEND_DATADIR \"${datadirpath}\""
 
 
 finalize
index 9474ea8b9fbebdb7ba1ff8bc6845b5698e43668a..9569ea0d5c8fda7a789de79bc0d94fd3054d72a0 100644 (file)
@@ -385,7 +385,7 @@ main(int argc, char **argv)
 #endif
   http_server_init();
 
-  webui_init(TVHEADEND_CONTENT_PATH);
+  webui_init(tvheadend_dataroot());
 
   serviceprobe_init();
 
@@ -429,9 +429,11 @@ main(int argc, char **argv)
   pthread_sigmask(SIG_UNBLOCK, &set, NULL);
 
   tvhlog(LOG_NOTICE, "START", "HTS Tvheadend version %s started, "
-        "running as PID:%d UID:%d GID:%d, settings located in '%s'",
+        "running as PID:%d UID:%d GID:%d, settings located in '%s', "
+        "dataroot: %s",
         tvheadend_version,
-        getpid(), getuid(), getgid(), hts_settings_get_root());
+        getpid(), getuid(), getgid(), hts_settings_get_root(),
+        tvheadend_dataroot() ?: "<Embedded file system>");
 
   if(crash)
     abort();
index 74b7783412fc5f9e1df9e72cbfe4fd9aeb8232a3..a82feaeebc12b189efafd0bd2a596d6314c6de36 100644 (file)
@@ -34,6 +34,7 @@
 #include "redblack.h"
 
 extern const char *tvheadend_version;
+extern const char *tvheadend_dataroot();
 
 #define PTS_UNSET INT64_C(0x8000000000000000)
 
index 9aefb0a54e32eb97b89ef2d97de4cf28499810f6..929341eb562f2de092c4fb224fb502510b75d829 100644 (file)
@@ -657,10 +657,9 @@ webui_static_content(const char *content_path, const char *http_path,
   }
 
   tvhlog(LOG_ERR, "webui", 
-        "No source path providing HTTP content: \"%s\"."
+        "No source path providing HTTP content: \"%s\". "
         "Checked in \"%s\" and in the binary's embedded file system. "
-        "If you need to move or install the binary, "
-        "reconfigure with --release", http_path, content_path);
+        , http_path, content_path);
 
 }
 
diff --git a/support/dataroot/bundle.c b/support/dataroot/bundle.c
new file mode 100644 (file)
index 0000000..72abeff
--- /dev/null
@@ -0,0 +1,4 @@
+const char *tvheadend_dataroot(void)
+{
+  return (void *)0;
+} 
diff --git a/support/dataroot/datadir.c b/support/dataroot/datadir.c
new file mode 100644 (file)
index 0000000..af380ac
--- /dev/null
@@ -0,0 +1,7 @@
+#include "config.h"
+
+const char *tvheadend_dataroot(void)
+{
+  return TVHEADEND_DATADIR;
+}
+
diff --git a/support/dataroot/wd.c b/support/dataroot/wd.c
new file mode 100644 (file)
index 0000000..9b653eb
--- /dev/null
@@ -0,0 +1,4 @@
+const char *tvheadend_dataroot(void)
+{
+  return "./";
+}
diff --git a/support/getver.sh b/support/getver.sh
new file mode 100755 (executable)
index 0000000..938b5a5
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+revision=`cd "$1" && git describe --dirty --abbrev=5 2>/dev/null | sed  -e 's/-/./g'`
+
+if ! test $revision; then
+    test $revision || revision=`cd "$1" && git describe --abbrev=5 2>/dev/null | sed  -e 's/-/./g'`
+fi
+
+echo $revision
index baad6936ed7625b19de538072195ef332547ef78..7f7bfc35fda97b687e983276b148c679fe61d8de 100644 (file)
@@ -1,22 +1,19 @@
+MAN = man/tvheadend.1
+ICON = support/gnome/tvheadend.svg
 
-INSTBIN=  ${DESTDIR}${INSTALLPREFIX}/bin
-INSTMAN=  ${DESTDIR}${INSTALLPREFIX}/share/man/man1
-INSTDBG=  ${DESTDIR}${INSTALLPREFIX}/lib/debug/bin
-MAN=man/tvheadend.1
+INSTICON= ${DESTDIR}$(prefix)/share/icons/hicolor/scalable/apps
 
-install: ${PROG} ${MAN}
-       mkdir -p ${INSTBIN}
-       install -T ${PROG} ${INSTBIN}/tvheadend
-       mkdir -p ${INSTMAN}
-       install ${MAN} ${INSTMAN}
 
-install-debug: ${PROG}
-       mkdir -p ${INSTDBG}
-       objcopy --only-keep-debug ${INSTBIN}/tvheadend ${INSTDBG}/tvheadend.debug
-       strip -g ${INSTBIN}/tvheadend
-       objcopy --add-gnu-debuglink=${INSTDBG}/tvheadend.debug ${INSTBIN}/tvheadend
+install: ${PROG}.datadir ${MAN}
+       install -D ${PROG}.datadir ${bindir}/tvheadend
+       install -D ${MAN} ${mandir}/tvheadend.1
+
+       for bundle in ${BUNDLES}; do \
+               mkdir -p ${datadir}/$$bundle ;\
+               cp -r $$bundle/*  ${datadir}/$$bundle ;\
+       done
+
 
 uninstall:
-       rm -f ${INSTBIN}/tvheadend
-       rm -f ${INSTDBG}/tvheadend.debug
-       rm -f ${INSTMAN}/tvheadend.1
+       rm -f ${bindir)/tvheadend
+       rm -f ${mandir)/tvheadend.1