1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2024-12-22 23:47:56 +01:00
tinmop/quick_quicklisp.sh.in

169 lines
5.6 KiB
Bash
Raw Normal View History

2020-05-08 15:45:43 +02:00
#! @BASH@
# tinmop: an humble mastodon client
# Copyright (C) 2020 cage
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program.
# If not, see [[http://www.gnu.org/licenses/][http://www.gnu.org/licenses/]].
QUICKLISP_INSTALL_DIR=$HOME/quicklisp/
QUICKLISP_URL="https://beta.quicklisp.org/quicklisp.lisp"
QUICKLISP_SIG_URL="https://beta.quicklisp.org/quicklisp.lisp.asc"
QUICKLISP_KEY_URL="https://beta.quicklisp.org/release-key.txt"
QUICKLISP="quicklisp.lisp"
QUICKLISP_SIG="quicklisp.lisp.asc"
QUICKLISP_KEY="release-key"
QUICKLISP_SIGNATURE="D7A3 +489D +DEFE +32B7 +D0E7 +CC61 +3079 +65AB +028B +5FF7";
LISP_SOURCE_REGISTRY_DIR="$HOME/.config/common-lisp/"
LISP_SOURCE_REGISTRY_FILE="$LISP_SOURCE_REGISTRY_DIR/source-registry.conf"
BOLD_TEXT="\033[1m"
NORMAL_TEXT="\033[0m"
VERIFY_OK_RES=2
CROATOAN_GIT_URL=https://github.com/McParen/croatoan.git
CROATOAN_DIR="$QUICKLISP_INSTALL_DIR"/local-projects/croatoan/;
CROATOAN_COMMIT=000c60428fe73d796d4ee032cfa5901eb57b4703
2021-07-06 17:43:15 +02:00
2020-05-08 15:45:43 +02:00
echo_bold () {
echo -e "${BOLD_TEXT}${1}${NORMAL_TEXT}";
}
check_croatoan (){
if [ -d $CROATOAN_DIR ]; then
echo 0;
else
echo 1;
fi
}
2020-05-08 15:45:43 +02:00
check_quicklisp () {
if [ -d "$QUICKLISP_INSTALL_DIR" ]; then
echo 0;
else
echo 1;
fi
}
check_quicklisp_signature () {
chk1_prog='BEGIN {res=0} /Good signature.*release@quicklisp.org/ {res++; print res}'
chk2_prog="BEGIN {res=0} /${QUICKLISP_SIGNATURE}/ {res++; print res}"
res1=$(LC_MESSAGES="C" @GPG@ --verify quicklisp.lisp.asc quicklisp.lisp 2> >(@AWK@ -- "${chk1_prog}"))
res2=$(@GPG@ --verify quicklisp.lisp.asc quicklisp.lisp 2> >(@AWK@ -- "${chk2_prog}"))
2020-05-08 15:45:43 +02:00
res=$(expr $res1 + $res2)
echo -n "$res"
}
install_quicklisp () {
echo_bold "Downloading quicklisp...";
@CURL@ "$QUICKLISP_URL" > $QUICKLISP;
@CURL@ "$QUICKLISP_SIG_URL" > $QUICKLISP_SIG;
@CURL@ "$QUICKLISP_KEY_URL" > $QUICKLISP_KEY;
echo_bold "Importing gpg key.";
@GPG@ --import $QUICKLISP_KEY;
echo_bold "Verifing key";
signature_verified=$(check_quicklisp_signature);
if [ "$signature_verified" -ne $VERIFY_OK_RES ]; then
echo_bold "Key verification failed!"
exit 1;
else
echo_bold "Key sucessfully verified.";
@LISP_COMPILER@ --load $QUICKLISP \
--eval "(quicklisp-quickstart:install)" \
--eval "(ql:add-to-init-file)" \
--eval "(sb-ext:quit)";
2020-05-20 16:32:05 +02:00
@MKDIR_P@ $LISP_SOURCE_REGISTRY_DIR;
2020-05-08 15:45:43 +02:00
PAR_PWD="${PWD%/*}";
echo "(:source-registry" > $LISP_SOURCE_REGISTRY_FILE;
echo " (:tree \"$PAR_PWD\")" >> $LISP_SOURCE_REGISTRY_FILE;
echo ":inherit-configuration)" >> $LISP_SOURCE_REGISTRY_FILE;
echo "quicklisp installed";
fi
}
install_dependency () {
# add here the lisp dependency
# e.g.
# @LISP_COMPILER@ \ <- note the '\'
# --eval "(ql:quickload \"swank\")" \ <- note the '\'
# --eval "(sb-ext:quit)"; <- keep this line as latest
@LISP_COMPILER@ \
--eval "(ql:quickload \"alexandria\")" \
--eval "(ql:quickload \"cl-ppcre-unicode\")" \
2020-05-08 15:45:43 +02:00
--eval "(ql:quickload \"tooter\")" \
--eval "(ql:quickload \"croatoan\")" \
--eval "(ql:quickload \"osicat\")" \
--eval "(ql:quickload \"cl-spark\")" \
--eval "(ql:quickload \"access\")" \
--eval "(ql:quickload \"sqlite\")" \
--eval "(ql:quickload \"sxql\")" \
--eval "(ql:quickload \"sxql-composer\")" \
--eval "(ql:quickload \"marshal\")" \
--eval "(ql:quickload \"bordeaux-threads\")" \
--eval "(ql:quickload \"log4cl\")" \
--eval "(ql:quickload \"local-time\")" \
--eval "(ql:quickload \"cl-colors2\")" \
--eval "(ql:quickload \"cl-i18n\")" \
--eval "(ql:quickload \"clunit2\")" \
--eval "(ql:quickload \"esrap\")" \
--eval "(ql:quickload \"ieee-floats\")" \
--eval "(ql:quickload \"parse-number\")" \
--eval "(ql:quickload \"cl-html5-parser\")" \
--eval "(ql:quickload \"unix-opts\")" \
--eval "(ql:quickload \"crypto-shortcuts\")" \
--eval "(ql:quickload \"drakma\")" \
--eval "(ql:quickload \"usocket\")" \
--eval "(ql:quickload \"cffi\")" \
--eval "(ql:quickload \"babel\")" \
2020-06-23 15:22:28 +02:00
--eval "(ql:quickload \"percent-encoding\")" \
2020-05-08 15:45:43 +02:00
--eval "(sb-ext:quit)";
}
install_croatoan () {
installedp=$(check_croatoan);
if [ $installedp -eq 0 ]; then
cd $CROATOAN_DIR && @GIT@ pull
else
cd $QUICKLISP_INSTALL_DIR/local-projects/ && @GIT@ clone $CROATOAN_GIT_URL
fi
2021-07-06 17:43:15 +02:00
cd $CROATOAN_DIR && @GIT@ checkout $CROATOAN_COMMIT
}
2020-05-08 15:45:43 +02:00
quicklisp_installed_p=$(check_quicklisp);
if [ $quicklisp_installed_p -eq 0 ]; then
echo_bold "Quicklisp already installed; fetching libraries...";
install_dependency;
else
install_quicklisp;
install_dependency;
fi
echo_bold "installing croatoan from git repository...";
install_croatoan;
echo_bold "Finished.";