GCC 10 and higher treat enums differently and the way that cpio(1)/pax(1) use
them is no longer supported. This is similar, but not identical, to the patch
used by Gentoo for sys-apps/heirloom-tools.
This should be upstreamable, but sadly, there is no upstream any more.
--- heirloom-pax-1.0/cpio/cpio.c.old 2024-05-25 11:20:07.088299291 -0500
+++ heirloom-pax-1.0/cpio/cpio.c 2024-05-25 11:25:21.674430528 -0500
@@ -824,6 +824,9 @@
static int compressed_bar; /* this is a compressed bar archive */
static int formatforced; /* -k -i -Hfmt forces a format */
static long long lineno; /* input line number */
+enum fmttype fmttype; /* type of archive format */
+enum pax pax; /* type of pax command this is */
+enum pax_preserve pax_preserve; /* attributes to preserve */
int pax_dflag; /* directory matches only itself */
int pax_kflag; /* do not overwrite files */
--- heirloom-pax-1.0/cpio/cpio.h.old 2007-03-26 13:14:57.000000000 -0500
+++ heirloom-pax-1.0/cpio/cpio.h 2024-05-25 11:23:54.143854185 -0500
@@ -31,7 +31,7 @@
#include <sys/stat.h>
#include <inttypes.h>
-enum {
+enum fmttype {
FMT_NONE = 00000000, /* no format chosen yet */
TYP_PAX = 00000010, /* uses pax-like extended headers */
@@ -70,7 +70,8 @@
FMT_BAR = 00400001, /* bar format type */
FMT_ZIP = 01000000 /* zip format */
-} fmttype;
+};
+extern enum fmttype fmttype;
/*
* Zip compression method.
@@ -173,11 +174,12 @@
extern char *progname;
extern struct glist *patterns;
-enum { /* type of pax command this is */
+enum pax { /* type of pax command this is */
PAX_TYPE_CPIO = 0, /* not a pax command */
PAX_TYPE_PAX1992 = 1, /* POSIX.2 pax command */
PAX_TYPE_PAX2001 = 2 /* POSIX.1-2001 pax command */
-} pax;
+};
+extern enum pax pax;
extern int pax_dflag;
extern int pax_kflag;
extern int pax_nflag;
@@ -185,14 +187,15 @@
extern int pax_uflag;
extern int pax_Xflag;
-enum {
+enum pax_preserve {
PAX_P_NONE = 0000,
PAX_P_ATIME = 0001,
PAX_P_MTIME = 0004,
PAX_P_OWNER = 0010,
PAX_P_MODE = 0020,
PAX_P_EVERY = 0400
-} pax_preserve;
+};
+extern enum pax_preserve pax_preserve;
extern size_t (*ofiles)(char **, size_t *);
extern void (*prtime)(time_t);