Ditch Bash script for custom setup

This commit is contained in:
George Thomas 2026-03-24 11:17:26 +00:00
parent 6d6bb4ba58
commit 1f1c0d959d
3 changed files with 21 additions and 5 deletions

14
Setup.hs Normal file
View File

@ -0,0 +1,14 @@
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
}

View File

@ -6,6 +6,13 @@ author: Patrick Aldis
maintainer: maintainer:
george.thomas@obsidian.systems george.thomas@obsidian.systems
patrick.aldis@obsidian.systems patrick.aldis@obsidian.systems
build-type: Custom
custom-setup
setup-depends:
base,
Cabal,
directory,
common common common common
default-language: GHC2024 default-language: GHC2024

View File

@ -1,5 +0,0 @@
#!/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')