Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Sep 2020 12:24:21 +0000 (UTC)
From:      =?UTF-8?Q?Stefan_E=c3=9fer?= <se@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r549719 - in head/mail/mboxgrep: . files
Message-ID:  <202009231224.08NCOLg2078359@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: se
Date: Wed Sep 23 12:24:21 2020
New Revision: 549719
URL: https://svnweb.freebsd.org/changeset/ports/549719

Log:
  Fix build with -fno-common
  
  Since files that are patched in legacy patch files are affected, all
  patches are regenerated with make makepatch.
  
  In order to have makepatch operate on only the patched sources without the
  result of RE_INPLACE being integrated into the patch files, move the
  in-place editing of sources from post-patch to pre-build.

Added:
  head/mail/mboxgrep/files/patch-src_Makefile.in
     - copied, changed from r549718, head/mail/mboxgrep/files/patch-noredundancy
  head/mail/mboxgrep/files/patch-src_main.c   (contents, props changed)
  head/mail/mboxgrep/files/patch-src_mboxgrep.h   (contents, props changed)
  head/mail/mboxgrep/files/patch-src_scan.c   (contents, props changed)
  head/mail/mboxgrep/files/patch-src_scan.h   (contents, props changed)
Deleted:
  head/mail/mboxgrep/files/patch-md5
  head/mail/mboxgrep/files/patch-noredundancy
Modified:
  head/mail/mboxgrep/Makefile

Modified: head/mail/mboxgrep/Makefile
==============================================================================
--- head/mail/mboxgrep/Makefile	Wed Sep 23 12:23:14 2020	(r549718)
+++ head/mail/mboxgrep/Makefile	Wed Sep 23 12:24:21 2020	(r549719)
@@ -3,7 +3,7 @@
 
 PORTNAME=	mboxgrep
 PORTVERSION=	0.7.9
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	mail
 MASTER_SITES=	SF
 
@@ -29,7 +29,7 @@ OPTIONS_DEFINE=	DOCS PCRE
 
 PCRE_LIB_DEPENDS=	libpcre.so:devel/pcre
 
-post-patch:
+pre-build:
 	@${REINPLACE_CMD} -e 's,void \*tmpp,FILE \*tmpp,g' ${WRKSRC}/src/main.c
 	@${REINPLACE_CMD} -e 's,$$(prefix),$$(DESTDIR)$$(prefix),g' \
 		-e 's,$$(mandir),$$(DESTDIR)$$(mandir),g' \

Copied and modified: head/mail/mboxgrep/files/patch-src_Makefile.in (from r549718, head/mail/mboxgrep/files/patch-noredundancy)
==============================================================================
--- head/mail/mboxgrep/files/patch-noredundancy	Wed Sep 23 12:23:14 2020	(r549718, copy source)
+++ head/mail/mboxgrep/files/patch-src_Makefile.in	Wed Sep 23 12:24:21 2020	(r549719)
@@ -1,6 +1,7 @@
---- src/Makefile.in	Sun Mar 30 18:07:10 2003
-+++ src/Makefile.in	Tue Feb 27 16:50:18 2007
-@@ -22,10 +22,10 @@
+--- src/Makefile.in.orig	2003-03-30 23:07:10 UTC
++++ src/Makefile.in
+@@ -21,12 +21,12 @@ srcdir		=	@srcdir@
+ 
  CC		= 	@CC@
  OBJS		=	info.o main.o mh.o scan.o maildir.o mbox.o misc.o \
 -			wrap.o getopt.o getopt1.o md5.o
@@ -14,3 +15,14 @@
 +LIBS		=	@LIBS@ -lcrypto
  INSTALL		=	@INSTALL@
  prefix		=	@prefix@
+ SHELL 		= 	/bin/sh
+@@ -51,7 +51,7 @@ distclean:
+ 
+ .PHONY: install
+ install: mboxgrep
+-	$(INSTALL) -d $(prefix)/bin
+-	$(INSTALL) -s $(TARGET) $(prefix)/bin
++	$(INSTALL) -d $(DESTDIR)$(prefix)/bin
++	$(INSTALL) -s $(TARGET) $(DESTDIR)$(prefix)/bin
+ 
+ .NOEXPORT:

