summaryrefslogtreecommitdiff
blob: 4bca779b047a538dd2f9ba40a976c8e3b892c8ff (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-irc/ircservices/ircservices-5.0.63.ebuild,v 1.1 2007/11/29 20:05:33 cla Exp $

inherit eutils fixheadtails flag-o-matic toolchain-funcs

DESCRIPTION="ChanServ, NickServ & MemoServ with support for several IRC daemons"
HOMEPAGE="http://www.ircservices.za.net/"
SRC_URI="http://www.ircservices.za.net/download/old/${P}.tar.gz
	ftp://ftp.esper.net/${PN}/old/${P}.tar.gz
	mirror://gentoo/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~ppc ~x86"
IUSE=""

DEPEND=""
RDEPEND=""

pkg_setup() {
	enewgroup ircservices
	enewuser ircservices -1 -1 -1 ircservices
	# this is needed, because old ebuilds added the user with ircservices:users
	usermod -g ircservices ircservices
}

src_unpack() {
	unpack ${A}
	cd "${S}"

	epatch "${FILESDIR}"/5.0.37-fPIC.patch
	epatch "${FILESDIR}"/5.0.53-fPIC-configure.patch

	ht_fix_file configure
	sed -i \
		-e "s/-m 750/-m 755/" \
		-e "s/-m 640/-m 644/" \
		configure
}

src_compile() {
	append-flags -fno-stack-protector
	# configure fails with -O higher than 2
	replace-flags "-O[3-9s]" "-O2"

	RUNGROUP="ircservices" \
	./configure \
		-cc "$(tc-getCC)" \
		-cflags "${CFLAGS}" \
		-bindest /usr/bin \
		-datdest /var/lib/ircservices \
		|| die "./configure failed"
	emake -j1 || die "make failed"
}

src_install() {
	dodir /usr/bin /{etc,usr/{$(get_libdir),share},var/lib}/ircservices || die "dodir failed"
	keepdir /var/log/ircservices || die "keepdir failed"

	make \
		BINDEST="${D}"/usr/bin \
		DATDEST="${D}"/var/lib/ircservices \
		install \
		|| die "make install failed"

	mv "${D}"/var/lib/ircservices/convert-db "${D}"/usr/bin/ircservices-convert-db || die "mv failed"

	# Now we move some files around to make it FHS conform
	mv "${D}"/var/lib/ircservices/example-ircservices.conf "${D}"/etc/ircservices/ircservices.conf || die "mv failed"
	dosym /etc/ircservices/ircservices.conf /var/lib/ircservices/ircservices.conf || die "dosym failed"

	mv "${D}"/var/lib/ircservices/example-modules.conf "${D}"/etc/ircservices/modules.conf || die "mv failed"
	dosym /etc/ircservices/modules.conf /var/lib/ircservices/modules.conf || die "dosym failed"

	mv "${D}"/var/lib/ircservices/modules "${D}"/usr/$(get_libdir)/ircservices || die "mv failed"
	dosym /usr/$(get_libdir)/ircservices/modules /var/lib/ircservices/modules || die "dosym failed"

	mv "${D}"/var/lib/ircservices/{helpfiles,languages} "${D}"/usr/share/ircservices  || die "mv failed"
	dosym /usr/share/ircservices/helpfiles /var/lib/ircservices/helpfiles || die "mv failed"
	dosym /usr/share/ircservices/languages /var/lib/ircservices/languages || die "dosym failed"

	fperms 750 /var/{lib,log}/ircservices /etc/ircservices
	fperms 640 /etc/ircservices/{ircservices,modules}.conf
	fowners ircservices:ircservices /var/{lib,log}/ircservices
	fowners root:ircservices /etc/ircservices{,/{ircservices,modules}.conf}

	newinitd "${FILESDIR}"/ircservices.init.d ircservices || die "newinitd failed"
	newconfd "${FILESDIR}"/ircservices.conf.d ircservices || die "newconfd failed"

	doman docs/ircservices.8 || die "doman failed"
	newman docs/convert-db.8 ircservices-convert-db.8 || die "newman failed"
	dohtml docs/*.html || die "dohtml failed"
	dodoc KnownBugs Changes README TODO WhatsNew || die "dodoc failed"
}