Skip to content

Latest commit

 

History

History
166 lines (115 loc) · 4.4 KB

File metadata and controls

166 lines (115 loc) · 4.4 KB

Installing Haskell Dependecies

First, install the following packages:

sudo apt install build-essential curl libffi-dev libffi8 libgmp-dev libgmp10 libncurses-dev pkg-config zlib1g-dev

Then, install the script:

curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh

Everything is generally default. However, if you plan on using vscode, make sure you install the Haskell Language Server.

Then, go ahead and refresh your shell:

source ~/.bashrc

In blaze-platform, we use stack for building and testing. Install stack using the ghcup:

ghcup install stack

Next, you will need to clone z3:

git clone https://github.com/Z3Prover/z3.git

Then, build and install z3:

cd z3
./configure
mkdir -p build
cd build

Now, install z3:

make install

Installing Java and Setting Environment Variables

Now, you can install Java 21:

sudo apt install openjdk-21-jdk

Then, create environment variables for libjvm.so:

export JDK="$(dirname "$(dirname "$(readlink -f "$(which javac)")")")"
export PATH=$JDK/bin/${PATH:+:$PATH}
export LD_LIBRARY_PATH=$JDK/lib/server/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}

Building blaze-platform Monorepo

Now, clone blaze-platform:

git clone <repository link>.git
cd blaze-platform

First, build blaze before anything else:

cd blaze
stack build
stack test

Next, cd into ghidra-haskell and create an environment variable for libjvm.so:

export PATH=$JDK/bin/${PATH:+:$PATH}
export LD_LIBRARY_PATH=$JDK/lib/server/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}

Then, go ahead and build inside ghidra-haskell:

make res/ghidra.jar
stack build
stack test

Finally, build flint and test everything inside blaze-platform:

cd ..
stack build
stack test

Rapid Prototyping with Hspec library

You can quickly add features to blaze, flint, or ghidra-haskell by creating or adding to a *spec*.hs file. This will allow rapid development using Hspec library.

You can find all the *spec*.hs files with the following command below:

find . -iname "*spec*.hs" ! -path "*dist*"

You can run all test with stack test. However, its best to just run specific test using the --match flag.

stack test --test-arguments "--match MatcherSpec"

blaze-platform Versioning

blaze-platform versioning uses the format "N.YY.MMDDx" where "N" is the major version (0 before release), "YY" is the last two digits of the year, "MMDD" is the numerical month and date concatenated, and "x" is the alphabetical index of the version within the same day. For example, the third version of blaze-platform before release committed on June 3, 2007 would be "0.07.0603c".


How To Actually Run flint

See flint's README.md for instructions on running flint.

Miscellaneous Build Instructions

The following sections are for developers on MacOS. Also, blaze supported Binary Ninja backend in the past. This was before Ghidra was open source.


Special side directions for MacOS

  • Install the build-essentials stuff from x tools. OSX doesn't have the build-essential package in their repository, but it should automatically prompt the equivalent when trying to download build-essential
  • Get Haskell via the install_notes.txt instructions
  • Get Homebrew and install openjdk@21. Do not get the oracle version or any other version, if you do you have to remove it
  • get the blaze repo
  • run getGhidraJar.sh on the ghidra-haskell directory (so your terminal would be ghidra-haskell > ./scripts/getGhidraJar.sh
  • run stack build and stack test in the ghidra-haskell library