Compare commits
2 Commits
718554cb2e
...
4ecd0b16e2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ecd0b16e2 | ||
|
|
ddb9c300cf |
@ -1,4 +1,4 @@
|
||||
cabal-version: 3.0
|
||||
cabal-version: 3.14
|
||||
name: garnet
|
||||
version: 0.1.0.0
|
||||
license: BSD-3-Clause
|
||||
@ -40,6 +40,7 @@ library
|
||||
GarnetRs.Raw
|
||||
GarnetRs.Wrapped
|
||||
hs-source-dirs: lib
|
||||
include-dirs: rust/target/debug
|
||||
extra-bundled-libraries: garnet_rs
|
||||
build-depends:
|
||||
base,
|
||||
|
||||
@ -9,12 +9,12 @@ set -euo pipefail
|
||||
# 1. cargo build - build the Rust static library
|
||||
# 2. cbindgen - generate a C header from the Rust source
|
||||
# 3. awk - patch the header for hs-bindgen compatibility
|
||||
# 4. cabal configure - point Cabal at the Rust build artifacts
|
||||
# 4. cp - copy static lib
|
||||
#
|
||||
# System include paths (needed by libclang on NixOS) are detected
|
||||
# automatically at TH compile time by GarnetRs.Raw — no env vars needed.
|
||||
#
|
||||
# Prerequisites: run inside the Nix dev shell (provides gcc, cabal, cbindgen).
|
||||
# Prerequisites: run inside the Nix dev shell (provides gcc, cbindgen).
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
RUST_DIR="$SCRIPT_DIR/rust"
|
||||
@ -58,15 +58,10 @@ awk '
|
||||
|
||||
echo " Patched header at $HEADER"
|
||||
|
||||
# --- Step 4: Configure Cabal ---
|
||||
# --- Step 4: Copy static lib for Cabal ---
|
||||
#
|
||||
# Point Cabal at the Rust static library and C header. This writes
|
||||
# cabal.project.local (gitignored) with absolute paths derived from
|
||||
# the current working directory, avoiding hardcoded paths in cabal.project.
|
||||
echo "=== Configuring Cabal ==="
|
||||
cabal configure \
|
||||
--extra-lib-dirs="$RUST_DIR/target/debug" \
|
||||
--extra-include-dirs="$RUST_DIR/target/debug"
|
||||
# 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')
|
||||
|
||||
echo "=== Done ==="
|
||||
echo "Run 'cabal run' to test."
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user