75 lines
1.9 KiB
Markdown
75 lines
1.9 KiB
Markdown
# Building
|
|
|
|
Install dependencies (uthash, libffi) then:
|
|
|
|
```sh
|
|
meson setup builddir
|
|
meson compile -C builddir
|
|
```
|
|
|
|
Install with:
|
|
|
|
```sh
|
|
meson install -C builddir
|
|
```
|
|
|
|
# Cross Compiling for Windows
|
|
|
|
We all hate Windows, right? As much as we hate it, people still use it, so it's nice to be able to run our good software on their crappy platform.
|
|
|
|
You'll need the cross compiler (install command is for Arch and derivatives):
|
|
|
|
```sh
|
|
sudo pacman -S mingw-w64-gcc
|
|
```
|
|
|
|
First, cross compile libffi for Windows (look up a guide) and install it to `/usr/x86_64-w64-mingw32/`.
|
|
|
|
Cross compile for Windows with the following commands:
|
|
|
|
```sh
|
|
meson setup --cross-file x86_64-w64-mingw32.txt -Ddefault_library=static --prefix=/usr/x86_64-w64-mingw32/ windows-builddir
|
|
meson compile -C windows-builddir
|
|
```
|
|
|
|
If you'd like it to be installed as a library to link with (for example with Solstice), run
|
|
|
|
```sh
|
|
meson install -C windows-builddir
|
|
```
|
|
|
|
This will install it to `/usr/x86_64-w64-mingw32/`, for convenient usage with other Windows cross compilation projects.
|
|
|
|
You may need to run `ldconfig` or reboot to update your ld cache.
|
|
|
|
## Bytecode Format
|
|
|
|
Under the hood, Ground uses a bytecode format to store things.
|
|
|
|
## Changes from old CGround
|
|
|
|
### `extern` instruction
|
|
|
|
`extern` no longer loads a dynamic library from /usr/lib/ground, it is now used to detail a system shared library to open.
|
|
|
|
Format: `extern "libName" "symbolName" !functionName -returnType -argType...`
|
|
|
|
### `getfield`, `setfield`, `callmethod`
|
|
|
|
Due to the new bytecode format, these instructions go from this format
|
|
|
|
```
|
|
getfield $parent &fields... &output
|
|
setfield &parent &fields... $input
|
|
callmethod &parent &fields... !functionName $args... &output
|
|
```
|
|
|
|
to this format:
|
|
```
|
|
getfield $parent -type (&field -type)... &output
|
|
setfield &parent -type (&field -type)... $input
|
|
callmethod &parent -type (&field -type)... !functionName $args... &output
|
|
```
|
|
|
|
so offsets for instructions can be computed before runtime.
|