From 649c1b466ff269f2908038632e5c5ee8ddbb0a1f Mon Sep 17 00:00:00 2001 From: George Thomas Date: Tue, 24 Mar 2026 11:17:31 +0000 Subject: [PATCH] Revert "Ditch Bash script for custom setup" This reverts commit 1f1c0d959da699ce04f7951ecbcdb7976c8c0750. This doesn't work well with multi-component builds. For example, it requires `"haskell.sessionLoading": "singleComponent"` in VSCode, which makes HLS work less reliably. --- Setup.hs | 14 -------------- garnet.cabal | 7 ------- generate-bindings | 5 +++++ 3 files changed, 5 insertions(+), 21 deletions(-) delete mode 100644 Setup.hs create mode 100755 generate-bindings diff --git a/Setup.hs b/Setup.hs deleted file mode 100644 index 4d25b82..0000000 --- a/Setup.hs +++ /dev/null @@ -1,14 +0,0 @@ -import Distribution.Simple -import Distribution.Simple.LocalBuildInfo -import Distribution.Utils.Path -import System.Directory - -main :: IO () -main = - defaultMainWithHooks - simpleUserHooks - -- Place library in the location from which Cabal can bundle it. - { buildHook = \pkg lbi hooks flags -> do - copyFile "rust/target/debug/libgarnet_rs.a" $ getSymbolicPath (buildDir lbi) "libgarnet_rs.a" - buildHook simpleUserHooks pkg lbi hooks flags - } diff --git a/garnet.cabal b/garnet.cabal index 8c631eb..52f65d4 100644 --- a/garnet.cabal +++ b/garnet.cabal @@ -6,13 +6,6 @@ author: Patrick Aldis maintainer: george.thomas@obsidian.systems patrick.aldis@obsidian.systems -build-type: Custom - -custom-setup - setup-depends: - base, - Cabal, - directory, common common default-language: GHC2024 diff --git a/generate-bindings b/generate-bindings new file mode 100755 index 0000000..39111ba --- /dev/null +++ b/generate-bindings @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Place library in the location from which Cabal can bundle it. +cp rust/target/debug/libgarnet_rs.a $(cabal list-bin . | sed -e 's=x/garnet/build/garnet/garnet=build=g')