From b0994fac245f067e83775ffcd19e667ddd10b851 Mon Sep 17 00:00:00 2001 From: Ben Orchard Date: Wed, 30 Mar 2022 18:39:49 +0100 Subject: [PATCH 1/2] Haskell bindings: fix sdist generation/pkg install Cabal adds C source files to the sdist automatically, but not the contents of header dirs. That must be done explicitly. With this change,`cabal sdist` will produce a buildable sdist (previously, it would fail due to missing a header file). Also update package minor version to specifying the fixed version in dependencies. --- bindings/haskell/keystone.cabal | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bindings/haskell/keystone.cabal b/bindings/haskell/keystone.cabal index 9fd4716d..21892da4 100644 --- a/bindings/haskell/keystone.cabal +++ b/bindings/haskell/keystone.cabal @@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: keystone -version: 0.1.0.0 +version: 0.1.1.0 synopsis: Keystone lightweight multi-platform, multi-architecture assembler framework description: Haskell bindings for the Keystone assembler homepage: https://github.com/keystone-engine/keystone @@ -12,6 +12,8 @@ category: System build-type: Simple cabal-version: >= 1.10 +extra-source-files: src/include/*.h + library exposed-modules: Keystone.Internal.Core Keystone.Internal.Keystone From 93f1939eb08104f26b86cb9e8f4406808dd6c89d Mon Sep 17 00:00:00 2001 From: Ben Orchard Date: Wed, 30 Mar 2022 19:09:39 +0100 Subject: [PATCH 2/2] Haskell bindings: explain how to use as dependency --- bindings/haskell/README.md | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/bindings/haskell/README.md b/bindings/haskell/README.md index 3768de5d..7aa3c4a9 100644 --- a/bindings/haskell/README.md +++ b/bindings/haskell/README.md @@ -1,6 +1,5 @@ -This documentation explains how to install the Keystone Haskell bindings from -source. - +# Keystone Haskell bindings +## Building 1. Install the core Keystone Assembler as a dependency: Follow docs/COMPILE.md in the root directory to compile & install the core. @@ -25,3 +24,28 @@ To build a sample (after having built and installed the Haskell bindings): $ cd bindings/haskell $ ghc --make samples/Sample.hs ``` + +## Using as a dependency +### In a Cabal project +Add the following to the `cabal.project` file in the project root: + +```text +source-repository-package + type: git + location: https://github.com/keystone-engine/keystone + subdir: + bindings/haskell + tag: master + +-- if the file didn't already exist, add the following also +packages: . +``` + +### In a Stack project +Add the following to the `stack.yaml` file in the project root: + +```yaml +extra-deps: +- git: https://github.com/keystone-engine/keystone + subdir: bindings/haskell +```