Automating install on Linux and Mac

Robert Goldman rpgoldman at sift.net
Sun Oct 9 16:38:33 UTC 2016


I was reading over the install instructions, and since I have to install
ABCL on multiple platforms, I thought I would automate the process (at
least for Mac and Linux).

The approach I have taken requires the use of "stow", to get all the
bits of ABCL where you want them, and critically automates getting the
paths right.

Attached please find (1) a Makefile that automates the construction of
the "abcl" executable script, the abcl rlwrap completions, and the
installation in preparation for the use of "stow". (2) an
"abcl_template" file that the makefile will modify so that it can find
completions and jar files (both the main one and the contrib). (3) an
abcl_completions.lisp file that writes the completions.  Adding them to
the abcl-1.4.0 directory from the tarballs lets you do this:

make prepare-install
sudo make install
cd /usr/local/stow
sudo stow abcl

Cheers,
r

-------------- next part --------------
STOW_DIR ?= /usr/local
INSTALL_DIR = ${STOW_DIR}/stow/abcl
.PHONY : install prepare-install

prepare-install: abcl_completions abcl
	mkdir -p install
	mkdir -p install/bin
	mkdir -p install/share/java/abcl
	mkdir -p install/share/rlwrap/completions
	cp *.jar install/share/java/abcl/
	cp abcl_completions install/share/rlwrap/completions/abcl
	cp abcl	install/bin/abcl

install: prepare-install
	cp -r install ${INSTALL_DIR}

abcl_completions: abcl-completions.lisp
	java -jar abcl.jar --noinit --load abcl-completions.lisp
	cp ~/.abcl_completions abcl_completions

abcl: abcl_template
	perl -pe "s(\|ABCL_JAR_DIR\|)(${STOW_DIR}/share/java/abcl);s(\|STOW_DIR\|)(${STOW_DIR});" abcl_template > abcl
	chmod +x abcl

clean:
	rm abcl
	rm abcl_completions
	rm -rf install
-------------- next part --------------
#!/bin/sh
ABCL_JAR=|ABCL_JAR_DIR|/abcl.jar	# Use your own path here.
CONTRIB_JAR=|ABCL_JAR_DIR|/abcl-contrib.jar	# Use your own path here.
JAVA=$(which java)
ABCL="$JAVA -server -Xrs -cp $ABCL_JAR:$CONTRIB_JAR org.armedbear.lisp.Main"
if [ $# -eq 0 ]; then
	exec rlwrap -b "[]()'\" " --remember -c -f |STOW_DIR|/share/rlwrap/completions/abcl \
				  -H ~/.abcl_history -s 1000000 $ABCL
else
	exec $ABCL "$@"
fi
-------------- next part --------------
(defvar symbols nil)

(do-all-symbols (sym)
  (let ((package (symbol-package sym)))
       (cond
         ((not (fboundp sym)))
         ((or (eql #.(find-package :cl) package)
              (eql #.(find-package :extensions) package)
              (eql #.(find-package :cl-user) package))
          (pushnew (symbol-name sym) symbols))
         ((eql #.(find-package :keyword) package)
          (pushnew (concatenate 'string ":" (symbol-name sym)) symbols))
         (package
           (pushnew (concatenate 'string
                                 (package-name package)
                                 ":"
                                 (symbol-name sym))
                    symbols)))))
(with-open-file (output #.(concatenate 'string
                                       (getenv "HOME")
                                       "/.abcl_completions")
                        :direction :output :if-exists :overwrite
                        :if-does-not-exist :create)
  (format output "~{~(~A~)~%~}" (sort symbols #'string<)))
(quit))


More information about the armedbear-devel mailing list