git: 14d783fc34de - main - cad/horizon-eda: Fix build on -CURRENT and recent -STABLE

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Wed, 05 Oct 2022 15:11:50 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=14d783fc34de4f616297ba2794609fda2dad08d0

commit 14d783fc34de4f616297ba2794609fda2dad08d0
Author:     Martin Neubauer <m.ne@gmx.net>
AuthorDate: 2022-10-05 15:10:33 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-10-05 15:11:48 +0000

    cad/horizon-eda: Fix build on -CURRENT and recent -STABLE
    
    Add upstream fix as patch until a future release.
    
    PR:             266831
---
 cad/horizon-eda/Makefile                          |  2 --
 cad/horizon-eda/files/patch-src_util_fs__util.cpp | 20 ++++++++++++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/cad/horizon-eda/Makefile b/cad/horizon-eda/Makefile
index 1f350fbff464..1d1e50ba1895 100644
--- a/cad/horizon-eda/Makefile
+++ b/cad/horizon-eda/Makefile
@@ -11,8 +11,6 @@ WWW=		https://horizon-eda.org/
 LICENSE=	GPLv3
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-BROKEN_FreeBSD_14=		fails to compile (error: no matching function for call to '__search') due to this clang regression: https://github.com/llvm/llvm-project/issues/55683
-
 BUILD_DEPENDS=	${LOCALBASE}/include/boost/optional.hpp:devel/boost-libs \
 		cppzmq>0:net/cppzmq \
 		glm>0:math/glm
diff --git a/cad/horizon-eda/files/patch-src_util_fs__util.cpp b/cad/horizon-eda/files/patch-src_util_fs__util.cpp
new file mode 100644
index 000000000000..6fa4f04f2d20
--- /dev/null
+++ b/cad/horizon-eda/files/patch-src_util_fs__util.cpp
@@ -0,0 +1,20 @@
+- workaround for https://github.com/llvm/llvm-project/issues/55683
+
+--- src/util/fs_util.cpp.orig	2022-05-29 18:00:44 UTC
++++ src/util/fs_util.cpp
+@@ -8,10 +8,10 @@ std::optional<std::string> get_relative_filename(const
+ {
+     const auto p = fs::u8path(path);
+     const auto b = fs::u8path(base);
+-    const auto x = std::search(p.begin(), p.end(), b.begin(), b.end());
+-    if (x == p.begin()) // path is in base path
+-        return fs::relative(p, b).u8string();
+-    else
+-        return {};
++    for (auto ip = p.begin(), ib = b.begin(); ib != b.end(); ip++, ib++) {
++        if (ip == p.end() || *ip != *ib)
++            return {};
++    }
++    return fs::relative(p, b).u8string();
+ }
+ } // namespace horizon