summaryrefslogtreecommitdiff
blob: 453c77b590743ba89c4084422819016ce59ce4cd (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
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-mail/ezmlm-idx/ezmlm-idx-7.0.0.ebuild,v 1.3 2009/04/06 15:01:51 hollow Exp $

inherit qmail

DESCRIPTION="Simple yet powerful mailing list manager for qmail"
HOMEPAGE="http://www.ezmlm.org"
SRC_URI="http://www.ezmlm.org/archive/${PV}/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~hppa ~mips ~ppc ~sparc ~x86"
IUSE="mysql postgres"

DEPEND="mysql? ( virtual/mysql )
	postgres? ( virtual/postgresql-base )"
RDEPEND="${DEPEND}
	virtual/qmail"

pkg_setup() {
	if use mysql && use postgres; then
		die "cannot build mysql and pgsql support at the same time"
	fi
}

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

	echo /usr/bin > conf-bin
	echo /usr/lib/ezmlm > conf-lib
	echo /etc/ezmlm > conf-etc
	echo /usr/share/man > conf-man
	echo ${QMAIL_HOME} > conf-qmail

	echo $(tc-getCC) ${CFLAGS} -I/usr/include/{my,postgre}sql > conf-cc
	echo $(tc-getCC) ${CFLAGS} -Wl,-E > conf-ld

	# fix DESTDIR and skip cat man-pages
	sed -e "s:\(/install\) \(\"\`head\):\1 ${D}\2:" \
		-e "s:\(./install.*\) < MAN$:grep -v \:/cat MAN | \1:" \
		-e "s:\(\"\`head -n 1 conf-etc\`\"/default\):${D}\1:" \
		-i Makefile
}

src_compile() {
	emake it man || die "make failed"

	if use mysql; then
		emake mysql || die "make mysql failed"
	elif use postgres; then
		emake pgsql || die "make pgsql failed"
	fi
}

src_install () {
	dodir /usr/bin /usr/lib/ezmlm /etc/ezmlm /usr/share/man
	dobin ezmlm-{cgi,checksub}

	make DESTDIR="${D}" setup || die "make setup failed"
}