harelang-harec icon indicating copy to clipboard operation
harelang-harec copied to clipboard

Mostly-working install script

Open electricWah opened this issue 2 months ago • 0 comments

I'm not sure if this is helpful or not, but it took me a bit to figure out so I thought I'd share. Without the ed hack, hare build errors out when callinghare-as.sh because HARECACHE isn't set for some reason. All tests pass except these (i don't think i did the leap seconds thing right):

time::chrono::utc_convfrom_tai: time/chrono/timescale.ha:204:38: Failed to initialize UTC timescale
time::chrono::utc_convto_tai: time/chrono/timescale.ha:123:38: Failed to initialize UTC timescale

But it seems to be working fine without that

#!/usr/bin/env zsh
# run this with '.' command, ie. ". $0;"

# clean - for testing, you can remove it
rm -rf prefix harelang-harec harelang
# testing prefix
mkdir prefix
PREFIX="$(realpath prefix)"
export PREFIX

# -------------

# install everything to ./bin
bin="$PREFIX/bin"
mkdir "$bin"
path+="$bin"
export path

git clone --depth 1 https://github.com/hshq/harelang-harec
cd harelang-harec
# fix build.sh
ed rt/+darwin/build.sh <<<'/function AS/a
        HARECACHE=${HARECACHE:-$HOME/.cache}
.
w'

cp rt/+darwin/build.sh "$bin/hare-build.sh"
for f in arch qbe as ld cc; do
	ln -sf ./hare-build.sh "$bin/hare-$f.sh"
done
ln -sf configs/darwin.mk config.mk
make -j2
make check
make install PREFIX=$PREFIX
cd ..

# ------------

git clone --depth 1 https://github.com/hshq/harelang
cd harelang
ln -sf configs/darwin.mk config.mk
# make bootstrap # not necessary?
make -j2
make install PREFIX=$PREFIX

electricWah avatar Oct 23 '25 02:10 electricWah