From beb9e145429f3420d5ade9a415609c5863d94250 Mon Sep 17 00:00:00 2001 From: George Thomas Date: Tue, 3 Mar 2026 20:58:41 +0000 Subject: [PATCH] drop hooks in favour of using bundled libraries properly script addition is hacky, but I know no other way to get most of the build path, in arch/version-independent way we'll use a custom setup or whatever eventually (_eventually_ hooks...) anyway --- SetupHooks.hs | 33 --------------------------------- garnet.cabal | 8 -------- generate-bindings | 3 +++ 3 files changed, 3 insertions(+), 41 deletions(-) delete mode 100644 SetupHooks.hs diff --git a/SetupHooks.hs b/SetupHooks.hs deleted file mode 100644 index 742f21c..0000000 --- a/SetupHooks.hs +++ /dev/null @@ -1,33 +0,0 @@ -{-# LANGUAGE DisambiguateRecordFields #-} -{-# LANGUAGE DuplicateRecordFields #-} -{-# LANGUAGE NoFieldSelectors #-} - -module SetupHooks (setupHooks) where - -import Distribution.Simple.SetupHooks -import Distribution.Utils.Path -import System.Directory - -setupHooks :: SetupHooks -setupHooks = - noSetupHooks - { configureHooks = - noConfigureHooks - { preConfComponentHook = Just addRustLibDir - } - } - -addRustLibDir :: PreConfComponentInputs -> IO PreConfComponentOutputs -addRustLibDir inputs = do - cwd <- getCurrentDirectory - pure - (noPreConfComponentOutputs inputs :: PreConfComponentOutputs) - { componentDiff = - buildInfoComponentDiff - (componentName (component inputs)) - emptyBuildInfo - { extraLibDirs = - [ makeSymbolicPath $ cwd "rust" "target" "debug" - ] - } - } diff --git a/garnet.cabal b/garnet.cabal index 83380ac..52f65d4 100644 --- a/garnet.cabal +++ b/garnet.cabal @@ -6,14 +6,6 @@ author: Patrick Aldis maintainer: george.thomas@obsidian.systems patrick.aldis@obsidian.systems -build-type: Hooks - -custom-setup - setup-depends: - base, - Cabal-hooks, - Cabal-syntax, - directory, common common default-language: GHC2024 diff --git a/generate-bindings b/generate-bindings index d2ce772..9f09a72 100755 --- a/generate-bindings +++ b/generate-bindings @@ -59,3 +59,6 @@ echo " Patched header at $HEADER" echo "=== Done ===" echo "Run 'cabal run' to test." + +# place static lib in position for bundling with Cabal +cp rust/target/debug/libgarnet_rs.a $(cabal list-bin . | sed -e 's=x/garnet/build/garnet/garnet=build=g')