From dc08721b56e88a1f41814b2e123c00061dba0d3e Mon Sep 17 00:00:00 2001
From: Ben Gamari <ben@smart-cactus.org>
Date: Wed, 13 Jul 2022 17:05:33 -0400
Subject: [PATCH] Use system-cxx-std-lib virtual package where available

Starting with the 9.4 release, GHC provides `system-cxx-std-lib`, a
"virtual" package which can be used to reliably link against the
system's C++ standard library implementation.

See GHC #20010.
---
 text.cabal | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/text.cabal b/text.cabal
index f6343609..bcae0340 100644
--- a/text.cabal
+++ b/text.cabal
@@ -90,7 +90,9 @@ library
                  cbits/validate_utf8.cpp
     cxx-options: -std=c++17
     cpp-options: -DSIMDUTF
-    if os(darwin) || os(freebsd)
+    if impl(ghc >= 9.4)
+      build-depends: system-cxx-std-lib == 1.0
+    elif os(darwin) || os(freebsd)
       extra-libraries: c++
     elif os(openbsd)
       extra-libraries: c++ c++abi pthread
-- 
GitLab