Skip to content
Browse files

Rework file bundling and make configure take most standard args

Now ./configure should be able to be correctly invoked from standard
debian helper rules file
  • Loading branch information...
1 parent e226ec3 commit 00378579ed350ab1d18be53ccec179acb594da90 @andoma committed Apr 10, 2012
Showing with 116 additions and 57 deletions.
  1. +0 −1 ChangeLog
  2. +16 −3 Makefile
  3. +55 −30 configure
  4. +5 −3 src/main.c
  5. +1 −0 src/tvheadend.h
  6. +2 −3 src/webui/webui.c
  7. +4 −0 support/dataroot/bundle.c
  8. +7 −0 support/dataroot/datadir.c
  9. +4 −0 support/dataroot/wd.c
  10. +8 −0 support/getver.sh
  11. +14 −17 support/posix.mk
View
1 ChangeLog
View
19 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)/$<
View
85 configure
@@ -11,22 +11,28 @@
# 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]"
echo "Options: [defaults in brackets after descriptions]"
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
View
8 src/main.c
@@ -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();
View
1 src/tvheadend.h
@@ -34,6 +34,7 @@
#include "redblack.h"
extern const char *tvheadend_version;
+extern const char *tvheadend_dataroot();
#define PTS_UNSET INT64_C(0x8000000000000000)
View
5 src/webui/webui.c
@@ -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);
}
View
4 support/dataroot/bundle.c
@@ -0,0 +1,4 @@
+const char *tvheadend_dataroot(void)
+{
+ return (void *)0;
+}
View
7 support/dataroot/datadir.c
@@ -0,0 +1,7 @@
+#include "config.h"
+
+const char *tvheadend_dataroot(void)
+{
+ return TVHEADEND_DATADIR;
+}
+
View
4 support/dataroot/wd.c
@@ -0,0 +1,4 @@
+const char *tvheadend_dataroot(void)
+{
+ return "./";
+}
View
8 support/getver.sh
@@ -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
View
31 support/posix.mk
@@ -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

0 comments on commit 0037857

Please sign in to comment.
Something went wrong with that request. Please try again.