commit:     69ef13ef2d97eecefe30c83a4dfcca76732c0f71
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 15 21:59:21 2024 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sat Jun 15 22:03:05 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=69ef13ef

net-mail/safecat: EAPI 8 bump, some fixes

This does not include a full suite of Clang fixes, due to upstream's C
coding style: significant work to fix all of the prototypes in this code
base, and align with modern types.

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
Closes: https://bugs.gentoo.org/show_bug.cgi?id=725030
Closes: https://bugs.gentoo.org/show_bug.cgi?id=836088

 .../files/safecat-1.13-dup-obj-makefile.patch      | 39 +++++++++
 net-mail/safecat/files/safecat-1.13-include.patch  | 97 ++++++++++++++++++++++
 ...{safecat-1.13.ebuild => safecat-1.13-r1.ebuild} | 20 +++--
 net-mail/safecat/safecat-1.13.ebuild               |  7 +-
 4 files changed, 150 insertions(+), 13 deletions(-)

diff --git a/net-mail/safecat/files/safecat-1.13-dup-obj-makefile.patch 
b/net-mail/safecat/files/safecat-1.13-dup-obj-makefile.patch
new file mode 100644
index 000000000000..b276bb7ff709
--- /dev/null
+++ b/net-mail/safecat/files/safecat-1.13-dup-obj-makefile.patch
@@ -0,0 +1,39 @@
+https://bugs.gentoo.org/740798
+https://cgit.freebsd.org/ports/plain/sysutils/safecat/files/patch-Makefile    
+
+    sysutils/safecat: avoid duplicating object files in library
+    
+    Previously byte_copy.o and str_len.o were added to str.a, and then
+    specified as objects on the safecat link command line along with str.
+    When linking with lld this produces duplicate symbol errors like:
+    
+    /usr/bin/ld: error: duplicate symbol: byte_copy
+    >>> defined at byte_copy.c
+    >>>            byte_copy.o:(byte_copy) in archive str.a
+    >>> defined at byte_copy.c
+    >>>            byte_copy.o(.text+0x0)
+    
+    As these symbols are provided by str.a just avoid listing the object
+    files as well.
+--- safecat-1.13/Makefile.orig 2004-08-16 20:50:09.000000000 -0400
++++ safecat-1.13/Makefile      2017-11-23 16:49:00.505811000 -0500
+@@ -219,14 +219,14 @@
+ 
+ safecat: \
+ load safecat.o getln.a str.a stralloc.a strerr.a substdio.a alloc.o \
+-alloc_re.o byte_copy.o byte_cr.o envread.o error.o error_str.o fmt_uint64.o \
+-hostname.o sig.o stat_dir.o str_diffn.o str_len.o substdio_copy.o \
++alloc_re.o byte_cr.o envread.o error.o error_str.o fmt_uint64.o \
++hostname.o sig.o stat_dir.o str_diffn.o substdio_copy.o \
+ substdi.o substdio.o taia_fmtfrac.o taia_now.o taia_tai.o tempfile.o \
+ writefile.o
+-      ./load safecat getln.a str.a stralloc.a strerr.a substdio.a \
+-      alloc.o alloc_re.o byte_copy.o byte_cr.o envread.o error.o \
++      ./load safecat getln.a stralloc.a strerr.a substdio.a str.a \
++      alloc.o alloc_re.o byte_cr.o envread.o error.o \
+       error_str.o fmt_uint64.o hostname.o sig.o stat_dir.o str_diffn.o \
+-      str_len.o substdi.o substdio.o substdio_copy.o taia_fmtfrac.o \
++      substdi.o substdio.o substdio_copy.o taia_fmtfrac.o \
+       taia_now.o taia_tai.o tempfile.o writefile.o
+ 
+ safecat.0: \

