summaryrefslogtreecommitdiff
blob: ef57ee2b68937c17d1787a852db89125231ba3da (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
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-dialup/mgetty/mgetty-1.1.31-r1.ebuild,v 1.1 2005/02/10 13:14:36 tove Exp $

inherit toolchain-funcs flag-o-matic eutils

DESCRIPTION="Fax and Voice modem programs."
SRC_URI="ftp://alpha.greenie.net/pub/mgetty/source/1.1/${PN}${PV}-Jul24.tar.gz"
HOMEPAGE="http://alpha.greenie.net/mgetty/"

RDEPEND="virtual/libc"

DEPEND="${RDEPEND}
	>=sys-apps/sed-4*
	doc? ( virtual/tetex )
	sys-apps/gawk
	sys-apps/groff
	dev-lang/perl
	sys-apps/texinfo"

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

pkg_setup() {
	enewgroup fax
	enewgroup modem
	enewuser fax -1 /bin/false /dev/null fax
}

src_unpack() {
	unpack ${A}
	cd ${S}
	epatch ${FILESDIR}/mgetty-${PV}-r1-gentoo.diff
	# fix deprecate warnings
	epatch ${FILESDIR}/mgetty-${PV}-logfile.c.diff
	# add callback install to Makefile
	epatch ${FILESDIR}/mgetty-${PV}-callback.diff
	# Lucent modem CallerID patch - bug #80366
	epatch ${FILESDIR}/Lucent.c.patch

	#Avoid "is setXid, dynamically linked and using lazy bindings" QA notices 
	append-ldflags "-Wl,-z,now"

	sed -i 's: \$(CFLAGS) -o faxq-helper faxq-helper.o: $(LDLAGS) -Wl,-z,now -o faxq-helper faxq-helper.o:' ${S}/fax/Makefile

	sed -e 's:var/log/mgetty:var/log/mgetty/mgetty:' \
		-e 's:var/log/sendfax:var/log/mgetty/sendfax:' \
		-e 's:\/\* \(\#define CNDFILE "dialin.config"\) \*\/:\1:' \
		-e 's:\(\#define FAX_NOTIFY_PROGRAM\).*:\1 "/etc/mgetty+sendfax/new_fax":' \
		${S}/policy.h-dist > ${S}/policy.h
	sed -i -e "s:phone_group phone:phone_group fax:g" ${S}/voice/voice.conf-dist

	# bug 44231 and remove move warning
	sed -e 's:ECHO="echo":ECHO="echo -e":' \
		-e "/mv -f \$(SBINDIR)/d" \
		-i ${S}/Makefile

	# update patch
	sed -e 's/-f \$(VOICE_DIR)\//-f \/var\/spool\/voice\//' \
		-i ${S}/voice/Makefile

	sed -e "/^doc-all:/s/mgetty.asc mgetty.info mgetty.dvi mgetty.ps/mgetty.info/" \
		-i ${S}/doc/Makefile
	if use doc; then
		sed -e "s:dvips -o mgetty.ps:dvips -M -o mgetty.ps:" \
			-e "s/^doc-all:/doc-all: mgetty.ps/" \
			-i ${S}/doc/Makefile
	fi
}

src_compile() {
	append-flags "-DAUTO_PPP"

	# parallel make fix later - 'sedscript' issue
	make prefix=/usr \
		CC="$(tc-getCC)" \
		CONFDIR=/etc/mgetty+sendfax \
		CFLAGS="${CFLAGS}" \
		LDFLAGS="${LDFLAGS}" \
		all vgetty || die "make failed."
}

src_install () {
	dodir /var/spool
	dodir /var/log/mgetty
	dodir /usr/share/info

	make prefix=${D}/usr \
		INFODIR=${D}/usr/share/info \
		CONFDIR=${D}/etc/mgetty+sendfax \
		MAN1DIR=${D}/usr/share/man/man1 \
		MAN4DIR=${D}/usr/share/man/man4 \
		MAN5DIR=${D}/usr/share/man/man5 \
		MAN8DIR=${D}/usr/share/man/man8 \
		SBINDIR=${D}/usr/sbin \
		BINDIR=${D}/usr/bin \
		VOICE_DIR=${D}/var/spool/voice \
		PHONE_GROUP=fax \
		PHONE_PERMS=755 \
		spool=${D}/var/spool \
		install vgetty-install install-callback || die

	cd ${S}
	dodoc BUGS ChangeLog README.1st Recommend THANKS TODO \
		doc/*.txt doc/modems.db || die "dodoc failed."
	doinfo doc/mgetty.info || die "doinfo failed."

	docinto vgetty
	dodoc voice/{Readme,Announce,ChangeLog,Credits} || die "vgetty voice failed."

	if use doc; then
		dodoc doc/mgetty.ps || die "mgetty.ps failed"
	fi

	docinto vgetty/doc
	dodoc voice/doc/*

	mv samples/new_fax.all samples_new_fax.all || die "move failed."
	docinto samples
	dodoc samples/*

	docinto samples/new_fax
	dodoc samples_new_fax.all/*

	#generate missing fonts if any.
	if [ -f ${S}/doc/missfont.log ] ; then
		echo '#!/bin/bash' >genfonts.sh
		cat missfont.log >>genfonts.sh
		chmod +x genfonts.sh
		dodoc genfonts.sh
	fi
}

pkg_postinst() {
	#generate missing fonts if any.
	if [ -x {$ROOT}/usr/share/doc/${PF}/genfonts.sh ]; then
		{$ROOT}/usr/share/doc/${PF}/genfonts.sh
	fi

	if [ ! -d ${ROOT}/var/spool/fax/incoming ]; then
		mkdir -p ${ROOT}/var/spool/fax/incoming
	fi
	if [ ! -d ${ROOT}/var/spool/fax/outgoing/locks ]; then
		mkdir -p ${ROOT}/var/spool/fax/outgoing/locks
	fi
}