summaryrefslogtreecommitdiff
blob: 6cea5817a370e2b58a8fe8ddad36c45b26933fc8 (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
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/capi4hylafax/capi4hylafax-01.02.03.13.ebuild,v 1.1 2005/08/11 19:48:28 sbriesen Exp $

inherit eutils versionator

MY_PV="$(get_version_component_range 1-3)"
MY_PP="$(get_version_component_range 4)"
MY_P="${PN}-${MY_PV}"

DESCRIPTION="CAPI4HylaFAX - send/receive faxes via CAPI and AVM Fritz!Cards."
SRC_URI="http://ftp.debian.org/debian/pool/main/c/capi4hylafax/${MY_P/-/_}.orig.tar.gz
		http://ftp.debian.org/debian/pool/main/c/capi4hylafax/${MY_P/-/_}-${MY_PP}.diff.gz"
HOMEPAGE="http://packages.qa.debian.org/c/capi4hylafax.html"

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

IUSE="unicode"

SLOT="0"
LICENSE="GPL-2"
KEYWORDS="~ppc ~x86"

DEPEND="net-dialup/capi4k-utils
	media-libs/tiff"

RDEPEND="${DEPEND}
	dev-util/dialog"

src_unpack() {
	unpack ${A}
	mv "${S}.orig" "${S}"
	cd "${S}"

	# apply debian patches + update configs
	epatch "${WORKDIR}/${MY_P/-/_}-${MY_PP}.diff"
	libtoolize --copy --force

	# fix location of fax spool
	for i in * debian/* src/scripts/setupconffile; do
		[ -f "${i}" ] && sed -i -e "s:/var/spool/hylafax:/var/spool/fax:" "${i}"
	done

	# fix location of config file
	sed -i -e "s:/etc/hylafax:/var/spool/fax/etc:" src/scripts/setupconffile

	# patch man pages
	sed -i -e "s:/usr/share/doc/capi4hylafax/:/usr/share/doc/${PF}/html/:g" \
		-e "s:c2send:c2faxsend:g" -e "s:c2recv:c2faxrecv:g" \
		-e "s:CAPI4HYLAFAXCONFIG \"1\":C2FAXADDMODEM \"8\":g" \
		-e "s:capi4hylafaxconfig:c2faxaddmodem:g" debian/*.1
	cp -f debian/capi4hylafaxconfig.1 debian/c2faxaddmodem.8

	# if specified, convert all relevant files from latin1 to UTF-8
	if useq unicode; then
		for i in config.faxCAPI; do
			einfo "Converting ${i} to UTF-8"
			iconv -f latin1 -t utf8 -o "${i}~" "${i}" && mv -f "${i}~" "${i}" || rm -f "${i}~"
		done
	fi

}

src_compile() {
	econf --with-hylafax-spooldir=/var/spool/fax || die "econf failed"
	emake || die "emake failed"
}

src_install() {
	make DESTDIR="${D}" install || die "make install failed"

	# install setup script
	newsbin src/scripts/setupconffile c2faxaddmodem

	# install sample config
	insinto /var/spool/fax/etc
	doins config.faxCAPI

	# install docs
	dodoc AUTHORS ChangeLog Readme_src
	newdoc debian/changelog ChangeLog.debian
	dohtml README.html LIESMICH.html

	# install man pages
	doman debian/c2fax*.[18]

	# install examples
	docinto examples
	dodoc debian/faxsend sample_* fritz_pic.tif GenerateFileMail.pl

	# finally install init-script
	doinitd "${FILESDIR}/capi4hylafax"
}

pkg_postinst() {
	einfo "To use CAPI4HylaFAX:"
	einfo "Make sure that your isdn/capi devices are owned by"
	einfo "the \"uucp\" user (see udev or devfsd config)."
	einfo "Modify /var/spool/fax/etc/config.faxCAPI"
	einfo "to suit your system."
	einfo
	einfo "If you want to use capi4hylafax together with"
	einfo "hylafax, then please emerge net-misc/hylafax"
	einfo
	einfo "Then append the following line to your hylafax"
	einfo "config file (/var/spool/fax/etc/config):"
	einfo "SendFaxCmd:             /usr/bin/c2faxsend"
}