net-dialup/ppp: Drop pam USE description
[gentoo.git] / net-dialup / mgetty / mgetty-1.2.1-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 inherit flag-o-matic toolchain-funcs user
6
7 DESCRIPTION="fax and voice modem programs"
8 HOMEPAGE="http://mgetty.greenie.net/"
9 SRC_URI="ftp://mgetty.greenie.net/pub/mgetty/source/1.2/${P}.tar.gz"
10
11 DEPEND="
12         dev-lang/perl
13         sys-apps/groff
14         sys-apps/texinfo
15         virtual/awk
16         fax? (
17                 !net-misc/efax
18                 !net-misc/hylafax
19         )
20 "
21 RDEPEND="${DEPEND}
22         fax? ( media-libs/netpbm app-text/ghostscript-gpl )
23 "
24
25 SLOT="0"
26 LICENSE="GPL-2"
27 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
28 IUSE="+fax fidonet split-usr"
29
30 pkg_setup() {
31         enewgroup fax
32         enewuser fax -1 -1 /dev/null fax
33 }
34
35 PATCHES=(
36         "${FILESDIR}"/${PN}-1.1.36-callback.patch
37         "${FILESDIR}"/${PN}-1.1.36-tmpfile.patch
38         "${FILESDIR}"/${PN}-1.1.37-qa-fixes.patch
39         "${FILESDIR}"/${PN}-1.2.1-Lucent.c.patch
40         "${FILESDIR}"/${PN}-1.2.1-gentoo.patch
41 )
42
43 src_prepare() {
44         default
45
46         chmod +x mkidirs || die
47
48         # don't install fax related files - bug #195467
49         use fax || eapply "${FILESDIR}/${PN}-1.1.37-nofax.patch"
50
51         sed -i -e 's:/usr/local/lib/mgetty+sendfax:/etc/mgetty+sendfax:' faxrunq.config || die 'changing mgetty config dir failed'
52         sed -i -e 's:/usr/local/bin/g3cat:/usr/bin/g3cat:' faxrunq.config fax/faxspool.rules || die 'changing g3cat path failed'
53
54         sed -e "/^doc-all:/s/mgetty.asc mgetty.info mgetty.dvi mgetty.ps/mgetty.info/" \
55                 -i doc/Makefile || die 'first sed on doc/Makefile failed'
56
57         sed -i \
58                 -e 's:^CC=:CC?=:g' \
59                 -e 's:^CFLAGS=:CFLAGS?=:g' \
60                 {,*/}Makefile || die
61         sed -i \
62                 -e 's:^AR=:AR?=:g' \
63                 -e 's:^CFLAGS=:CFLAGS+= -I..:g' \
64                 -e 's:^RANLIB=:RANLIB?=:g' \
65                 */Makefile || die
66 }
67
68 src_configure() {
69         tc-export AR CC RANLIB
70         use fidonet && append-cppflags "-DFIDO"
71         append-cppflags "-DAUTO_PPP"
72
73         sed -e 's:var/log/mgetty:var/log/mgetty/mgetty:' \
74                 -e 's:var/log/sendfax:var/log/mgetty/sendfax:' \
75                 -e 's:\/\* \(\#define CNDFILE "dialin.config"\) \*\/:\1:' \
76                 -e 's:\(\#define FAX_NOTIFY_PROGRAM\).*:\1 "/etc/mgetty+sendfax/new_fax":' \
77                 policy.h-dist > policy.h || die 'creating policy.h failed'
78
79         sed -i \
80                 -e "s/\$(CFLAGS) -o newslock/${CFLAGS} ${LDFLAGS} -Wall -o newslock/" \
81                 -e "s/\$(LDLAGS)/${LDFLAGS}/" \
82                 {,fax/}Makefile || die
83 }
84
85 src_compile() {
86         local target
87         for target in mgetty sedscript all vgetty;do
88                 VARTEXFONTS="${T}"/fonts emake prefix=/usr \
89                         CONFDIR=/etc/mgetty+sendfax \
90                         CFLAGS="${CFLAGS} ${CPPFLAGS}" \
91                         LDFLAGS="${LDFLAGS}" \
92                         ${target}
93         done
94 }
95
96 src_install() {
97         # parallelization issue: vgetty-install target fails if install target
98         #                        isn't finished
99         local target
100         for target in install "vgetty-install install-callback"; do
101                 emake prefix="${D}/usr" \
102                         INFODIR="${D}/usr/share/info" \
103                         CONFDIR="${D}/etc/mgetty+sendfax" \
104                         MAN1DIR="${D}/usr/share/man/man1" \
105                         MAN4DIR="${D}/usr/share/man/man4" \
106                         MAN5DIR="${D}/usr/share/man/man5" \
107                         MAN8DIR="${D}/usr/share/man/man8" \
108                         SBINDIR="${D}/usr/sbin" \
109                         BINDIR="${D}/usr/bin" \
110                         VOICE_DIR="${D}/var/spool/voice" \
111                         PHONE_GROUP=fax \
112                         PHONE_PERMS=755 \
113                         spool="${D}/var/spool" \
114                         ${target}
115         done
116
117         keepdir /var/log/mgetty
118
119         #Install mgetty into /sbin (#119078)
120         if use split-usr; then
121                 dodir /sbin
122                 mv "${D}"/usr/sbin/mgetty "${D}"/sbin || die
123                 dosym ../../sbin/mgetty /usr/sbin/mgetty
124         fi
125
126         #Don't install ct (#106337)
127         rm "${D}"/usr/bin/ct || die "failed to remove useless ct program"
128
129         dodoc BUGS ChangeLog README.1st Recommend THANKS TODO \
130                 doc/*.txt doc/modems.db
131         doinfo doc/mgetty.info
132
133         docinto vgetty
134         dodoc voice/{Readme,Announce,ChangeLog,Credits}
135
136         docinto vgetty/doc
137         dodoc voice/doc/*
138
139         if use fax; then
140                 mv samples/new_fax.all samples_new_fax.all || die "move failed."
141                 docinto samples
142                 dodoc samples/*
143
144                 docinto samples/new_fax
145                 dodoc samples_new_fax.all/*
146         fi
147
148         if ! use fax; then
149                 insinto /usr/share/${PN}/frontends
150                 doins -r frontends/{voice,network}
151         else
152                 insinto /usr/share/${PN}
153                 doins -r frontends
154         fi
155         insinto /usr/share/${PN}
156         doins -r patches
157         insinto /usr/share/${PN}/voice
158         doins -r voice/{contrib,Perl,scripts}
159
160         diropts -m 0750 -o fax -g fax
161         dodir /var/spool/voice
162         keepdir /var/spool/voice/incoming
163         keepdir /var/spool/voice/messages
164         if use fax; then
165                 dodir /var/spool/fax
166                 dodir /var/spool/fax/outgoing
167                 keepdir /var/spool/fax/outgoing/locks
168                 keepdir /var/spool/fax/incoming
169         fi
170 }
171
172 pkg_postinst() {
173         elog "Users who wish to use the fax or voicemail capabilities must be members"
174         elog "of the group fax in order to access files"
175         elog
176         elog "If you want to grab voice messages from a remote location, you must save"
177         elog "the password in /var/spool/voice/.code file"
178 }