commit:     0df7b29c421cfe35077f4493baf6088eb931f961
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  8 12:21:55 2023 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Sun Oct  8 12:21:55 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0df7b29c

app-backup/cpdup: update EAPI 6 -> 8

Closes: https://bugs.gentoo.org/507522
Closes: https://bugs.gentoo.org/716100
Signed-off-by: David Seifert <soap <AT> gentoo.org>

 .../{cpdup-1.18.ebuild => cpdup-1.18-r1.ebuild}    |  23 ++--
 app-backup/cpdup/files/Makefile.linux              |  13 ---
 app-backup/cpdup/files/cpdup-1.11-unused.patch     |  14 ---
 app-backup/cpdup/files/cpdup-1.18-makefile.patch   |  30 +++++
 app-backup/cpdup/files/cpdup-1.18-portable.patch   | 128 +++++++++++++++++++++
 5 files changed, 170 insertions(+), 38 deletions(-)

diff --git a/app-backup/cpdup/cpdup-1.18.ebuild 
b/app-backup/cpdup/cpdup-1.18-r1.ebuild
similarity index 54%
rename from app-backup/cpdup/cpdup-1.18.ebuild
rename to app-backup/cpdup/cpdup-1.18-r1.ebuild
index 52be46bbfabb..5e6eccb3db93 100644
--- a/app-backup/cpdup/cpdup-1.18.ebuild
+++ b/app-backup/cpdup/cpdup-1.18-r1.ebuild
@@ -1,7 +1,7 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=6
+EAPI=8
 
 inherit toolchain-funcs
 
@@ -13,22 +13,23 @@ S="${WORKDIR}/${PN}"
 LICENSE="BSD-2"
 SLOT="0"
 KEYWORDS="~amd64"
-IUSE="threads"
 
