diff options
author | Peder Bergebakken Sundt <pbsds@hotmail.com> | 2024-06-06 23:55:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-06 23:55:33 +0200 |
commit | 4f06a00fa9f3a42d2fdc3c591e48628dec588c2c (patch) | |
tree | 7d7aed2c5541d970222ef6ffb4c820c01b8429c7 /doc | |
parent | 6384cd9ba614868321b83e73b18978247d2fcd49 (diff) | |
parent | cfa58200cd9958eea5221bf5dfcf82778a0e0220 (diff) |
Merge pull request #295155 from onemoresuza/hare-hook
hareHook: init
Diffstat (limited to 'doc')
-rw-r--r-- | doc/languages-frameworks/hare.section.md | 53 | ||||
-rw-r--r-- | doc/languages-frameworks/index.md | 1 |
2 files changed, 54 insertions, 0 deletions
diff --git a/doc/languages-frameworks/hare.section.md b/doc/languages-frameworks/hare.section.md new file mode 100644 index 000000000000..0ae8abeba45c --- /dev/null +++ b/doc/languages-frameworks/hare.section.md @@ -0,0 +1,53 @@ +# Hare {#sec-language-hare} + +## Building Hare programs with `hareHook` {#ssec-language-hare} + +The `hareHook` package sets up the environment for building Hare programs by +doing the following: + +1. Setting the `HARECACHE`, `HAREPATH` and `NIX_HAREFLAGS` environment variables; +1. Propagating `harec`, `qbe` and two wrapper scripts for the hare binary. + +It is not a function as is the case for some other languages --- *e. g.*, Go or +Rust ---, but a package to be added to `nativeBuildInputs`. + +## Attributes of `hareHook` {#hareHook-attributes} + +The following attributes are accepted by `hareHook`: + +1. `hareBuildType`: Either `release` (default) or `debug`. It controls if the + `-R` flag is added to `NIX_HAREFLAGS`. + +## Example for `hareHook` {#ex-hareHook} + +```nix +{ + hareHook, + lib, + stdenv, +}: stdenv.mkDerivation { + pname = "<name>"; + version = "<version>"; + src = "<src>"; + + nativeBuildInputs = [ hareHook ]; + + meta = { + description = "<description>"; + inherit (hareHook) badPlatforms platforms; + }; +} +``` + +## Cross Compilation {#hareHook-cross-compilation} + +`hareHook` should handle cross compilation out of the box. This is the main +purpose of `NIX_HAREFLAGS`: In it, the `-a` flag is passed with the architecture +of the `hostPlatform`. + +However, manual intervention may be needed when a binary compiled by the build +process must be run for the build to complete --- *e. g.*, when using Hare's +`hare` module for code generation. + +In those cases, `hareHook` provides the `hare-native` script, which is a wrapper +around the hare binary for using the native (`buildPlatform`) toolchain. diff --git a/doc/languages-frameworks/index.md b/doc/languages-frameworks/index.md index 920e5e7bd431..e8fee9c45216 100644 --- a/doc/languages-frameworks/index.md +++ b/doc/languages-frameworks/index.md @@ -19,6 +19,7 @@ dotnet.section.md emscripten.section.md gnome.section.md go.section.md +hare.section.md haskell.section.md hy.section.md idris.section.md |