Skip to content

Instantly share code, notes, and snippets.

@gwerbin
Last active November 1, 2021 04:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gwerbin/67a8764c9becdaba2da34dc44ea6d13e to your computer and use it in GitHub Desktop.
Save gwerbin/67a8764c9becdaba2da34dc44ea6d13e to your computer and use it in GitHub Desktop.
Build and install Idris 2: https://www.idris-lang.org/
#!/bin/sh
### Bootstrap build from an existing Idris 2 compiler.
set -eux
cd idris2
## Build and install to final location, using whatever `idris2` is already in PATH.
install_prefix="${XDG_MISC_HOME:-$HOME/.local/opt}/idris2"
mkdir -p "$install_prefix"
make clean
make all PREFIX="$install_prefix"
make install PREFIX="$install_prefix"
make install-with-src-libs PREFIX="$install_prefix"
make install-libdocs PREFIX="$install_prefix"
make install-with-src-api PREFIX="$install_prefix" IDRIS2_BOOT="$install_prefix/bin/idris2"
#!/bin/sh
### Bootstrap build from an existing Idris 2 compiler that is new enough to
### build Idris 2 itself, but not the Idris 2 API.
set -eux
cd idris2
## Build and install to a temporary location, using whatever `idris2` is already in PATH.
# Temporary dir must be outside the source tree, to avoid getting destroyed by `make clean`.
install_tmp='../tmp/idris2-build'
mkdir -p "$install_tmp"
install_tmp="$(greadlink -f ../tmp/idris2-build)"
make clean
make all PREFIX="$install_tmp"
make install PREFIX="$install_tmp"
make install-libs PREFIX="$install_tmp"
## Build again and install to final location, using the compiler built above.
install_prefix="${XDG_MISC_HOME:-$HOME/.local/opt}/idris2"
mkdir -p "$install_prefix"
make clean
make all PREFIX="$install_prefix" IDRIS2_BOOT="$install_tmp/bin/idris2"
make install PREFIX="$install_prefix" IDRIS2_BOOT="$install_tmp/bin/idris2"
make install-with-src-libs PREFIX="$install_prefix"
make install-libdocs PREFIX="$install_prefix"
make install-with-src-api PREFIX="$install_prefix" IDRIS2_BOOT="$install_prefix/bin/idris2"
#!/bin/sh
### Full bootstrap build from source, without an existing Idris 2 compiler.
set -eux
cd idris2
scheme='chez'
stage1="$PWD/stage1" # Must be an absolute path
mkdir -p "$stage1"
make distclean
make bootstrap PREFIX="$stage1" SCHEME="$scheme"
make install PREFIX="$stage1"
stage2="${XDG_MISC_HOME:-$HOME/.local/opt}/idris2"
mkdir -p "$stage2"
make clean
make all PREFIX="$stage2" IDRIS2_BOOT="${stage1}/bin/idris2"
make install PREFIX="$stage2" IDRIS2_BOOT="${stage1}/bin/idris2"
make install-with-src-libs PREFIX="$stage2"
make install-libdocs PREFIX="$stage2"
make install-with-src-api PREFIX="$stage2" IDRIS2_BOOT="${stage2}/bin/idris2"
#!/bin/sh
set -eu
### Example usage:
### if ./ttc-version-changed.sh; then
### ./install_idris2_boot-api.sh
### else
### ./install_idris2.sh
### fi
#-ttcVersion = 66
#+ttcVersion = 67
gawk_prog='
/-ttcVersion =/ { ttc_before = $3 }
/+ttcVersion =/ { ttc_after = $3 }
END {
printf "%d -> %d\n", ttc_before, ttc_after
if (ttc_before == ttc_after) {
exit 1
} else {
exit 0
}
}
'
git -C ./idris2 diff 'HEAD@{1}' 'HEAD' -- src/Core/Binary.idr | gawk "$gawk_prog"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment