Subject: mailwrapper not building under Linux
To: mailwrapper pkgsrc maintainer <tech-pkg@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 10/24/2003 12:34:23
I am pretty sure I had mailwrapper installed on one of my Linux systems,
but today, it failed with:

gcc -O2  -Werror    -I. -Wall -c fparseln.c
In file included from fparseln.c:40:
util.h:40:24: sys/ttycom.h: No such file or directory
In file included from fparseln.c:40:
util.h:57: error: conflicting types for `login'
/usr/include/utmp.h:46: error: previous declaration of `login'
util.h:71: warning: `struct winsize' declared inside parameter list
util.h:71: warning: its scope is only this definition or declaration,
which is probably not what you want
util.h:73: warning: `struct winsize' declared inside parameter list
fparseln.c: In function `fparseln':
fparseln.c:112: warning: implicit declaration of function `fgetln'
fparseln.c:112: warning: assignment makes pointer from integer without a
cast

libnbcompat used to provide a util.h so I thought maybe I should use
libnbcompat.

Probably using libnbcompat is the solution for this.
libnbcompat provides FPARSELN_UNESCALL, fgetln, etc.

I got it to build code. (My patches below.) But then:

 bmake: don't know how to make /usr/share/groff/tmac/tmac.andoc. Stop

I am not sure about this share/mk/bsd.man.mk code that is doing this.

One workaround is to not use the bsd.prog.mk style Makefile for this
mailwrapper.

Also mailwrapper is very OS specific and dangerous: it replaces
/usr/bin/mailq, /usr/bin/newaliases, /usr/sbin/sendmail. And it assumes
real sendmail is /usr/libexec/sendmail/sendmail (at package deinstall).
Should this have some warning?

Should I submit a PR for this?

   Jeremy C. Reed
   http://bsd.reedmedia.net/

patch-ab
--- fparseln.c.orig	2003-10-24 12:13:20.000000000 -0700
+++ fparseln.c	2003-10-24 12:13:55.000000000 -0700
@@ -37,7 +37,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include <util.h>
+#include <nbcompat.h>

 static int isescaped __P((const char *, const char *, int));

patch-ac
--- mailwrapper.c.orig	2003-10-24 12:13:31.000000000 -0700
+++ mailwrapper.c	2003-10-24 12:13:43.000000000 -0700
@@ -36,7 +36,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <util.h>
+#include <nbcompat.h>

 #define _PATH_MAILERCONF	"/etc/mailer.conf"

? mail/mailwrapper/patches/patch-ab
? mail/mailwrapper/patches/patch-ac
Index: mail/mailwrapper/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/mail/mailwrapper/Makefile,v
retrieving revision 1.15
diff -b -u -r1.15 Makefile
--- mail/mailwrapper/Makefile	2003/07/17 21:46:25	1.15
+++ mail/mailwrapper/Makefile	2003/10/24 19:33:18
@@ -15,6 +15,8 @@
 NO_CONFIGURE=		yes
 MANCOMPRESSED_IF_MANZ=	yes

+MAKE_ENV+=		LDADD=${BUILDLINK_LDADD.libnbcompat}
+
 .if exists(/usr/sbin/mailwrapper)
 PKG_SKIP_REASON= "${PKGNAME} is part of your ${OPSYS} distribution"
 .endif
@@ -42,4 +44,5 @@
 	${LN} -fs ${PREFIX}/sbin/mailwrapper /usr/bin/newaliases
 	${LN} -fs ${PREFIX}/sbin/mailwrapper ${SENDMAIL}

+.include "../../pkgtools/libnbcompat/buildlink2.mk"
 .include "../../mk/bsd.pkg.mk"
Index: mail/mailwrapper/distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/mail/mailwrapper/distinfo,v
retrieving revision 1.2
diff -b -u -r1.2 distinfo
--- mail/mailwrapper/distinfo	2001/04/20 13:09:58	1.2
+++ mail/mailwrapper/distinfo	2003/10/24 19:33:18
@@ -3,3 +3,5 @@
 SHA1 (mailwrapper-19990412.tar.gz) = 8743e23bf2473557dda67684bae5b8879e5c8b45
 Size (mailwrapper-19990412.tar.gz) = 6129 bytes
 SHA1 (patch-aa) = b9378b4cb23180f8f4935e9c1ec032928a51de03
+SHA1 (patch-ab) = e3f3e3b0d7fea16bfd5ceb6f4a531a65957714be
+SHA1 (patch-ac) = f12057303407b5cbcdbe825188bd748419b3bdc6