summaryrefslogtreecommitdiff
blob: d9219f353cec20f38ecc6d21b32c9997ec3cfed5 (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
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-irc/shadowircd/shadowircd-6.3.2.1.ebuild,v 1.2 2012/03/03 07:10:09 jdhore Exp $

EAPI=4

inherit eutils multilib user

DESCRIPTION="An IRCd based on charybdis that adds several useful features"
HOMEPAGE="http://shadowircd.net"
SRC_URI="http://shadowircd.net/downloads/${P}.tar.bz2"
LICENSE="GPL-2"

SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="debug +ipv6 largenet ssl zlib profile"

RDEPEND="ssl? ( dev-libs/openssl )
	zlib? ( sys-libs/zlib )"
DEPEND="${RDEPEND}
	virtual/yacc
	sys-devel/flex"

pkg_setup() {
	enewgroup ${PN}
	enewuser ${PN} -1 -1 "${EPREFIX}"/usr ${PN}
}

src_prepare() {
	# Fill the example configuration file with proper paths.
	sed -i \
		-e "s:path =.*modules:path = \"$(get_libdir)/${PN}/modules:g" \
		-e "s:etc/:../etc/${PN}/:g" \
		-e "s:logs/:../var/log/shadowircd/:g" \
		-e "s:test\.\(cert\|key\):ssl.\1:g" \
		doc/example.conf \
		doc/reference.conf \
		|| die
}

src_configure() {
	econf \
		ac_cv_prog_cc_g=no \
		$(use_enable debug assert soft) \
		$(use_enable debug iodebug) \
		$(use_enable ipv6) \
		$(use_enable !largenet small-net) \
		$(use_enable profile) \
		$(use_enable ssl openssl) \
		$(use_enable zlib) \
		--with-program-prefix=shadowircd- \
		\
		--enable-fhs-paths \
		--sysconfdir="${EPREFIX}"/etc/${PN} \
		--libdir="${EPREFIX}"/usr/"$(get_libdir)"/${PN} \
		--with-logdir="${EPREFIX}"/var/log/${PN} \
		--with-moduledir="${EPREFIX}"/usr/"$(get_libdir)"/${PN}/modules \
		--with-rundir="${EPREFIX}"/var/run
}

src_install() {
	default

	newinitd "${FILESDIR}"/${PN}.initd ${PN}
	newconfd "${FILESDIR}"/${PN}.confd ${PN}

	insinto etc/${PN}
	newins doc/reference.conf ircd.conf

	keepdir var/{lib,log}/${PN}

	# Ensure that if `make install' created /var/run/${PN}, we still
	# force the initscript to create that directory.
	rm -rf "${D}"/var/run || die

	# shadowircd needs writing to its state (bandb) and log directories
	fowners :shadowircd /var/{lib,log}/${PN}
	fperms 770 /var/{lib,log}/${PN}

	# ensure that shadowircd can access but not modify its configuration
	# while protecting it from others
	fowners :shadowircd /etc/${PN}{,/ircd.conf}
	fperms 750 /etc/${PN}
	fperms 640 /etc/${PN}/ircd.conf
}

pkg_postinst() {
	elog "All of the shadowircd binaries in PATH have been prefixed with"
	elog "'shadowircd-' to prevent file collisions."
}