summaryrefslogtreecommitdiff
blob: 6c22e69d7c127beaa4e6fe31ec4292a900c4cc46 (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
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit flag-o-matic toolchain-funcs

MY_P="${P}-BlameMichelson.src"

DESCRIPTION="A powerful text processing tool, mainly used for spam filtering"
HOMEPAGE="http://crm114.sourceforge.net/"
SRC_URI="http://crm114.sourceforge.net/tarballs/${MY_P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86 ~x86-fbsd"
IUSE="examples mew mimencode nls normalizemime static test"

RDEPEND="
	static? ( dev-libs/tre[static-libs] )
	!static? ( dev-libs/tre )
	mew? ( app-emacs/mew )
	mimencode? ( net-mail/metamail )
	normalizemime? ( mail-filter/normalizemime )"
DEPEND="${RDEPEND}
	test? ( sys-apps/miscfiles )"

S="${WORKDIR}"/${MY_P}

PATCHES=( "${FILESDIR}"/${P}-fix-makefile.patch )

src_prepare() {
	default

	if use mimencode; then
		sed \
			-e 's%#:mime_decoder: /mimencode -u/%:mime_decoder: /mimencode -u/%' \
			-e 's%:mime_decoder: /mewdecode/%#:mime_decoder: /mewdecode/%' \
			-i mailfilter.cf || die
	elif use normalizemime; then
		sed \
			-e 's%#:mime_decoder: /normalizemime/%:mime_decoder: /normalizemime/%' \
			-e 's%:mime_decoder: /mewdecode/%#:mime_decoder: /mewdecode/%' \
			-i mailfilter.cf || die
	fi
}

src_compile() {
	# Restore GNU89 inline semantics to
	# emit external symbols, bug 571062
	append-cflags -std=gnu89

	use static && append-ldflags -static -static-libgcc

	emake CC="$(tc-getCC)"
}

src_test() {
	emake megatest
}

src_install() {
	dobin crm114 cssdiff cssmerge cssutil osbf-util

	insinto /usr/share/${PN}
	doins *.crm *.cf *.mfp

	dodoc COLOPHON.txt CRM114_Mailfilter_HOWTO.txt FAQ.txt INTRO.txt QUICKREF.txt \
		CLASSIFY_DETAILS.txt inoc_passwd.txt KNOWNBUGS.txt THINGS_TO_DO.txt README

	if use examples; then
		docinto examples
		dodoc *.example
		docompress -x /usr/share/doc/${PF}/examples
	fi
}

pkg_postinst() {
	elog "The spam-filter CRM files are installed in ${EROOT%/}/usr/share/${PN}."
}