diff --git a/net-mail/safecat/files/safecat-1.13-include.patch 
b/net-mail/safecat/files/safecat-1.13-include.patch
new file mode 100644
index 000000000000..f59f2a45d230
--- /dev/null
+++ b/net-mail/safecat/files/safecat-1.13-include.patch
@@ -0,0 +1,97 @@
+diff '--color=auto' -Nuar safecat-1.13.orig/install.c safecat-1.13/install.c
+--- safecat-1.13.orig/install.c        2000-02-28 20:10:12.000000000 -0800
++++ safecat-1.13/install.c     2024-06-15 14:40:24.142699634 -0700
+@@ -1,3 +1,10 @@
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <errno.h>
++#include <fcntl.h>
++#include <signal.h>
++#include <stdlib.h>
++#include <unistd.h>
+ #include "substdio.h"
+ #include "strerr.h"
+ #include "error.h"
+diff '--color=auto' -Nuar safecat-1.13.orig/instcheck.c 
safecat-1.13/instcheck.c
+--- safecat-1.13.orig/instcheck.c      2000-02-28 20:10:12.000000000 -0800
++++ safecat-1.13/instcheck.c   2024-06-15 14:40:27.502696776 -0700
+@@ -1,5 +1,12 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#include <errno.h>
++#include <fcntl.h>
++#include <signal.h>
++#include <stdlib.h>
++#include <unistd.h>
++#include <sys/types.h>
++#include <sys/stat.h>
+ #include "strerr.h"
+ #include "error.h"
+ #include "readwrite.h"
+diff '--color=auto' -Nuar safecat-1.13.orig/safecat.c safecat-1.13/safecat.c
+--- safecat-1.13.orig/safecat.c        2004-08-16 18:14:34.000000000 -0700
++++ safecat-1.13/safecat.c     2024-06-15 14:40:17.246038832 -0700
+@@ -23,6 +23,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <signal.h>
++#include <stdlib.h>
+ #include <unistd.h>
+ 
+ /* Support for large files (on Linux systems, if the appropriate
+--- safecat-1.13.orig/alloc.c  2000-02-28 20:10:12.000000000 -0800
++++ safecat-1.13/alloc.c       2024-06-15 14:41:26.985979033 -0700
+@@ -1,7 +1,6 @@
++#include <stdlib.h>
+ #include "alloc.h"
+ #include "error.h"
+-extern char *malloc();
+-extern void free();
+ 
+ #define ALIGNMENT 16 /* XXX: assuming that this alignment is enough */
+ #define SPACE 4096 /* must be multiple of ALIGNMENT */
+@@ -18,7 +17,7 @@
+   char *x;
+   n = ALIGNMENT + n - (n & (ALIGNMENT - 1)); /* XXX: could overflow */
+   if (n <= avail) { avail -= n; return space + avail; }
+-  x = malloc(n);
++  x = (char*)malloc(n);
+   if (!x) errno = error_nomem;
+   return x;
+ }
+--- safecat-1.13.orig/readwrite.h      2024-06-15 14:46:41.472362482 -0700
++++ safecat-1.13/readwrite.h   2024-06-15 14:46:21.755714187 -0700
+@@ -1,7 +1,8 @@
+ #ifndef READWRITE_H
+ #define READWRITE_H
+ 
+-extern int read();
+-extern int write();
++#include <unistd.h>
++//extern int read();
++//extern int write();
+ 
+ #endif
+--- safecat-1.13/stralloc.h    2000-02-28 20:10:12.000000000 -0800
++++ safecat-1.13/stralloc.h    2024-06-15 14:55:46.678492988 -0700
+@@ -7,14 +7,14 @@
+ 
+ extern int stralloc_ready();
+ extern int stralloc_readyplus();
+-extern int stralloc_copy();
+-extern int stralloc_cat();
++extern int stralloc_copy(stralloc *sato, stralloc *safrom);
++extern int stralloc_cat(stralloc *sato, stralloc *safrom);
+ extern int stralloc_copys();
+-extern int stralloc_cats();
+-extern int stralloc_copyb();
+-extern int stralloc_catb();
++extern int stralloc_cats(stralloc *sa, char *s);
++extern int stralloc_copyb(stralloc *sa, char *s, unsigned int n);
++extern int stralloc_catb(stralloc *sa, char *s, unsigned int n);
+ extern int stralloc_append(); /* beware: this takes a pointer to 1 char */
+-extern int stralloc_starts();
++extern int stralloc_starts(stralloc *sa, char *s);
+ 
+ #define stralloc_0(sa) stralloc_append(sa,"")
+ 

