From c95ff2f983b0aefaf6177702c26b9677b126ca37 Mon Sep 17 00:00:00 2001 From: Glenn Thompson Date: Thu, 4 Sep 2025 18:28:58 +0300 Subject: [PATCH] Update build-executable.lisp to use custom SBCL path --- build-executable.lisp | 2 +- build-sbcl.sh | 124 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+), 1 deletion(-) create mode 100755 build-sbcl.sh diff --git a/build-executable.lisp b/build-executable.lisp index d6c846f..f87b658 100755 --- a/build-executable.lisp +++ b/build-executable.lisp @@ -1,4 +1,4 @@ -#!/usr/bin/sbcl --script +#!/usr/local/bin/sbcl --script ;; -*-lisp-*- (load "~/quicklisp/setup.lisp") diff --git a/build-sbcl.sh b/build-sbcl.sh new file mode 100755 index 0000000..59f382e --- /dev/null +++ b/build-sbcl.sh @@ -0,0 +1,124 @@ +#!/bin/bash + +# set -x + +clear + +# script should scale to accomodate systems with only one cpu, or systems with many. +system_type=$(uname) + +case "${system_type}" in + Linux) + num_jobs="$(grep -c 'core id' /proc/cpuinfo)";; + Darwin) + num_jobs=6;; +esac + +source_location="$HOME"/SourceCode/x-lisp-implementations/sbcl + +export crosslisp="$(which sbcl)" + +echo "this is the thing: $crosslisp" + +while getopts "p:s:t:x:" flag +do + case ${flag} in + p) num_jobs=${OPTARG};; + s) source_location=${OPTARG};; + t) source_tag=${OPTARG};; + x) crosslisp=${OPTARG};; + esac +done + +crosslisp="$(which "$crosslisp")" + +echo "this is the thing now: $crosslisp" + +echo "NUMBER OF PARALLEL JOBS: $num_jobs" +echo "IN SOURCE TREE: $source_location" + +export XCLISP="$crosslisp" + +echo "CROSSLISP:: $XCLISP" + +export SBCL_MAKE_JOBS=-j$num_jobs +export SBCL_MAKE_PARALLEL=$num_jobs + +# exit 0 + +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" + +if [ ! "$source_location" ] +then + source_location=~/SourceCode/x-lisp-implementations/sbcl/ +fi + +if [[ -d "$source_location" ]]; +then + echo "Using existing source repository in $source_location" + cd "$source_location" && + sh ./clean.sh && + git checkout master +else + echo 'Cloning SBCL source repository from https://github.com/sbcl/sbcl.git into ' "$source_location..." + mkdir -p "$(dirname "$source_location")" && + cd "$(dirname "$source_location")" && + git clone https://github.com/sbcl/sbcl.git && + cd "$source_location" || exit 1 +fi + +echo + +git fetch --all --tags +git pull --all + +## we can only calculate the source tag once we have a source +## repository, which is soonest, here. +if [[ ! $source_tag ]] +then + # this is a nice idiom to get the most recent tag in the + # repository. Defaults to master. + source_tag="$(git describe --tags "$(git rev-list --tags --max-count=1)")" +fi +echo "BUILDING TAG: $source_tag" +echo "With lisp: $crosslisp" + +echo +echo -n "Checking out $source_tag .. " + +git checkout "$source_tag" +echo '[Done]' +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" +sleep 2 + +# call the sbcl build bootstrap with an ANSI implementation of lisp. Prefer SBCL. +if [[ $(basename "$XCLISP") = "sbcl" ]] && [[ $(command -v "$XCLISP") ]]; then + sh ./make.sh --fancy --with-sb-linkable-runtime --with-sb-dynamic-core \ + --without-gencgc --with-mark-region-gc +elif [[ $(basename "$XCLISP") = "ccl" ]] && [[ $(command -v ccl) ]]; then + sh ./make.sh --fancy --xc-host="$XCLISP --batch --no-init" +elif [[ $(basename "$XCLISP") = "ccl64" ]] && [[ $(command -v ccl64) ]]; then + sh ./make.sh --fancy --xc-host="$XCLISP --batch --no-init" +elif [[ $(basename "$XCLISP") = "clisp" ]] && [[ $(command -v clisp) ]]; then + sh ./make.sh --fancy --xc-host="$XCLISP -batch -norc" +else + exit 6 +fi + +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" + +# make sbcl documentation + +echo "Making the Documentation... " +sleep 5 +cd doc/manual && make && + +echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" + +# run tests. + +echo "Running the tests... " + +sleep 5 + +cd "$source_location"/tests && sh ./run-tests.sh