From d1c9b48cbcf9116bbb133427fa67c2e0527e31b8 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sat, 25 May 2024 11:29:46 -0500 Subject: system/heirloom-pax: Update for Modern C Enums do not work like they did in the mid 1980s. This allows the build to work on GCC 13. I have tested basic usage of cpio and pax tools. --- system/heirloom-pax/APKBUILD | 9 +++-- system/heirloom-pax/modern-c.patch | 71 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 system/heirloom-pax/modern-c.patch diff --git a/system/heirloom-pax/APKBUILD b/system/heirloom-pax/APKBUILD index 303af5ebb..ec9e444d4 100644 --- a/system/heirloom-pax/APKBUILD +++ b/system/heirloom-pax/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: A. Wilcox pkgname=heirloom-pax pkgver=1.0 -pkgrel=1 +pkgrel=2 pkgdesc="Portable Archive eXchange, the POSIX archival tool" url="http://heirloom.sourceforge.net/" arch="all" @@ -13,7 +13,9 @@ makedepends="bsd-compat-headers bzip2-dev zlib-dev" replaces="pax" subpackages="$pkgname-doc" source="https://distfiles.adelielinux.org/source/${pkgname}-$pkgver.tar.xz - sysmacros.patch" + sysmacros.patch + modern-c.patch + " build() { make LD="gcc" @@ -30,4 +32,5 @@ package() { } sha512sums="7b0ad20cc51b5bcec9c07e84c603e4891f636944f6f6bd13d3decb0e9d6b23d6164b663468ee2293b37721aae20334774f4e56fd8541ffceee934050e819b642 heirloom-pax-1.0.tar.xz -bcc12138ebed707e165a1ac5dac815acd85770974e19f62610e0fe32a96879fb1173fc4e7beafde12b7bc1ed03f2751b2839eeb3ccacbe209d8cbcfe0307eac3 sysmacros.patch" +bcc12138ebed707e165a1ac5dac815acd85770974e19f62610e0fe32a96879fb1173fc4e7beafde12b7bc1ed03f2751b2839eeb3ccacbe209d8cbcfe0307eac3 sysmacros.patch +e0e2756bf3f55862880eadf6c5852e1c2dc6cdc4a75451a4d917685ef3c7f955f23229eef1c778be32bc27a1253ceaf820225d3ea794cfc88fe702adccaf9ef7 modern-c.patch" diff --git a/system/heirloom-pax/modern-c.patch b/system/heirloom-pax/modern-c.patch new file mode 100644 index 000000000..8574d71dc --- /dev/null +++ b/system/heirloom-pax/modern-c.patch @@ -0,0 +1,71 @@ +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 + #include + +-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); -- cgit v1.2.3-70-g09d2