From: Andreas Ă–man Date: Tue, 10 Apr 2012 18:43:43 +0000 (+0200) Subject: Rework file bundling and make configure take most standard args X-Git-Tag: 3.0~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00378579ed350ab1d18be53ccec179acb594da90;p=thirdparty%2Ftvheadend.git 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 --- diff --git a/ChangeLog b/ChangeLog deleted file mode 120000 index d526672ce..000000000 --- a/ChangeLog +++ /dev/null @@ -1 +0,0 @@ -debian/changelog \ No newline at end of file diff --git a/Makefile b/Makefile index a0dacf291..526945827 100644 --- 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)/$< diff --git a/configure b/configure index 7c01c60cc..651b9c37f 100755 --- a/configure +++ b/configure @@ -11,14 +11,16 @@ # 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 diff --git a/src/main.c b/src/main.c index 9474ea8b9..9569ea0d5 100644 --- a/src/main.c +++ b/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() ?: ""); if(crash) abort(); diff --git a/src/tvheadend.h b/src/tvheadend.h index 74b778341..a82feaeeb 100644 --- a/src/tvheadend.h +++ b/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) diff --git a/src/webui/webui.c b/src/webui/webui.c index 9aefb0a54..929341eb5 100644 --- a/src/webui/webui.c +++ b/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); } diff --git a/support/dataroot/bundle.c b/support/dataroot/bundle.c new file mode 100644 index 000000000..72abeff03 --- /dev/null +++ b/support/dataroot/bundle.c @@ -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 index 000000000..af380ac31 --- /dev/null +++ b/support/dataroot/datadir.c @@ -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 index 000000000..9b653eb2d --- /dev/null +++ b/support/dataroot/wd.c @@ -0,0 +1,4 @@ +const char *tvheadend_dataroot(void) +{ + return "./"; +} diff --git a/support/getver.sh b/support/getver.sh new file mode 100755 index 000000000..938b5a5f7 --- /dev/null +++ b/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 diff --git a/support/posix.mk b/support/posix.mk index baad6936e..7f7bfc35f 100644 --- a/support/posix.mk +++ b/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