{-# title: Building and Installing Bunny -} # Building and Installing Bunny ## Build environment requirements [Bunny](Bunny) can be built on Windows (MINGW) or Linux with GHC (Haskell Platform). In addition to what is included in the Haskell Platform, the following tools and libraries must be installed beforehand. - Tools - GNU Make - HLint - Alex - Happy - Libraries - ansi-wl-pprint - optparse-applicative To make Android applications with Bunny, [Android Studio](https://developer.android.com/studio) and [Android SDK Platform Tools](https://developer.android.com/studio/releases/platform-tools) are needed. After installing Android Studio, you have to create at least one project on your system because Bunny needs ${local.properties} file of it. And you need to add ${jre/bin} of the Android Studio and ${platform-tools} of the Android SDK Platform Tools into your ${PATH} environment variable. By doing this, ${javac}, ${java} and ${adb} can be found in the `PATH` like the following example. $$
{
# On Windows (MINGW)
$ which javac
/c/Program Files/Android/Android Studio/jre/bin/javac
$ which java
/c/Program Files/Android/Android Studio/jre/bin/java
$ which adb
/c/Users//android/platform-tools/adb
$$}

$$
{
# On Linux
$ which javac
/home//android-studio/jre/bin/javac
$ which java
/home//android-studio/jre/bin/java
$ which adb
/home//Android/Sdk/platform-tools/adb
$$}

## Building

The Bunny project is built with GNU Make.

$$
{
cd compiler
make
$$}

When succeeded, you can run the sample program on the same system you build
Bunny. 


$$
{
bin/bunny testrun Hello.hs
$$}

This will print the following message.

$$
{
Hello, World!
$$}

## Installing

Before installing Bunny to your system, you have to import
${local.properties} from an Android Studio project.
This can be done like the following. MyFirstApp is just an example, and
please use the name of the project that you created by the Android Studio.

$$
{
cp ~/AndroidStudioProjects/MyFirstApp/local.properties AndroidProjectPrototype/
$$}

Then you can install Bunny with ${./install.sh}.
The installation directory will be ${$HOME/bunny/0.9.0} by default.
If you want to change this, specify the path as an argument of ${./install.sh}.

$$
{
./install.sh
$$}

As the ${./install.sh} will not change your ${PATH} environment variable,
the directory should be added manually to your ${PATH}.

## Usage

Run bunny with ${android} subcommand as shown below, it will compile the Haskell program and create an Android project containing the result of the compilation.

$$
{
bunny android 
$$}

Then go to the directory and type ${. /gradlew} (or ${. /gradlew.bat} (on Windows)} to build your Android application.

Example:

$$
{
bunny android sample/Hello.hs
cd ~/BunnyProjects/Hello
./gradlew assembleDebug
$$}