summaryrefslogtreecommitdiff
blob: eb159a0b4e590c23d3b43dcf53c54e6757b7732e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=2
inherit toolchain-funcs user

DESCRIPTION="A video/audio/data interactive streaming server"
HOMEPAGE="http://www.fastpath.it/products/palantir/index.php"
SRC_URI="http://www.fastpath.it/products/${PN}/pub/${P}.tgz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE=""

RDEPEND="
	virtual/jpeg
	media-sound/gsm"
DEPEND="${RDEPEND}"

S=${S}/server

pkg_setup() {
	PALANTIR_USER="palantir"
	PALANTIR_PIPE_PATH="/var/run/palantir/telmu_pipe"

	enewuser ${PALANTIR_USER}
}

src_prepare() {
	# this one isn't mangled by Makefile
	sed -i -e "s#/usr/local/share/palantir/telmu_pipe#${PALANTIR_PIPE_PATH}#" \
		tools/set_sensor || die
	# install the config file in correct location
	sed -i -e 's:$(SYS_DIR)/palantir.conf:$(CONFIG_FILE).sample:' Makefile || die
	# tools/ like LDFLAGS too
	sed -i -e 's:-o:$(LDFLAGS) -o:' tools/Makefile || die
	# set the paths in sample configfile
	sed -i \
		-e "s:^# \(NamedPipe \).*:\1${PALANTIR_PIPE_PATH}:" \
		-e "s:^# \(LogFile .*\):\1.log:" \
		${PN}.conf.sample || die
	# use system-wide libgsm headers
	sed -i -e 's:\(#include \)"libgsm/inc/gsm.h":\1<gsm/gsm.h>:' audio.h || die
}

src_compile() {
	# libgsm=-lgsm to avoid bundling it
	emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}" \
		libgsm=-lgsm \
		BASE_DIR=/usr \
		CONFIG_FILE=/etc/${PN}/${PN}.conf \
		NAMED_PIPE=${PALANTIR_PIPE_PATH} \
		|| die
}

src_install() {
	# we're mangling a lot here, so we need to create the dirs ourselves
	dodir ${PALANTIR_PIPE_PATH%/*} /etc/${PN} /var/log || die
	# XXX: make keeps relinking palantir
	emake install CC="$(tc-getCC)" CFLAGS="${CFLAGS}" \
		libgsm=-lgsm \
		BASE_DIR="${D}"usr \
		CONFIG_FILE="${D}"etc/${PN}/${PN}.conf \
		NAMED_PIPE="${D}"${PALANTIR_PIPE_PATH#/} \
		LOG_FILE="${D}"var/log/${PN}.log \
		OWNER=${PALANTIR_USER} \
		|| die

	newbin tools/set_sensor palantir_set_sensor || die
	dodoc doc/* README TODO || die
	newinitd "${FILESDIR}"/${PN}.init ${PN} || die
}