From cb442cf639d421f090ca234b9e8657c70ba3d251 Mon Sep 17 00:00:00 2001 From: Michael Cho Date: Thu, 15 Aug 2024 14:30:14 -0400 Subject: [PATCH] cgrep: use `ghc` to build --- Formula/c/cgrep.rb | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Formula/c/cgrep.rb b/Formula/c/cgrep.rb index bf41629b8a78fc..15f2f0f0ad34f0 100644 --- a/Formula/c/cgrep.rb +++ b/Formula/c/cgrep.rb @@ -17,15 +17,33 @@ class Cgrep < Formula end depends_on "cabal-install" => :build - depends_on "ghc@9.4" => :build + depends_on "ghc" => :build depends_on "pkg-config" => :build depends_on "pcre" conflicts_with "aerleon", because: "both install `cgrep` binaries" + resource "rawfilepath" do + on_macos do + url "https://hackage.haskell.org/package/rawfilepath-1.1.1/rawfilepath-1.1.1.tar.gz" + sha256 "43f879da83b7b07c30e76a3c31d5362b7b6bb8e235c2698872b92b9fcce3bf69" + end + end + def install + # Work around "error: call to undeclared function 'execvpe'" by imitating part of removed + # hack in https://github.com/haskell/unix/commit/b8eb2486b15d564e73ef9307e175ac24a186acd2 + # Issue ref: https://github.com/xtendo-org/rawfilepath/issues/13 + if OS.mac? + (buildpath/"cabal.project.local").write "packages: . rawfilepath/" + (buildpath/"rawfilepath").install resource("rawfilepath") + inreplace "rawfilepath/cbits/runProcess.c", " execvpe(", " __hsunix_execvpe(" + end + # Help resolver pick package versions compatible with newer GHC + constraints = ["--constraint=async>=2"] + system "cabal", "v2-update" - system "cabal", "v2-install", *std_cabal_v2_args + system "cabal", "v2-install", *constraints, *std_cabal_v2_args end test do