Hare Language Installation - UTSARobotics/Knowledge GitHub Wiki
This guide covers how to install the Hare programming language on Linux or Mac. If using windows, it is recommended to use WSL.
To use this guide, copy each command line by line and enter it into your terminal.
I suggest you make a folder to save the required source code needed:
mkdir -p opt
cd opt
- Ubuntu or Debian:
sudo apt install make gcc
- Arch:
sudo pacman -Sy make gcc
- Fedora:
sudo dnf install make gcc
- macOS:
xcode-select --install
git clone git://c9x.me/qbe.git
cd qbe
make
sudo make install
cd ..
git clone https://git.sr.ht/~sircmpwn/scdoc
cd scdoc
make
sudo make install
cd ..
Set the platform
variable
export platform="$(uname | tr '[:upper:]' '[:lower:]')"
echo $platform
(Linux) Build and install on Linux:
git clone https://git.sr.ht/~sircmpwn/harec
cd harec
cp configs/$platform.mk config.mk
make
make check
sudo make install
cd ..
(Mac) Build and install from the darwin fork for Mac:
git https://github.com/hshq/harelang-harec.git harec
cd harec
sudo install -m755 rt/+darwin/build.sh /usr/local/bin/hare-arch.sh
for f in qbe as ld cc; do sudo ln -sf /usr/local/bin/hare-arch.sh /usr/local/bin/hare-$f.sh; done
cp configs/$platform.mk config.mk
make
make check
sudo make install
cd ..
Set the platform
variable
export platform="$(uname | tr '[:upper:]' '[:lower:]')"
echo $platform
(Linux) Build and install on Linux:
git clone https://git.sr.ht/~sircmpwn/hare
cd hare
ln -sf configs/$platform.mk config.mk
make
make check
sudo make install
cd ..
(Mac) Install the leap-seconds database.
curl "ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.list" -o leap-seconds.list
sudo install -m644 leap-seconds.list /var/db/ntpd.leap-seconds.list
Build and install from the darwin fork for Mac:
git clone https://github.com/hshq/harelang.git hare
cd hare
ln -sf configs/$platform.mk config.mk
export HARECACHE=.cache
make bootstrap
make
make check
sudo HARECACHE=$HARECACHE make install
cd ..
Note: on macOS, you need to set HAREPATH
and ASFLAGS
in your environment. Add the following to your ~/.zshrc
file:
export HAREPATH="/usr/local/src/hare/stdlib"
export ASFLAGS="-I $HAREPATH $ASFLAGS"
export HARECACHE="$HOME/.cache/hare"
There are several text editor plugins for Hare
- Geany:
https://git.sr.ht/~alecgraves/hare-geany
- Sublime:
https://git.sr.ht/~alecgraves/hare-sublime
The latest hare compiler (in 2024) has a "release" mode that will remove debugging features from the binary, and you can set LDLINKFLAGS to improve binary sizes too.
LDLINKFLAGS="--icf=safe --gc-sections --print-gc-sections --strip-all"
hare build -R
You can remove symbols from the hare runtime and make your final executable slightly smaller (14%, 2024) with strip
.
strip -no_uuid -no_split_info -xSN <binary>