Hash :
8e2a5ca4
Author :
Thomas de Grivel
Date :
2022-12-04T13:27:47
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
#!/bin/sh
## Copyright 2016-2022 kmx.io <contact@kmx.io>
##
## Permission is hereby granted to use this software granted
## the above copyright notice and this permission paragraph
## are included in all copies and substantial portions of this
## software.
##
## THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
## PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
## THIS SOFTWARE.
set -e
REPO_DIR=$HOME/common-lisp
GITHUB='https://github.com/'
KMX='https://git.kmx.io/'
# detect gnu make
if which gmake > /dev/null; then
MAKE=gmake
else
MAKE=make
fi
# clone git repo
maybe_clone() {
HOST="$1"
OWNER="$2"
NAME="$3"
if ! [ -d "${REPO_DIR}/${OWNER}/${NAME}" ]; then
echo "Installing ${HOST}${OWNER}/${NAME} into ${REPO_DIR}/${OWNER}/${NAME}"
mkdir -p "${REPO_DIR}/${OWNER}"
git -C "${REPO_DIR}/${OWNER}" clone "${HOST}${OWNER}/${NAME}"
fi
}
# Install ASDF from Github
maybe_clone "${GITHUB}" 'fare' 'asdf'
"${MAKE}" -C "${REPO_DIR}/fare/asdf"
# Install Repo from Github
maybe_clone "${KMX}" 'kmx.io' 'repo'
if ! [ -f "${REPO_DIR}/repo-index.lisp" ]; then
echo "Linking ${REPO_DIR}/repo-index.lisp"
( cd "${REPO_DIR}" && ln -s kmx.io/repo/repo-index.lisp; )
fi
# Configure SBCL
if grep -q "(load \"${REPO_DIR}/fare/asdf/build/asdf\")" ~/.sbclrc &&
grep -q "(load \"${REPO_DIR}/kmx.io/repo/repo\")" ~/.sbclrc &&
grep -q "(repo:boot)" ~/.sbclrc; then
:
else
echo Appending to ~/.sbclrc
{
echo "(load \"${REPO_DIR}/fare/asdf/build/asdf\")"
echo "(load \"${REPO_DIR}/kmx.io/repo/repo\")"
echo "(repo:boot)"
} >> ~/.sbclrc
fi