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 +``` 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 diff --git a/docs/beyond_llvm.md b/docs/beyond_llvm.md index 27a88cc6..9a931d03 100644 --- a/docs/beyond_llvm.md +++ b/docs/beyond_llvm.md @@ -6,13 +6,13 @@ While Keystone reuses a part of LLVM as its core (with quite a few of changes to The section below highlights the areas where Keystone shines. -- **Framework**: *llvm-mc* is a tool, but not a framework. Therefore, it is very tricky to build your own assembler tools on of LLVM, while this is the main purpose of Keystone. Keystone's API makes it easy to handle errors, report internal status of its core or change compilation mode at runtime, etc. +- **Framework**: *llvm-mc* is a tool, but not a framework. Therefore, it is very tricky to build your own assembler tools on top of LLVM, while this is the main purpose of Keystone. Keystone's API makes it easy to handle errors, report internal status of its core or change compilation mode at runtime, etc. -- **Lightweight**: Keystone is much more lightweight than LLVM because we stripped all the subsystems that do not involve in assembler. As a result, Keystone is more than 10 times smaller in size and in memory consumption. Initial verson of Keystone takes only 30 seconds to compile on a laptop, while LLVM needs 15 minutes to build. +- **Lightweight**: Keystone is much more lightweight than LLVM because we stripped all the subsystems that are not involved in assembly. As a result, Keystone is more than 10 times smaller in size and in memory consumption. The initial verson of Keystone takes only 30 seconds to compile on a laptop, while LLVM needs 15 minutes to build. -- **Flexibility**: LLVM's assembler is much more restricted. For example, it only accepts assembly in LLVM syntax. On the contrary, Keystone is going to support all kind of input, ranging from Nasm, Masm, etc. +- **Flexibility**: LLVM's assembler is much more restricted. For example, it only accepts assembly in LLVM syntax. On the contrary, Keystone is going to support all kinds of input, ranging from Nasm, Masm, etc. -- **Capability**: LLVM is for compiling & linking, so (understandably) some of its technical choices are not inline with an independent assembler like Keystone. For example, LLVM always put code and data in separate sections. However, it is very common for assembly to mix code and data in the same section (think about shellcode). Keystone is made to handle this kind of input very well. +- **Capability**: LLVM is for compiling & linking, so (understandably) some of its technical choices are not in line with an independent assembler like Keystone. For example, LLVM always puts code and data in separate sections. However, it is very common for assembly to mix code and data in the same section (think about shellcode). Keystone is made to handle this kind of input very well. - **Binding**: As a framework, Keystone supports multiple bindings on top of the core, starting with Python (more bindings will be added later). This makes it easy to be adopted by developers.