-PATCHES=( "${FILESDIR}"/${PN}-1.11-unused.patch )
+RDEPEND="dev-libs/libbsd:="
+DEPEND="${RDEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-makefile.patch
+       "${FILESDIR}"/${P}-portable.patch
+)
 
 src_prepare() {
        default
-
-       cp "${FILESDIR}"/Makefile.linux Makefile || die
-       # bits/stat.h has __unused too
-       sed -i 's/__unused/__cpdup_unused/' *.c || die
-       echo "#define strlcpy(a,b,c) strncpy(a,b,c)" >> cpdup.h || die
+       rm compat_linux.c || die
 }
 
 src_configure() {
-       tc-export CC
-       use threads || MAKEOPTS+=" NOPTHREADS=1"
+       tc-export CC PKG_CONFIG
 }
 
 src_install() {

diff --git a/app-backup/cpdup/files/Makefile.linux 
b/app-backup/cpdup/files/Makefile.linux
deleted file mode 100644
index 3e18e4e0b218..000000000000
--- a/app-backup/cpdup/files/Makefile.linux
+++ /dev/null
@@ -1,13 +0,0 @@
-OBJS = cpdup.o fsmid.o hclink.o hcproto.o misc.o
-
-CFLAGS += -D__cpdup_unused="__attribute__ ((unused))" -D_GNU_SOURCE 
-D__USE_FILE_OFFSET64 -DNOMD5
-
-ifndef NOPTHREADS
-CFLAGS += -DUSE_PTHREADS=1 -pthread
-endif
-
-all: $(OBJS)
-       $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o cpdup
-
-.c.o:
-       $(CC) $(CFLAGS) -c -o $@ $<

diff --git a/app-backup/cpdup/files/cpdup-1.11-unused.patch 
b/app-backup/cpdup/files/cpdup-1.11-unused.patch
deleted file mode 100644
index 5544afbeddf9..000000000000
--- a/app-backup/cpdup/files/cpdup-1.11-unused.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- a/cpdup.c
-+++ b/cpdup.c
-@@ -1543,7 +1543,11 @@
-  */
- 
- static int
-+#ifdef _ST_FLAGS_PRESENT_
- xrename(const char *src, const char *dst, u_long flags)
-+#else
-+xrename(const char *src, const char *dst, u_long flags __unused)
-+#endif
- {
-     int r;
- 

diff --git a/app-backup/cpdup/files/cpdup-1.18-makefile.patch 
b/app-backup/cpdup/files/cpdup-1.18-makefile.patch
new file mode 100644
index 000000000000..173232fb3348
--- /dev/null
+++ b/app-backup/cpdup/files/cpdup-1.18-makefile.patch
@@ -0,0 +1,30 @@
+--- a/Makefile
++++ b/Makefile
+@@ -1,20 +1,9 @@
+-# $DragonFly: src/bin/cpdup/Makefile,v 1.7 2008/04/10 22:09:08 dillon Exp $
+-#
++OBJS = cpdup.o hcproto.o hclink.o misc.o fsmid.o
+ 
+-PROG= cpdup
+-SRCS= cpdup.c hcproto.c hclink.c misc.c fsmid.c
+-
+-.if defined(.FreeBSD)
+-CFLAGS += -D_ST_FLAGS_PRESENT_=1
+-WARNS?=       6
+-.endif
+-
+-.if !defined(NOMD5)
+-SRCS+=        md5.c
+-.endif
+-
+-LDADD+= -lmd
+-DPADD+= ${LIBMD}
+-
+-.include <bsd.prog.mk>
++CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 
-D_LARGEFILE64_SOURCE -DNOMD5 -DUSE_PTHREADS=1
++CPPFLAGS += $(shell $(PKG_CONFIG) --cflags libbsd)
++CFLAGS += -pthread
++LIBS += $(shell $(PKG_CONFIG) --libs libbsd)
+ 
++all: $(OBJS)
++      $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o cpdup $(LIBS)

diff --git a/app-backup/cpdup/files/cpdup-1.18-portable.patch 
b/app-backup/cpdup/files/cpdup-1.18-portable.patch
new file mode 100644
index 000000000000..90a82d98a6dc
--- /dev/null
+++ b/app-backup/cpdup/files/cpdup-1.18-portable.patch
@@ -0,0 +1,128 @@
+--- a/compat_sun.h
++++ b/compat_sun.h
+@@ -1,6 +1,3 @@
+-/* __unused is a gcc'ism. */
+-#define       __unused
+-
+ #include <stdio.h>
+ #include <stdarg.h>
+ 
+--- a/cpdup.c
++++ b/cpdup.c
+@@ -127,8 +127,8 @@
+ static void hltdelete(struct hlink *);
+ static void hltsetdino(struct hlink *, ino_t);
+ static int YesNo(const char *path);
+-static int xrename(const char *src, const char *dst, u_long flags);
+-static int xlink(const char *src, const char *dst, u_long flags);
++static int xrename(const char *src, const char *dst, unsigned long flags);
++static int xlink(const char *src, const char *dst, unsigned long flags);
+ static int xremove(struct HostConf *host, const char *path);
+ static int DoCopy(copy_info_t info, struct stat *stat1, int depth);
+ static int ScanDir(List *list, struct HostConf *host, const char *path,
+@@ -1648,7 +1648,7 @@
+  */
+ 
+ static int
+-xrename(const char *src, const char *dst, u_long flags)
++xrename(const char *src, const char *dst, unsigned long flags)
+ {
+     int r;
+ 
+@@ -1663,7 +1663,7 @@
+ }
+ 
+ static int
+-xlink(const char *src, const char *dst, u_long flags)
++xlink(const char *src, const char *dst, unsigned long flags)
+ {
+     int r;
+ #ifdef _ST_FLAGS_PRESENT_
+--- a/cpdup.h
++++ b/cpdup.h
+@@ -39,7 +39,6 @@
+ #define __printflike(a,b)
+ #define __printf0like(a,b)
+ #define __aligned(x)
+-#define __unused
+ #endif
+ 
+ void logstd(const char *ctl, ...) __printflike(1, 2);
+--- a/hclink.c
++++ b/hclink.c
+@@ -73,7 +73,7 @@
+ }
+ 
+ static int
+-rc_badop(hctransaction_t trans __unused, struct HCHead *head)
++rc_badop(hctransaction_t trans, struct HCHead *head)
+ {
+     head->error = EOPNOTSUPP;
+     return(0);
+--- a/hcproto.c
++++ b/hcproto.c
+@@ -10,6 +10,8 @@
+ #include "hclink.h"
+ #include "hcproto.h"
+ 
++#include <bsd/string.h>
++
+ static int hc_decode_stat(hctransaction_t trans, struct stat *, struct HCHead 
*);
+ static int hc_decode_stat_item(struct stat *st, struct HCLeaf *item);
+ static int rc_encode_stat(hctransaction_t trans, struct stat *);
+@@ -1503,7 +1505,7 @@
+  * CHFLAGS
+  */
+ int
+-hc_chflags(struct HostConf *hc, const char *path, u_long flags)
++hc_chflags(struct HostConf *hc, const char *path, unsigned long flags)
+ {
+     hctransaction_t trans;
+     struct HCHead *head;
+@@ -1535,7 +1537,7 @@
+ {
+     struct HCLeaf *item;
+     const char *path = NULL;
+-    u_long flags = 0;
++    unsigned long flags = 0;
+     int rc;
+ 
+     FOR_EACH_ITEM(item, trans, head) {
+@@ -1544,7 +1546,7 @@
+           path = HCC_STRING(item);
+           break;
+       case LC_FILEFLAGS:
+-          flags = (u_long)HCC_INT64(item);
++          flags = (unsigned long)HCC_INT64(item);
+           break;
+       }
+     }
+@@ -1846,7 +1848,7 @@
+ }
+ 
+ static int
+-rc_geteuid(hctransaction_t trans, struct HCHead *head __unused)
++rc_geteuid(hctransaction_t trans, struct HCHead *head)
+ {
+     hcc_leaf_int32(trans, LC_UID, geteuid());
+     return (0);
+@@ -1920,7 +1922,7 @@
+ }
+ 
+ static int
+-rc_getgroups(hctransaction_t trans, struct HCHead *head __unused)
++rc_getgroups(hctransaction_t trans, struct HCHead *head)
+ {
+     int count, i;
+     gid_t *gidlist;
+--- a/hcproto.h
++++ b/hcproto.h
+@@ -105,7 +105,7 @@
+ int hc_chmod(struct HostConf *hc, const char *path, mode_t mode);
+ int hc_mknod(struct HostConf *hc, const char *path, mode_t mode, dev_t rdev);
+ int hc_link(struct HostConf *hc, const char *name1, const char *name2);
+-int hc_chflags(struct HostConf *hc, const char *path, u_long flags);
++int hc_chflags(struct HostConf *hc, const char *path, unsigned long flags);
+ int hc_readlink(struct HostConf *hc, const char *path, char *buf, int bufsiz);
+ mode_t hc_umask(struct HostConf *hc, mode_t numask);
+ int hc_symlink(struct HostConf *hc, const char *name1, const char *name2);

Reply via email to