diff --git a/net-mail/safecat/safecat-1.13.ebuild 
b/net-mail/safecat/safecat-1.13-r1.ebuild
similarity index 74%
copy from net-mail/safecat/safecat-1.13.ebuild
copy to net-mail/safecat/safecat-1.13-r1.ebuild
index 7dbf9cc60c48..5ceefb07bb67 100644
--- a/net-mail/safecat/safecat-1.13.ebuild
+++ b/net-mail/safecat/safecat-1.13-r1.ebuild
@@ -1,7 +1,7 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=6
+EAPI=8
 
 inherit toolchain-funcs
 
@@ -11,12 +11,10 @@ 
SRC_URI="http://www.jeenyus.net/linux/software/${PN}/${P}.tar.gz";
 
 LICENSE="BSD"
 SLOT="0"
-KEYWORDS="amd64 ~hppa ~mips ppc ~sparc x86"
-IUSE=""
+KEYWORDS="~amd64 ~hppa ~mips ~ppc ~sparc ~x86"
 RESTRICT="test"
 
 DEPEND="sys-apps/groff"
-RDEPEND=""
 
 PATCHES=(
        # applying maildir-patch
@@ -25,24 +23,28 @@ PATCHES=(
        "${FILESDIR}"/${P}-makefile.patch
        # Fix POSIX head/tail syntax
        "${FILESDIR}"/${P}-head-tail-POSIX.patch
+       # Fix dup objects
+       "${FILESDIR}"/${P}-dup-obj-makefile.patch
+       # Headers
+       "${FILESDIR}"/${P}-include.patch
 )
 
 src_prepare() {
        default
 
        sed -ni '/man\|doc/!p' hier.c || die
-
-       # Fix implicit decleration
-       sed '/include <signal.h>/ a #include <stdlib.h>' -i safecat.c || die
 }
 
 src_configure() {
-       echo "${D}/usr" > conf-root || die
+       echo "/usr" > conf-root || die
        echo "$(tc-getCC) ${CFLAGS}" > conf-cc || die
        echo "$(tc-getCC) ${LDFLAGS}" > conf-ld || die
+       echo "$(tc-getAR)" > conf-ar || die
 }
 
 src_install() {
+       # ${D} is not valid in src_configure
+       echo "${D}/usr" > conf-root || die
        emake setup check
        einstalldocs
        doman maildir.1 safecat.1

diff --git a/net-mail/safecat/safecat-1.13.ebuild 
b/net-mail/safecat/safecat-1.13.ebuild
index 7dbf9cc60c48..f8fa413f269e 100644
--- a/net-mail/safecat/safecat-1.13.ebuild
+++ b/net-mail/safecat/safecat-1.13.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -12,11 +12,9 @@ 
SRC_URI="http://www.jeenyus.net/linux/software/${PN}/${P}.tar.gz";
 LICENSE="BSD"
 SLOT="0"
 KEYWORDS="amd64 ~hppa ~mips ppc ~sparc x86"
-IUSE=""
 RESTRICT="test"
 
 DEPEND="sys-apps/groff"
-RDEPEND=""
 
 PATCHES=(
        # applying maildir-patch
@@ -37,12 +35,13 @@ src_prepare() {
 }
 
 src_configure() {
-       echo "${D}/usr" > conf-root || die
+       echo "/usr" > conf-root || die
        echo "$(tc-getCC) ${CFLAGS}" > conf-cc || die
        echo "$(tc-getCC) ${LDFLAGS}" > conf-ld || die
 }
 
 src_install() {
+       echo "${D}/usr" > conf-root || die
        emake setup check
        einstalldocs
        doman maildir.1 safecat.1

Reply via email to