summaryrefslogtreecommitdiff
blob: 2b518d615a9f87d70b6de85c75ddfe81a8b5cee1 (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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-irc/inspircd/inspircd-1.0.7.ebuild,v 1.1 2006/10/22 19:34:56 hansmi Exp $

inherit eutils toolchain-funcs multilib

IUSE="openssl gnutls"

DESCRIPTION="InspIRCd - The Modular C++ IRC Daemon"
HOMEPAGE="http://www.inspircd.org"
SRC_URI="mirror://sourceforge/${PN}/InspIRCd-${PV}.tar.bz2"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86"
RDEPEND="
	openssl? ( >=dev-libs/openssl-0.9.7d )
	gnutls? ( >=net-libs/gnutls-1.3.0 )"
DEPEND="${RDEPEND}"

S="${WORKDIR}/inspircd"

pkg_setup() {
	enewgroup inspircd
	enewuser inspircd -1 -1 -1 inspircd
}

# ============================================================
# inspircd_use_enable ()
#
# If something is in our USE flags, then append it to
# my_conf in the valid format as used by inspircd's configure
# script.
#
# $1 = pkg name
# $2 = inspircd variable
# $3 = inspircd value if yes
# $4 = inspircd value if no
inspircd_use_enable() {
	if use $1 ; then
		echo "$2=\"$3\"" >> .config.cache
	else
		echo "$2=\"$4\"" >> .config.cache
	fi
}

# Determines the appropriate value for the
# GCC34= configuration option.
inspircd-determine-gcc34() {
	if [[ $(gcc-major-version) -gt 3 ]] ; then
		echo "4"
	else
		if [[ $(gcc-minor-version) -lt 4 ]] ; then
			echo "3"
		else
			echo "4"
		fi
	fi
}

src_compile() {
	local myconf=""

	ewarn
	ewarn "Note that with InspIRCd 1.0.7 and later you can select"
	ewarn "which SSL engine you wish to use."
	ewarn
	ewarn "USE=ssl is no longer supported."
	ewarn
	ewarn "To select OpenSSL, put USE='openssl' in your useflags."
	ewarn "To select GnuTLS, put USE='gnutls' in your useflags."
	ewarn
	ewarn "You may compile in support for both SSL engines."
	ewarn "To do so, just do USE='openssl gnutls'."
	ewarn

	# Write a configuration file
	einfo "Building configuration parameters file."

	if use openssl; then
		einfo "Enabling OpenSSL SSL engine module."
	fi

	if use gnutls; then
		einfo "Enabling GnuTLS SSL engine module."
	fi

	cat << _EOF_ > .config.cache
CC="$(tc-getCXX)"
MAKEPROG="make $MFLAGS"
GCCVER="$(gcc-major-version)"
GCC34="$(inspircd-determine-gcc34)"
OPTIMISATI=""
FLAGS="$CXXFLAGS"
CONFIG_DIR="/etc/inspircd"
MODULE_DIR="/usr/$(get_libdir)/inspircd/modules"
BASE_DIR="/"
LIBRARY_DIR="/usr/$(get_libdir)/inspircd"
OSNAME="$(uname)"
BINARY_DIR="/usr/bin"
LDLIBS="-ldl -lstdc++"
CHANGE_COMPILER="n"
HAS_STRLCPY="false"
MAKEORDER="ircd mods"

# User defined parameters.
MAX_KICK="${INSPIRCD_KICKLEN:-255}"
MAX_IDENT="${INSPIRCD_IDENTLEN:-12}"
MAX_GECOS="${INSPIRCD_GECOSLEN:-128}"
MAX_CLIENT_T="${INSPIRCD_MAX_CLIENTS:-512}"
MAXI_MODES="${INSPIRCD_MAX_MODES:-20}"
MAX_CLIENT="${INSPIRCD_MAX_CLIENTS:-512}"
MAX_CHANNE="${INSPIRCD_MAX_CHANNELS:-20}"
NICK_LENGT="${INSPIRCD_NICKLEN:-31}"
MAX_OPERCH="${INSPIRCD_MAX_OPERCHANS:-60}"
MAX_AWAY="${INSPIRCD_AWAYLEN:-200}"
MAX_TOPIC="${INSPIRCD_TOPICLEN:-307}"
MAX_QUIT="${INSPIRCD_QUITLEN:-255}"
_EOF_

	inspircd_use_enable openssl HAS_OPENSSL y n
	inspircd_use_enable gnutls HAS_GNUTLS y n

	# build makefiles based on our configure params
	# Please note that it's not the autoconf configure script, thus
	# we don't use econf.
	./configure -update || die "configure failed"

	emake DESTDIR="${D}" || die "emake failed"
}

src_install() {
	# the inspircd buildsystem does not create these, it's configure script
	# does. so, we have to at this point to make sure they are there.
	dodir /usr/$(get_libdir)/inspircd
	dodir /usr/$(get_libdir)/inspircd/modules
	dodir /etc/inspircd
	dodir /usr/bin/ircd

	emake \
		LIBPATH="${D}/usr/$(get_libdir)/inspircd" \
		MODPATH="${D}/usr/$(get_libdir)/inspircd/modules" \
		CONPATH="${D}/etc/inspircd" \
		BINPATH="${D}/usr/bin" \
		BASE="${D}/usr/bin/inspircd.launcher" \
		install

	newinitd "${FILESDIR}"/init.d_inspircd inspircd
}

pkg_postinst() {
	chown -R inspircd:inspircd "${ROOT}"/etc/inspircd
	chmod 700 "${ROOT}"/etc/inspircd

	chown -R inspircd:inspircd "${ROOT}"/usr/$(get_libdir)/inspircd
	chmod -R 755 "${ROOT}"/usr/$(get_libdir)/inspircd

	chmod -R 755 /usr/bin/inspircd
}