summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2024-11-17 02:32:13 +0000
committerSam James <sam@gentoo.org>2024-11-17 02:32:13 +0000
commitb79ff94a27a41efd3983fa92295f351e952ae589 (patch)
tree60fb19c58a15caf44e134c1624b6bc3026c7fb61 /app-shells
parentapp-crypt/pgpdump: fix C23 compat (diff)
downloadgentoo-b79ff94a27a41efd3983fa92295f351e952ae589.tar.gz
gentoo-b79ff94a27a41efd3983fa92295f351e952ae589.tar.bz2
gentoo-b79ff94a27a41efd3983fa92295f351e952ae589.zip
app-shells/dash: fix C23 compat
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'app-shells')
-rw-r--r--app-shells/dash/dash-0.5.12-r1.ebuild70
-rw-r--r--app-shells/dash/files/dash-0.5.12-c23-lto.patch36
-rw-r--r--app-shells/dash/files/dash-0.5.12-c23.patch150
3 files changed, 256 insertions, 0 deletions
diff --git a/app-shells/dash/dash-0.5.12-r1.ebuild b/app-shells/dash/dash-0.5.12-r1.ebuild
new file mode 100644
index 000000000000..7695ee2933c2
--- /dev/null
+++ b/app-shells/dash/dash-0.5.12-r1.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit flag-o-matic toolchain-funcs
+
+DESCRIPTION="Debian Almquist Shell"
+HOMEPAGE="http://gondor.apana.org.au/~herbert/dash/"
+if [[ ${PV} == 9999 ]] ; then
+ EGIT_REPO_URI="https://git.kernel.org/pub/scm/utils/dash/dash.git"
+ inherit autotools git-r3
+else
+ SRC_URI="http://gondor.apana.org.au/~herbert/dash/files/${P}.tar.gz"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris"
+fi
+
+LICENSE="BSD"
+SLOT="0"
+IUSE="libedit static"
+
+BDEPEND="virtual/pkgconfig"
+RDEPEND="!static? ( libedit? ( dev-libs/libedit ) )"
+DEPEND="
+ ${RDEPEND}
+ libedit? ( static? ( dev-libs/libedit[static-libs] ) )
+"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-c23.patch
+ "${FILESDIR}"/${PN}-0.5.12-c23-lto.patch
+)
+
+src_prepare() {
+ default
+
+ [[ ${PV} == 9999 ]] && eautoreconf
+
+ # Use pkg-config for libedit linkage
+ sed -i \
+ -e "/LIBS/s:-ledit:\`$(tc-getPKG_CONFIG) --libs libedit $(usex static --static '')\`:" \
+ configure || die
+}
+
+src_configure() {
+ if [[ ${CHOST} == *-solaris* ]] ; then
+ # don't redefine stat, open, dirent, etc. on Solaris
+ export ac_cv_func_stat64=yes
+ export ac_cv_func_open64=yes
+ fi
+
+ if [[ ${CHOST} == powerpc-*-darwin* ]] ; then
+ sed -i -e 's/= stpncpy(s, \([^,]\+\), \([0-9]\+\))/+= snprintf(s, \2, "%s", \1)/' \
+ src/jobs.c || die
+ fi
+
+ use static && append-ldflags -static
+
+ append-cppflags -DJOBS=$(usex libedit 1 0)
+
+ # Do not pass --enable-glob due to #443552.
+ local myeconfargs=(
+ CC_FOR_BUILD="$(tc-getBUILD_CC)"
+ --bindir="${EPREFIX}"/bin
+ --enable-fnmatch
+ $(use_with libedit)
+ )
+
+ econf "${myeconfargs[@]}"
+}
diff --git a/app-shells/dash/files/dash-0.5.12-c23-lto.patch b/app-shells/dash/files/dash-0.5.12-c23-lto.patch
new file mode 100644
index 000000000000..bd53b4ca18d9
--- /dev/null
+++ b/app-shells/dash/files/dash-0.5.12-c23-lto.patch
@@ -0,0 +1,36 @@
+https://lore.kernel.org/dash/9f2a8ab063e595188df3fe0546484e5a8156318a.1731810617.git.sam@gentoo.org/
+
+From 9f2a8ab063e595188df3fe0546484e5a8156318a Mon Sep 17 00:00:00 2001
+Message-ID: <9f2a8ab063e595188df3fe0546484e5a8156318a.1731810632.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Sun, 17 Nov 2024 02:28:07 +0000
+Subject: [PATCH] bltin: fix timescmd with C23
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+With C23 and LTO, we get the following warning (or error if promoted to such):
+```
+src/builtins.c:28:5: error: type of ‘timescmd’ does not match original declaration [-Werror=lto-type-mismatch]
+ 28 | int timescmd(int, char **);
+ | ^
+src/bltin/times.c:15:5: note: type mismatch in parameter 1
+src/bltin/times.c:15:5: note: type ‘void’ should match type ‘int’
+```
+
+Make the two consistent. This didn't show up before because pre-C23
+had unprototyped functions.
+--- a/src/bltin/times.c
++++ b/src/bltin/times.c
+@@ -12,7 +12,7 @@
+ #endif
+ #include "system.h"
+
+-int timescmd() {
++int timescmd(int argc, char *argv[]) {
+ struct tms buf;
+ long int clk_tck = sysconf(_SC_CLK_TCK);
+ int mutime, mstime, mcutime, mcstime;
+--
+2.47.0
+
diff --git a/app-shells/dash/files/dash-0.5.12-c23.patch b/app-shells/dash/files/dash-0.5.12-c23.patch
new file mode 100644
index 000000000000..63716b6276ce
--- /dev/null
+++ b/app-shells/dash/files/dash-0.5.12-c23.patch
@@ -0,0 +1,150 @@
+https://git.kernel.org/pub/scm/utils/dash/dash.git/commit/?id=b41b0d41228fe82991a63f475e0bef701f539db9 (rebased)
+--- a/src/exec.c
++++ b/src/exec.c
+@@ -769,12 +769,8 @@ typecmd(int argc, char **argv)
+ return err;
+ }
+
+-STATIC int
+-describe_command(out, command, path, verbose)
+- struct output *out;
+- char *command;
+- const char *path;
+- int verbose;
++static int describe_command(struct output *out, char *command,
++ const char *path, int verbose)
+ {
+ struct cmdentry entry;
+ struct tblentry *cmdp;
+@@ -875,10 +871,7 @@ out:
+ return 0;
+ }
+
+-int
+-commandcmd(argc, argv)
+- int argc;
+- char **argv;
++int commandcmd(int argc, char **argv)
+ {
+ char *cmd;
+ int c;
+--- a/src/jobs.c
++++ b/src/jobs.c
+@@ -243,10 +243,7 @@ close:
+ #endif
+
+
+-int
+-killcmd(argc, argv)
+- int argc;
+- char **argv;
++int killcmd(int argc, char **argv)
+ {
+ extern char *signal_names[];
+ int signo = -1;
+--- a/src/mksignames.c
++++ b/src/mksignames.c
+@@ -360,9 +360,7 @@ initialize_signames ()
+ }
+ }
+
+-void
+-write_signames (stream)
+- FILE *stream;
++void write_signames(FILE *stream)
+ {
+ register int i;
+
+--- a/src/nodes.c.pat
++++ b/src/nodes.c.pat
+@@ -87,18 +87,14 @@ copyfunc(union node *n)
+
+
+
+-STATIC void
+-calcsize(n)
+- union node *n;
++static void calcsize(union node *n)
+ {
+ %CALCSIZE
+ }
+
+
+
+-STATIC void
+-sizenodelist(lp)
+- struct nodelist *lp;
++static void sizenodelist(struct nodelist *lp)
+ {
+ while (lp) {
+ funcblocksize += SHELL_ALIGN(sizeof(struct nodelist));
+@@ -109,9 +105,7 @@ sizenodelist(lp)
+
+
+
+-STATIC union node *
+-copynode(n)
+- union node *n;
++static union node *copynode(union node *n)
+ {
+ union node *new;
+
+@@ -120,9 +114,7 @@ copynode(n)
+ }
+
+
+-STATIC struct nodelist *
+-copynodelist(lp)
+- struct nodelist *lp;
++static struct nodelist *copynodelist(struct nodelist *lp)
+ {
+ struct nodelist *start;
+ struct nodelist **lpp;
+@@ -142,9 +134,7 @@ copynodelist(lp)
+
+
+
+-STATIC char *
+-nodesavestr(s)
+- char *s;
++static char *nodesavestr(char *s)
+ {
+ char *rtn = funcstring;
+
+--- a/src/options.c
++++ b/src/options.c
+@@ -389,9 +389,7 @@ setcmd(int argc, char **argv)
+ }
+
+
+-void
+-getoptsreset(value)
+- const char *value;
++void getoptsreset(const char *value)
+ {
+ shellparam.optind = number(value) ?: 1;
+ shellparam.optoff = -1;
+--- a/src/redir.c
++++ b/src/redir.c
+@@ -281,18 +281,12 @@ ecreate:
+ }
+
+
+-STATIC void
+ #ifdef notyet
+-dupredirect(redir, f, memory)
++static void dupredirect(union node *redir, int f, char memory[10])
+ #else
+-dupredirect(redir, f)
++static void dupredirect(union node *redir, int f)
+ #endif
+- union node *redir;
+- int f;
+-#ifdef notyet
+- char memory[10];
+-#endif
+- {
++{
+ int fd = redir->nfile.fd;
+ int err = 0;
+