Make tvheadend installable.

This commit is contained in:
Andreas Öman 2008-10-09 21:56:22 +00:00
parent ce36fae9b2
commit 2cfd5ce48a
4 changed files with 50 additions and 10 deletions

View file

@ -50,8 +50,31 @@ DLIBS += $(FFMPEG_DLIBS)
SLIBS += $(FFMPEG_SLIBS)
CFLAGS += $(FFMPEG_CFLAGS)
DLIBS += -lpthread
DLIBS += -lpthread -lm -lz
include ../build/prog.mk
#
# Install
#
prefix ?= $(INSTALLPREFIX)
INSTBIN= $(prefix)/bin
INSTMAN= $(prefix)/share/man1
INSTSHARE= $(prefix)/share/hts/tvheadend
install: ${PROG}
mkdir -p $(INSTBIN)
cd $(.OBJDIR) && install -s ${PROG} $(INSTBIN)
mkdir -p $(INSTMAN)
cd man && install ${MAN} $(INSTMAN)
mkdir -p $(INSTSHARE)/docs/html
cp docs/html/*.html $(INSTSHARE)/docs/html
mkdir -p $(INSTSHARE)/docs/docresources
cp docs/docresources/*.png $(INSTSHARE)/docs/docresources
find webui/static/ -type d |grep -v .svn | awk '{print "$(INSTSHARE)/"$$0}' | xargs mkdir -p
find webui/static/ -type f |grep -v .svn | awk '{print $$0 " $(INSTSHARE)/"$$0}' | xargs -n2 cp

18
main.c
View file

@ -54,13 +54,13 @@
#include <libhts/htsparachute.h>
#include <libhts/htssettings.h>
int running;
extern const char *htsversion;
extern const char *htsversion_full;
time_t dispatch_clock;
static LIST_HEAD(, gtimer) gtimers;
pthread_mutex_t global_lock;
const char *contentpath = HTS_INSTALL_PREFIX "/share/hts/tvheadend/";
static void
@ -197,7 +197,7 @@ main(int argc, char **argv)
signal(SIGPIPE, handle_sigpipe);
while((c = getopt(argc, argv, "fu:g:s:")) != -1) {
while((c = getopt(argc, argv, "fu:g:s:c:")) != -1) {
switch(c) {
case 'f':
forkaway = 1;
@ -211,6 +211,9 @@ main(int argc, char **argv)
case 's':
settingspath = optarg;
break;
case 'c':
contentpath = optarg;
break;
}
}
@ -319,12 +322,13 @@ main(int argc, char **argv)
syslog(LOG_NOTICE, "HTS Tvheadend version %s started, "
"running as pid:%d uid:%d gid:%d, settings located in '%s'",
htsversion, getpid(), getuid(), getgid(), hts_settings_get_root());
htsversion_full,
getpid(), getuid(), getgid(), hts_settings_get_root());
if(!forkaway)
fprintf(stderr, "\nHTS Tvheadend version %s started, "
"settings located in '%s'\n",
htsversion, hts_settings_get_root());
fprintf(stderr, "\nHTS Tvheadend version %s started.\n"
"Settings located in '%s'\n",
htsversion_full, hts_settings_get_root());
mainloop();

View file

@ -1,3 +1,10 @@
#include "version.h"
#include "config.h"
#ifdef HTS_RELEASE_TAG
const char *htsversion=HTS_RELEASE_TAG;
const char *htsversion_full=HTS_RELEASE_TAG " (" HTS_VERSION ")";
#else
const char *htsversion=HTS_VERSION;
const char *htsversion_full=HTS_VERSION;
#endif

View file

@ -71,11 +71,17 @@ page_root(http_connection_t *hc, const char *remain, void *opaque)
/**
* Static download of a file from the filesystem
*/
extern char *contentpath;
static int
page_static(http_connection_t *hc, const char *remain, void *opaque)
{
int fd;
const char *rootpath = HTS_BUILD_ROOT "/tvheadend/webui/static";
#ifdef HTS_BUILD_ROOT
const char *rootpath = HTS_BUILD_ROOT "/tvheadend";
#else
const char *rootpath = contentpath;
#endif
char path[500];
struct stat st;
const char *content = NULL, *postfix;
@ -90,7 +96,7 @@ page_static(http_connection_t *hc, const char *remain, void *opaque)
content = "text/javascript; charset=UTF-8";
}
snprintf(path, sizeof(path), "%s/%s", rootpath, remain);
snprintf(path, sizeof(path), "%s/webui/static/%s", rootpath, remain);
if((fd = open(path, O_RDONLY)) < 0)
return 404;