From ee782a4ff3f150eddc0bbb0b68857e42c948c8bc Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Mon, 13 Feb 2006 14:41:51 +0000 Subject: [PATCH] - Unbreak [1] - Rework Makefile Noticed by: Marko Lerota [1] --- mail/qmail-contrib/Makefile | 49 +++-- .../files/extra-patch-newaliases | 188 +++++++----------- mail/qmail-contrib/pkg-plist | 10 +- 3 files changed, 103 insertions(+), 144 deletions(-) diff --git a/mail/qmail-contrib/Makefile b/mail/qmail-contrib/Makefile index 97d77813f0a1..d3abbf5cfaf0 100644 --- a/mail/qmail-contrib/Makefile +++ b/mail/qmail-contrib/Makefile @@ -19,15 +19,13 @@ COMMENT= Contributed programs for qmail USE_QMAIL_RUN= yes -NO_PACKAGE= Unsure of djb\'s license +NO_PACKAGE= Unsure of djb's license ALL_TARGET= it INSTALL_TARGET= setup -MAN1= dot-forward.1 fastforward.1 printforward.1 setforward.1 -MAN1+= newaliases.1 printmaillist.1 setmaillist.1 newinclude.1 - -PLIST_SUB= DOCDIR=${DOCDIR} +MAN1= dot-forward.1 fastforward.1 printforward.1 setforward.1 \ + newaliases.1 printmaillist.1 setmaillist.1 newinclude.1 PREFIX?= ${QMAIL_PREFIX} @@ -40,37 +38,38 @@ WRKDF= ${WRKDIR}/dot-forward-${DF_VER} NO_MTREE= yes -USE_REINPLACE= yes +PORTDOCS= ALIASES .include -.if (${PREFIX} == ${LOCALBASE}) -DOCDIR= share/doc/qmail -.else -DOCDIR= doc +.if (${PREFIX} != ${LOCALBASE}) +DOCSDIR= doc .endif pre-patch: - @cd ${WRKFF} \ - && ${PATCH} -s <${PATCHDIR}/extra-patch-newaliases + @${PATCH} -d ${WRKFF} -s <${PATCHDIR}/extra-patch-newaliases post-patch: - @${REINPLACE_CMD} -e "s|.var.qmail|${QMAIL_DIR}|" ${WRKFF}/conf-qmail - @${REINPLACE_CMD} -e '/cat/d' ${WRKFF}/hier.c - @${REINPLACE_CMD} -e "s|-O2|${CFLAGS}|" ${WRKDF}/conf-cc - @${REINPLACE_CMD} -e "s|.var.qmail|${QMAIL_DIR}|" ${WRKDF}/conf-qmail - @${REINPLACE_CMD} -e '/cat/d' ${WRKDF}/hier.c + @${REINPLACE_CMD} -e "s|.var.qmail|${QMAIL_PREFIX}|" \ + ${WRKFF}/conf-qmail \ + ${WRKDF}/conf-qmail + @${REINPLACE_CMD} -e '/cat/d; s|doc/fastforward|${DOCSDIR}|g' \ + ${WRKFF}/hier.c \ + ${WRKDF}/hier.c + @${REINPLACE_CMD} -e "s|-O2|${CFLAGS}|" \ + ${WRKFF}/conf-cc \ + ${WRKDF}/conf-cc +.if defined(NOPORTDOCS) + @${REINPLACE_CMD} -E 's|^(.*${DOCSDIR})|// \1|g' \ + ${WRKFF}/hier.c +.endif do-build: - @cd ${WRKDIR}/dot-forward-${DF_VER} \ - && make ${ALL_TARGET} - @cd ${WRKDIR}/fastforward-${FF_VER} \ - && make ${ALL_TARGET} + @${MAKE} -C ${WRKDIR}/dot-forward-${DF_VER} ${ALL_TARGET} + @${MAKE} -C ${WRKDIR}/fastforward-${FF_VER} ${ALL_TARGET} do-install: - @cd ${WRKDIR}/dot-forward-${DF_VER} \ - && make ${INSTALL_TARGET} - @cd ${WRKDIR}/fastforward-${FF_VER} \ - && make ${INSTALL_TARGET} + @${MAKE} -C ${WRKDIR}/dot-forward-${DF_VER} ${INSTALL_TARGET} + @${MAKE} -C ${WRKDIR}/fastforward-${FF_VER} ${INSTALL_TARGET} .include diff --git a/mail/qmail-contrib/files/extra-patch-newaliases b/mail/qmail-contrib/files/extra-patch-newaliases index 58a5341f7077..4098f42cd45c 100644 --- a/mail/qmail-contrib/files/extra-patch-newaliases +++ b/mail/qmail-contrib/files/extra-patch-newaliases @@ -1,113 +1,75 @@ -*** newaliases.c.orig Fri Apr 24 17:34:58 1998 ---- newaliases.c Fri Apr 24 17:38:32 1998 -*************** -*** 12,17 **** ---- 12,21 ---- - - #define FATAL "newaliases: fatal: " - -+ stralloc fnsrc = {0}; -+ stralloc fncdb = {0}; -+ stralloc fntmp = {0}; -+ - void nomem() - { - strerr_die2x(111,FATAL,"out of memory"); -*************** -*** 26,36 **** - } - void writeerr() - { -! strerr_die2sys(111,FATAL,"unable to write to /etc/aliases.tmp: "); - } - void readerr() - { -! strerr_die2sys(111,FATAL,"unable to read /etc/aliases: "); - } - void die_control() - { ---- 30,40 ---- - } - void writeerr() - { -! strerr_die4sys(111,FATAL,"unable to write to ",fntmp.s,": "); - } - void readerr() - { -! strerr_die4sys(111,FATAL,"unable to read ",fnsrc.s,": "); - } - void die_control() - { -*************** -*** 270,288 **** - if (cdbmss_add(&cdbmss,key.s,key.len,instr.s,instr.len) == -1) writeerr(); - } - -! void main() - { - int fd; - - umask(033); - readcontrols(); - -! fd = open_read("/etc/aliases"); - if (fd == -1) readerr(); - substdio_fdbuf(&ssin,read,fd,inbuf,sizeof inbuf); - -! fd = open_trunc("/etc/aliases.tmp"); -! if (fd == -1) strerr_die2sys(111,FATAL,"unable to create /etc/aliases.tmp: "); - if (cdbmss_start(&cdbmss,fd) == -1) writeerr(); - - if (!stralloc_copys(&line,"")) nomem(); ---- 274,305 ---- - if (cdbmss_add(&cdbmss,key.s,key.len,instr.s,instr.len) == -1) writeerr(); - } - -! void main(argc,argv) -! int argc; -! char **argv; - { - int fd; - - umask(033); - readcontrols(); - -! if (!stralloc_copys(&fnsrc,argv[1] ? argv[1] : "/etc/aliases")) nomem(); -! if (!stralloc_0(&fnsrc)) nomem(); -! -! if (!stralloc_copys(&fncdb,fnsrc.s)) nomem(); -! if (!stralloc_cats(&fncdb,".cdb")) nomem(); -! if (!stralloc_0(&fncdb)) nomem(); -! -! if (!stralloc_copys(&fntmp,fnsrc.s)) nomem(); -! if (!stralloc_cats(&fntmp,".tmp")) nomem(); -! if (!stralloc_0(&fntmp)) nomem(); -! -! fd = open_read(fnsrc.s); - if (fd == -1) readerr(); - substdio_fdbuf(&ssin,read,fd,inbuf,sizeof inbuf); - -! fd = open_trunc(fntmp.s); -! if (fd == -1) strerr_die4sys(111,FATAL,"unable to create ",fntmp.s,": "); - if (cdbmss_start(&cdbmss,fd) == -1) writeerr(); - - if (!stralloc_copys(&line,"")) nomem(); -*************** -*** 314,321 **** - if (fsync(fd) == -1) writeerr(); - if (close(fd) == -1) writeerr(); /* NFS stupidity */ - -! if (rename("/etc/aliases.tmp","/etc/aliases.cdb") == -1) -! strerr_die2sys(111,FATAL,"unable to move /etc/aliases.tmp to /etc/aliases.cdb: "); - - _exit(0); - } ---- 331,338 ---- - if (fsync(fd) == -1) writeerr(); - if (close(fd) == -1) writeerr(); /* NFS stupidity */ - -! if (rename(fntmp.s,fncdb.s) == -1) -! strerr_die6sys(111,FATAL,"unable to move ",fntmp.s," to ",fncdb.s,": "); - - _exit(0); - } +--- newaliases.c.orig Tue May 19 13:25:42 1998 ++++ newaliases.c Mon Feb 13 09:53:58 2006 +@@ -12,6 +12,10 @@ + + #define FATAL "newaliases: fatal: " + ++stralloc fnsrc = {0}; ++stralloc fncdb = {0}; ++stralloc fntmp = {0}; ++ + void nomem() + { + strerr_die2x(111,FATAL,"out of memory"); +@@ -26,11 +30,11 @@ + } + void writeerr() + { +- strerr_die2sys(111,FATAL,"unable to write to /etc/aliases.tmp: "); ++ strerr_die4sys(111,FATAL,"unable to write to ",fntmp.s,": "); + } + void readerr() + { +- strerr_die2sys(111,FATAL,"unable to read /etc/aliases: "); ++ strerr_die4sys(111,FATAL,"unable to read ",fnsrc.s,": "); + } + void die_control() + { +@@ -270,19 +274,32 @@ + if (cdbmss_add(&cdbmss,key.s,key.len,instr.s,instr.len) == -1) writeerr(); + } + +-void main() ++void main(argc,argv) ++int argc; ++char **argv; + { + int fd; + + umask(033); + readcontrols(); + +- fd = open_read("/etc/aliases"); ++ if (!stralloc_copys(&fnsrc,argv[1] ? argv[1] : "/etc/aliases")) nomem(); ++ if (!stralloc_0(&fnsrc)) nomem(); ++ ++ if (!stralloc_copys(&fncdb,fnsrc.s)) nomem(); ++ if (!stralloc_cats(&fncdb,".cdb")) nomem(); ++ if (!stralloc_0(&fncdb)) nomem(); ++ ++ if (!stralloc_copys(&fntmp,fnsrc.s)) nomem(); ++ if (!stralloc_cats(&fntmp,".tmp")) nomem(); ++ if (!stralloc_0(&fntmp)) nomem(); ++ ++ fd = open_read(fnsrc.s); + if (fd == -1) readerr(); + substdio_fdbuf(&ssin,read,fd,inbuf,sizeof inbuf); + +- fd = open_trunc("/etc/aliases.tmp"); +- if (fd == -1) strerr_die2sys(111,FATAL,"unable to create /etc/aliases.tmp: "); ++ fd = open_trunc(fntmp.s); ++ if (fd == -1) strerr_die4sys(111,FATAL,"unable to create ",fntmp.s,": "); + if (cdbmss_start(&cdbmss,fd) == -1) writeerr(); + + if (!stralloc_copys(&line,"")) nomem(); +@@ -314,8 +331,8 @@ + if (fsync(fd) == -1) writeerr(); + if (close(fd) == -1) writeerr(); /* NFS stupidity */ + +- if (rename("/etc/aliases.tmp","/etc/aliases.cdb") == -1) +- strerr_die2sys(111,FATAL,"unable to move /etc/aliases.tmp to /etc/aliases.cdb: "); ++ if (rename(fntmp.s,fncdb.s) == -1) ++ strerr_die6sys(111,FATAL,"unable to move ",fntmp.s," to ",fncdb.s,": "); + + _exit(0); + } diff --git a/mail/qmail-contrib/pkg-plist b/mail/qmail-contrib/pkg-plist index db4bfe010005..c227e2e6ec30 100644 --- a/mail/qmail-contrib/pkg-plist +++ b/mail/qmail-contrib/pkg-plist @@ -1,10 +1,8 @@ -doc/fastforward/ALIASES bin/dot-forward bin/fastforward -bin/printforward -bin/setforward bin/newaliases -bin/printmaillist -bin/setmaillist bin/newinclude -@dirrm doc/fastforward +bin/printforward +bin/printmaillist +bin/setforward +bin/setmaillist