Added: head/mail/mboxgrep/files/patch-src_main.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/mail/mboxgrep/files/patch-src_main.c	Wed Sep 23 12:24:21 2020	(r549719)
@@ -0,0 +1,23 @@
+--- src/main.c.orig	2003-08-24 19:23:50 UTC
++++ src/main.c
+@@ -55,8 +55,9 @@ pcre_extra *hints;
+ char *boxname, *outboxname, *pipecmd, *tmpfilename;
+ int maildir_count = 0;
+ int count = 0;
+-void *tmpp;
++FILE *tmpp;
+ checksum_t *cs;
++option_t config;
+ 
+ int
+ main (int argc, char **argv)
+@@ -238,8 +239,7 @@ main (int argc, char **argv)
+       config.pid = (int) getpid ();
+     }
+ 
+-  cs = (checksum_t *) xmalloc (sizeof (checksum_t));
+-  cs->md5 = (char **) xcalloc (1, sizeof (char **));
++  cs = xmalloc (sizeof (checksum_t));
+   cs->n = 0;
+ 
+   if (optind < argc && ! haveregex)

Added: head/mail/mboxgrep/files/patch-src_mboxgrep.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/mail/mboxgrep/files/patch-src_mboxgrep.h	Wed Sep 23 12:24:21 2020	(r549719)
@@ -0,0 +1,35 @@
+--- src/mboxgrep.h.orig	2003-04-06 21:01:49 UTC
++++ src/mboxgrep.h
+@@ -28,6 +28,7 @@
+ #define HOST_NAME_SIZE 256
+ 
+ #include <config.h>
++#include <stdint.h>
+ 
+ #include <time.h>  /* for tm structure */
+ 
+@@ -99,10 +100,15 @@ typedef struct
+ }
+ folder_t;
+ 
++typedef union {
++	uint64_t halves[2];
++	unsigned char bytes[16];
++} md5_t;
++
+ typedef struct
+ {
+-  char **md5;
+   int n;
++  md5_t md5s[];
+ }
+ checksum_t;
+ 
+@@ -129,6 +135,6 @@ typedef struct
+ }
+ option_t;
+ 
+-option_t config;
++extern option_t config;
+ 
+ #endif /* MBOXGREP_H */

