summaryrefslogtreecommitdiff
blob: c1c1967e50e016c142c54f67509ec30e02c2c051 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-sound/mt-daapd/mt-daapd-0.2.4.1.ebuild,v 1.8 2007/12/31 03:10:40 vapier Exp $

inherit autotools eutils

DESCRIPTION="A multi-threaded implementation of Apple's DAAP server"
HOMEPAGE="http://www.mt-daapd.org"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 arm ~mips ppc sh sparc x86"
IUSE="avahi vorbis"

RDEPEND="media-libs/libid3tag
	sys-libs/gdbm
	avahi? ( net-dns/avahi )
	!avahi? ( net-misc/mDNSResponder )
	vorbis? ( media-libs/libvorbis )"
DEPEND="${RDEPEND}
	dev-util/pkgconfig"

pkg_setup() {
	local fail="Re-emerge net-dns/avahi with USE dbus."

	if use avahi && ! built_with_use net-dns/avahi dbus; then
		eerror "${fail}"
		die "${fail}"
	fi
}

src_unpack() {
	unpack ${A}
	cd "${S}"
	epatch "${FILESDIR}"/${PN}-0.2.3-sparc.patch
	epatch "${FILESDIR}"/${P}-libsorder.patch
	epatch "${FILESDIR}"/${P}-pidfile.patch
	eautoreconf

	cp "${FILESDIR}"/${PN}.init.2 initd

	if use avahi; then
		sed -i -e 's:#USEHOWL need mDNSResponder:need avahi-daemon:' initd
	else
		sed -i -e 's:#USEHOWL ::' initd
	fi
}

src_compile() {
	local myconf

	if use avahi; then
		myconf="--enable-avahi --disable-mdns"
	else
		myconf="--disable-avahi --enable-mdns"
	fi

	econf $(use_enable vorbis oggvorbis) \
		${myconf}

	emake || die "emake failed."
}

src_install() {
	emake DESTDIR="${D}" install || die "emake install failed."

	insinto /etc
	newins contrib/mt-daapd.conf mt-daapd.conf.example
	doins contrib/mt-daapd.playlist

	newinitd initd ${PN}

	keepdir /var/cache/mt-daapd /etc/mt-daapd.d
	dodoc AUTHORS ChangeLog CREDITS NEWS README TODO
}

pkg_postinst() {
	einfo
	elog "You have to configure your mt-daapd.conf following"
	elog "/etc/mt-daapd.conf.example file."
	einfo

	if use vorbis; then
		einfo
		elog "You need to edit you extensions list in /etc/mt-daapd.conf"
		elog "if you want your mt-daapd to serve ogg files."
		einfo
	fi

	einfo
	elog "If you want to start more than one ${PN} service, symlink"
	elog "/etc/init.d/${PN} to /etc/init.d/${PN}.<name>, and it will"
	elog "load the data from /etc/${PN}.d/<name>.conf."
	elog "Make sure that you have different cache directories for them."
	einfo
}