Skip to content

Commit

Permalink
Move build docs out of readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jeaye committed Mar 24, 2024
1 parent 9179905 commit 5ab24b0
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 74 deletions.
105 changes: 31 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,84 +29,41 @@ use yet**.
There are pre-compiled binaries for Ubuntu 22.04, which are built to follow the
`main` branch. You can download a tarball with everything you need here: https://github.com/jank-lang/jank/releases/tag/latest

## Building locally
### Dependencies
For Debian-based distros, this should be all you need:

```bash
sudo apt-get install -y curl git zip build-essential entr libssl-dev libdouble-conversion-dev pkg-config ninja-build python3-pip cmake debhelper devscripts gnupg zlib1g-dev entr libffi-dev clang libjemalloc-dev libreadline-dev
```

For Arch:

```bash
sudo pacman -S clang pkg-config cmake ninja make python3 libffi jemalloc entr
```

For macOS, try this:

```bash
brew install curl git zip entr openssl double-conversion pkg-config ninja python cmake gnupg zlib jemalloc
## Appetizer
```clojure
; Comments begin with a ;
(println "meow") ; => nil

; All built-in data structures are persistent and immutable.
(def george {:name "George Clooney"}) ; => #'user/george

; Though all data is immutable by default, side effects are adhoc.
(defn say-hi [who]
(println (str "Hi " (:name who) "!"))
(assoc who :greeted? true))

; Doesn't change george.
(say-hi george) ; => {:name "George Clooney"
; :greeted? true}

; Many core functions for working with immutable data.
(apply + (distinct [12 8 12 16 8 6])) ; => 42

; Interop with C++ can happen through inline C++.
(defn sleep [ms]
(let [ms (int ms)]
; A special ~{ } syntax can be used from inline C++ to interpolate
; back into jank code.
(native/raw "auto const duration(std::chrono::milliseconds(~{ ms }->data));
std::this_thread::sleep_for(duration);")))
```

Clone the repo as follows:

```bash
git clone --recurse-submodules https://github.com/jank-lang/jank.git

# If you didn't recurse submodules when cloning, you'll need to run this.
git submodule update --recursive --init
```

### Compiling Cling
Note that you must compile Cling/Clang/LLVM. This can take an hour or two,
depending on your machine. Building jank itself should take less than a minute.

```
mkdir -p build
cd build
../bin/build-cling
cd -
export CC=$PWD/build/cling-build/bin/clang; export CXX=$PWD/build/cling-build/bin/clang++;
```

At this point, you're ready to build jank.


### Compiling jank

#### Release
A typical release build just needs the following:

```bash
./bin/configure -GNinja -DCMAKE_BUILD_TYPE=Release -Djank_cling_build_dir=build/cling-build
./bin/compile
```

#### Debug
To make a debug build, specify the build type when configuring.

```bash
./bin/configure -GNinja -DCMAKE_BUILD_TYPE=Debug -Djank_cling_build_dir=build/cling-build -Djank_tests=on
./bin/compile

# When developing, continuously run the tests locally.
./bin/watch ./bin/test
```

### Packaging
There's also a script for installing jank and all its necessary dependencies.
Note that this includes a lot of header files, which are necessary for jank's
JIT compilation.

```bash
./bin/configure -GNinja -DCMAKE_BUILD_TYPE=Release -Djank_cling_build_dir=build/cling-build
./bin/install
```
## Docs
* [Building jank](./doc/build.md)

## Sponsors
If you'd like your name, company, or logo here, you can sponsor this project.
[![Sponsor](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&link=https://github.com/sponsors/jeaye&color=red)](https://github.com/sponsors/jeaye)
If you'd like your name, company, or logo here, you can
[sponsor this project](https://github.com/sponsors/jeaye).

<br/>

Expand Down
74 changes: 74 additions & 0 deletions doc/build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Building jank
## Dependencies
For Debian-based distros, this should be all you need:

```bash
sudo apt-get install -y curl git zip build-essential entr libssl-dev libdouble-conversion-dev pkg-config ninja-build python3-pip cmake debhelper devscripts gnupg zlib1g-dev entr libffi-dev clang libjemalloc-dev libreadline-dev
```

For Arch:

```bash
sudo pacman -S clang pkg-config cmake ninja make python3 libffi jemalloc entr
```

For macOS, try this:

```bash
brew install curl git zip entr openssl double-conversion pkg-config ninja python cmake gnupg zlib jemalloc
```

Clone the repo as follows:

```bash
git clone --recurse-submodules https://github.com/jank-lang/jank.git

# If you didn't recurse submodules when cloning, you'll need to run this.
git submodule update --recursive --init
```

## Compiling Cling
Note that you must compile Cling/Clang/LLVM. This can take an hour or two,
depending on your machine. Building jank itself should take less than a minute.

```
mkdir -p build
cd build
../bin/build-cling
cd -
export CC=$PWD/build/cling-build/bin/clang; export CXX=$PWD/build/cling-build/bin/clang++;
```

At this point, you're ready to build jank.


## Compiling jank

### Release
A typical release build just needs the following:

```bash
./bin/configure -GNinja -DCMAKE_BUILD_TYPE=Release -Djank_cling_build_dir=build/cling-build
./bin/compile
```

### Debug
To make a debug build, specify the build type when configuring.

```bash
./bin/configure -GNinja -DCMAKE_BUILD_TYPE=Debug -Djank_cling_build_dir=build/cling-build -Djank_tests=on
./bin/compile

# When developing, continuously run the tests locally.
./bin/watch ./bin/test
```

## Packaging
There's also a script for installing jank and all its necessary dependencies.
Note that this includes a lot of header files, which are necessary for jank's
JIT compilation.

```bash
./bin/configure -GNinja -DCMAKE_BUILD_TYPE=Release -Djank_cling_build_dir=build/cling-build
./bin/install
```

0 comments on commit 5ab24b0

Please sign in to comment.