0% found this document useful (0 votes)
2 views1 page

Script

This script installs the standalone rookcc compiler, requiring Free Pascal and make for building from source. It allows customization of the installation prefix and provides usage instructions. The script checks for necessary commands and updates the user's PATH if needed.

Uploaded by

ohf9ck
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Script

This script installs the standalone rookcc compiler, requiring Free Pascal and make for building from source. It allows customization of the installation prefix and provides usage instructions. The script checks for necessary commands and updates the user's PATH if needed.

Uploaded by

ohf9ck
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

#!

/usr/bin/env sh
set -eu

cd "$(dirname "$0")/.."

if [ "$(id -u)" -eq 0 ]; then default_prefix=/usr/local; else


default_prefix=$HOME/.local; fi
prefix=${PREFIX:-$default_prefix}
install_rookcc=${INSTALL_ROOKCC:-1}

usage() {
cat <<USAGE
usage: scripts/[Link] [--prefix dir] [--no-rookcc]

build and install the standalone rookcc compiler


free pascal is only required for building from source
the installed rcc binary does not invoke it
matching native hosted links may use the operating system compiler driver
USAGE
}

while [ "$#" -gt 0 ]; do


case $1 in
--prefix) shift; [ "$#" -gt 0 ] || { echo 'error: --prefix requires a
directory' >&2; exit 2; }; prefix=$1 ;;
--prefix=*) prefix=${1#*=} ;;
--no-rookcc) install_rookcc=0 ;;
-h|--help) usage; exit 0 ;;
*) echo "error: unknown option: $1" >&2; exit 2 ;;
esac
shift
done

command -v fpc >/dev/null 2>&1 || { echo 'error: free pascal is required to build
rookcc from source' >&2; exit 127; }
command -v make >/dev/null 2>&1 || { echo 'error: make is required to build rookcc
from source' >&2; exit 127; }
make
make PREFIX="$prefix" INSTALL_ROOKCC="$install_rookcc" install
case :$PATH: in *:"$prefix/bin":*) ;; *) printf '\nadd this to your shell profile\n
export PATH="%s/bin:$PATH"\n' "$prefix" ;; esac

You might also like