From 5c4aa35ae0f672b7c1af0be0c198dc7ec8dff8d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20B=C3=B6ck?= Date: Tue, 31 Dec 2024 14:06:02 +0100 Subject: [PATCH] sys-fs/ext3grep: Fix include order / C23 compile errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on patch provided by NHOrus via Github. Closes: https://github.com/gentoo/gentoo/pull/39904 Closes: https://bugs.gentoo.org/939024 Closes: https://bugs.gentoo.org/934532 Signed-off-by: Hanno Böck --- sys-fs/ext3grep/ext3grep-0.10.2-r2.ebuild | 37 ++++++++ .../files/ext3grep-0.10.2-include-order.patch | 86 +++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 sys-fs/ext3grep/ext3grep-0.10.2-r2.ebuild create mode 100644 sys-fs/ext3grep/files/ext3grep-0.10.2-include-order.patch diff --git a/sys-fs/ext3grep/ext3grep-0.10.2-r2.ebuild b/sys-fs/ext3grep/ext3grep-0.10.2-r2.ebuild new file mode 100644 index 0000000000000..1311fc4dc7509 --- /dev/null +++ b/sys-fs/ext3grep/ext3grep-0.10.2-r2.ebuild @@ -0,0 +1,37 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DESCRIPTION="Recover deleted files on an ext3 file system" +HOMEPAGE="https://code.google.com/p/ext3grep/" +SRC_URI="https://ext3grep.googlecode.com/files/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="debug pch" + +DEPEND=" + sys-fs/e2fsprogs + virtual/os-headers +" +BDEPEND="virtual/pkgconfig" + +PATCHES=( + "${FILESDIR}/${PN}-0.10.1-gcc44.patch" + "${FILESDIR}/${P}-include-unistd_h-for-sysconf.patch" + "${FILESDIR}/${P}-new-e2fsprogs.patch" + "${FILESDIR}/${P}-newer-e2fsprogs.patch" + "${FILESDIR}/${P}-missing-cassert-include.patch" + "${FILESDIR}/${P}-include-order.patch" +) + +src_configure() { + local myeconfargs=( + $(use_enable debug) + $(use_enable pch) + ) + + econf "${myeconfargs[@]}" +} diff --git a/sys-fs/ext3grep/files/ext3grep-0.10.2-include-order.patch b/sys-fs/ext3grep/files/ext3grep-0.10.2-include-order.patch new file mode 100644 index 0000000000000..6f08e5ad9329c --- /dev/null +++ b/sys-fs/ext3grep/files/ext3grep-0.10.2-include-order.patch @@ -0,0 +1,86 @@ +https://bugs.gentoo.org/934532 +https://bugs.gentoo.org/939024 +Ordering of includes is important, so we don't redefine "clamp" from +under STL internals: +https://en.cppreference.com/w/cpp/algorithm/clamp takes four args +but clamp in ext2fs.h takes three +diff -ur a/src/directories.cc b/src/directories.cc +--- a/src/directories.cc 2024-12-30 14:12:51.353812001 +0400 ++++ b/src/directories.cc 2024-12-30 14:13:51.472524523 +0400 +@@ -21,6 +21,10 @@ + // You should have received a copy of the GNU General Public License + // along with this program. If not, see . + ++#include ++#include ++#include ++ + #ifndef USE_PCH + #include "sys.h" + #include "ext3.h" +@@ -33,9 +37,6 @@ + #include "indirect_blocks.h" + #include "get_block.h" + #include "directories.h" +-#include +-#include +-#include + + //----------------------------------------------------------------------------- + // +diff -ur a/src/init_files.cc b/src/init_files.cc +--- a/src/init_files.cc 2024-12-30 14:12:51.353812001 +0400 ++++ b/src/init_files.cc 2024-12-30 14:13:37.823593692 +0400 +@@ -21,6 +21,8 @@ + // You should have received a copy of the GNU General Public License + // along with this program. If not, see . + ++#include ++ + #ifndef USE_PCH + #include "sys.h" + #include +@@ -33,7 +35,6 @@ + #include "globals.h" + #include "forward_declarations.h" + #include "journal.h" +-#include + + //----------------------------------------------------------------------------- + // +diff -ur a/src/journal.cc b/src/journal.cc +--- a/src/journal.cc 2024-12-30 14:12:51.353812001 +0400 ++++ b/src/journal.cc 2024-12-30 14:14:07.808441493 +0400 +@@ -21,6 +21,9 @@ + // You should have received a copy of the GNU General Public License + // along with this program. If not, see . + ++#include ++#include ++ + #ifndef USE_PCH + #include "sys.h" + #include +@@ -37,8 +40,6 @@ + #include "indirect_blocks.h" + #include "get_block.h" + #include "commandline.h" +-#include +-#include + + //----------------------------------------------------------------------------- + // +It throws warning - we already define LARGEFILE on Gentoo, so let's not redefine +diff -ur a/src/sys.h.in b/src/sys.h.in +--- a/src/sys.h.in 2024-12-30 14:12:51.353812001 +0400 ++++ b/src/sys.h.in 2024-12-30 14:24:36.796244569 +0400 +@@ -31,7 +31,9 @@ + #endif + + // This is needed for lseek64. ++#ifndef _LARGEFILE64_SOURCE + #define _LARGEFILE64_SOURCE ++#endif + + #ifdef CWDEBUG + #ifndef _GNU_SOURCE