diff --git a/build b/build new file mode 100755 index 0000000..fceb60f --- /dev/null +++ b/build @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -euo pipefail + +cargo build --manifest-path ./rust/Cargo.toml +ln -sf $(pwd)/rust/target/debug/libgarnet_rs.a $(cabal list-bin . | sed -e 's=x/garnet/build/garnet/garnet=build=g') +cabal build diff --git a/generate-bindings b/generate-bindings deleted file mode 100755 index d743082..0000000 --- a/generate-bindings +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# this is obviously kind of horrible... - -# when should we run this? during every `cabal build`, `cabal repl` etc. I guess -# it's tricky because we really don't want it to be stale -# we should also bear in mind `nix build` and Rust `debug`/`release` -# eugh, I really wish Hooks just worked -# remember also that we still need run `cargo build --manifest-path ./rust/Cargo.toml` before build, to avoid stale .so -# that's only important at link time so I think it can be a `postBuildComponentHook` - then e.g. HLS won't try to run it -# for now maybe we should do that in a single script alongside the symlinking -# with comments explaining how we expect each workaround to go away eventually - -# oh, you know what, we could just symlink... - -# can we use `LD_LIBRARY_PATH` instead? -# LD_LIBRARY_PATH=rust/target/debug/libgarnet_rs.a cabal run -# LD_LIBRARY_PATH=$(pwd)/rust/target/debug cabal run -# seemingly not -# cabal run --extra-lib-dirs $(pwd)/rust/target/debug - -# it would be nice if Cabal had a declarative way of specifying input file, so we don't need custom setup or anything - -# place static lib in position for bundling with Cabal -# symlink does work! -# put it in Rust build script? -# or maybe in shell hook? well, that's probably not often enough, since it won't survive a `cabal clean` -ln -s $(pwd)/rust/target/debug/libgarnet_rs.a $(cabal list-bin . | sed -e 's=x/garnet/build/garnet/garnet=build=g') - -# cabal run