Added: head/mail/mboxgrep/files/patch-src_scan.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/mail/mboxgrep/files/patch-src_scan.c	Wed Sep 23 12:24:21 2020	(r549719)
@@ -0,0 +1,122 @@
+--- src/scan.c.orig	2003-04-06 21:01:49 UTC
++++ src/scan.c
+@@ -59,7 +59,7 @@
+ #include "mh.h"
+ #include "maildir.h"
+ #include "wrap.h"
+-#include "md5.h"
++#include <openssl/md5.h>
+ #ifdef HAVE_FTS_OPEN
+ # include <sys/stat.h>
+ # include <fts.h>
+@@ -73,7 +73,10 @@
+ #include <dmalloc.h>
+ #endif /* HAVE_LIBDMALLOC */
+ 
+-void scan_mailbox (char path[])
++static int md5_check_message (const char *body, size_t bbytes);
++
++void
++scan_mailbox (const char path[])
+      /* {{{  */
+ {
+   static FILE *outf;
+@@ -95,7 +98,6 @@ void scan_mailbox (char path[])
+   int isdup = 0;
+   time_t tt;
+   struct tm *ct;
+-  extern checksum_t *cs;
+ 
+   extern option_t config;
+ 
+@@ -144,12 +146,12 @@ void scan_mailbox (char path[])
+ 
+       if ((config.format == MBOX) || (config.format == ZMBOX) ||
+ 	  (config.format == BZ2MBOX))
+-	msg = (message_t *) mbox_read_message (mbox);
++	msg = mbox_read_message (mbox);
+       else if ((config.format == MH) || (config.format == NNMH) ||
+ 	       (config.format == NNML))
+-	msg = (message_t *) mh_read_message (boxd);
++	msg = mh_read_message (boxd);
+       else if (config.format == MAILDIR)
+-	msg = (message_t *) maildir_read_message (maildird);
++	msg = maildir_read_message (maildird);
+ 
+       if (msg == NULL) break;
+ 
+@@ -178,7 +180,7 @@ void scan_mailbox (char path[])
+ 	}
+ 
+       if (config.dedup)
+-	isdup = md5_check_message (msg->body, cs);
++	isdup = md5_check_message (msg->body, msg->bbytes);
+ 
+       if (((res1 == 0) | (res2 == 0)) ^ ((config.invert ^ delete)) &&
+ 	  ((config.dedup && !isdup) || !config.dedup))
+@@ -281,7 +283,8 @@ void scan_mailbox (char path[])
+ }
+ /* }}} */
+ 
+-void recursive_scan (char path[])
++void
++recursive_scan (const char path[])
+      /* {{{  */
+ 
+ {
+@@ -312,37 +315,41 @@ void recursive_scan (char path[])
+     fts_close (ftsfoo);
+   }
+ #else
+-  ftw (path, (void *) scan_mailbox, 1);
++  ftw (path, (int (*)(const char *, const struct *, int))scan_mailbox, 1);
+ #endif /* HAVE_FTS_OPEN */
+ }
+ 
+ /* }}} */
+ 
+-int md5_check_message (char *body, checksum_t *chksum)
++static int
++md5_check_message (const char *body, size_t bbytes)
+      /* {{{  */
+ {
+-  struct md5_ctx a;
+-  unsigned char b[16];
++  MD5_CTX a;
++  md5_t b;
+   int i;
++  extern checksum_t *cs;
+ 
+-  md5_init_ctx (&a);
++  MD5_Init(&a);
+   if (body == NULL)
+-    md5_process_bytes ("", 0, &a);
++    MD5_Update(&a, "", 0);
+   else
+-    md5_process_bytes (body, strlen(body), &a);
+-  md5_finish_ctx(&a, b);
++    MD5_Update(&a, body, bbytes);
++  MD5_Final(b.bytes, &a);
+ 
+-  for (i = 0; i < chksum->n; i++)
++  for (i = 0; i < cs->n; i++)
+     {
+-      if (0 == strncmp (chksum->md5[i], b, 16)) 
++      if (b.halves[0] == cs->md5s[i].halves[0] &&
++	b.halves[1] == cs->md5s[i].halves[1])
+ 	return 1; 
+     }
+ 
+-  chksum->md5 = 
+-	(char **) xrealloc (chksum->md5, (1 + chksum->n) * sizeof (char *));
+-  chksum->md5[chksum->n] = xstrdup (b);
++  cs = 
++	xrealloc (cs, sizeof(checksum_t) + (i + 1) * sizeof (md5_t));
++  cs->md5s[i].halves[0] = b.halves[0];
++  cs->md5s[i].halves[1] = b.halves[1];
+ 
+-  (chksum->n)++;
++  cs->n++;
+ 
+   return 0;
+ }

Added: head/mail/mboxgrep/files/patch-src_scan.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/mail/mboxgrep/files/patch-src_scan.h	Wed Sep 23 12:24:21 2020	(r549719)
@@ -0,0 +1,13 @@
+--- src/scan.h.orig	2003-03-30 23:07:10 UTC
++++ src/scan.h
+@@ -23,8 +23,7 @@
+ 
+ #include "mboxgrep.h"
+ 
+-void scan_mailbox (char path[]);
+-void recursive_scan (char path[]);
+-int md5_check_message (char *body, checksum_t *chksum);
++void scan_mailbox(const char path[]);
++void recursive_scan(const char path[]);
+ 
+ #endif /* SCAN_H */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202009231224.08NCOLg2078359>