sys-process/glances: revbump 3.1.4.1, add missing doc dep
[gentoo.git] / eclass / common-lisp-3.eclass
index 6b663956061c301aa27a08ca09fe8b8303ca8b0c..65ad5a58a343a4d17cf201467f951fbdefc0571e 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: common-lisp-3.eclass
 
 inherit eutils
 
-# CL packages in the overlay don't have their tarballs on the mirrors
-# so it's useless to mirror them
-RESTRICT="mirror"
+# @ECLASS-VARIABLE: CLIMPLEMENTATIONS
+# @DESCRIPTION:
+# Common Lisp implementations
+CLIMPLEMENTATIONS="sbcl clisp clozurecl cmucl ecls gcl abcl"
 
 # @ECLASS-VARIABLE: CLSOURCEROOT
 # @DESCRIPTION:
@@ -41,7 +42,9 @@ EXPORT_FUNCTIONS src_compile src_install
 # @DESCRIPTION:
 # Since there's nothing to build in most cases, default doesn't do
 # anything.
-common-lisp-3_src_compile() { true; }
+common-lisp-3_src_compile() {
+       true;
+}
 
 # @FUNCTION: absolute-path-p
 # @DESCRIPTION:
@@ -72,6 +75,7 @@ common-lisp-install-one-source() {
 }
 
 # @FUNCTION: lisp-file-p
+# @USAGE: <file>
 # @DESCRIPTION:
 # Returns true if ${1} is lisp source file.
 lisp-file-p() {
@@ -81,6 +85,7 @@ lisp-file-p() {
 }
 
 # @FUNCTION: common-lisp-get-fpredicate
+# @USAGE: <type>
 # @DESCRIPTION:
 # Outputs the corresponding predicate to check files of type ${1}.
 common-lisp-get-fpredicate() {
@@ -95,7 +100,7 @@ common-lisp-get-fpredicate() {
 }
 
 # @FUNCTION: common-lisp-install-sources
-# @USAGE: common-lisp-install-sources path [<other_paths>...]
+# @USAGE: <path> [...]
 # @DESCRIPTION:
 # Recursively install lisp sources of type ${2} if ${1} is -t or
 # Lisp by default. When given a directory, it will be recursively
@@ -117,12 +122,13 @@ common-lisp-install-sources() {
                elif [[ -d ${path} ]] ; then
                        common-lisp-install-sources -t ${ftype} $(find "${path}" -type f)
                else
-                       die "${path} it neither a regular file nor a directory"
+                       die "${path} is neither a regular file nor a directory"
                fi
        done
 }
 
 # @FUNCTION: common-lisp-install-one-asdf
+# @USAGE: <file>
 # @DESCRIPTION:
 # Installs ${1} asdf file in CLSOURCEROOT/CLPACKAGE and symlinks it in
 # CLSYSTEMROOT.
@@ -137,7 +143,7 @@ common-lisp-install-one-asdf() {
 }
 
 # @FUNCTION: common-lisp-install-asdf
-# @USAGE: common-lisp-install-asdf path [<other_paths>...]
+# @USAGE: <path> [...]
 # @DESCRIPTION:
 # Installs all ASDF files and creates symlinks in CLSYSTEMROOT.
 # When given a directory, it will be recursively scanned for ASDF
@@ -163,11 +169,23 @@ common-lisp-3_src_install() {
        done
 }
 
+# @FUNCTION: common-lisp-find-lisp-impl
+# @DESCRIPTION:
+# Outputs an installed Common Lisp implementation. Transverses
+# CLIMPLEMENTATIONS to find it.
+common-lisp-find-lisp-impl() {
+       for lisp in ${CLIMPLEMENTATIONS} ; do
+               [[ "$(best_version dev-lisp/${lisp})" ]] && echo "${lisp}" && return
+       done
+       die "No CommonLisp implementation found"
+}
+
 # @FUNCTION: common-lisp-export-impl-args
-# @USAGE: common-lisp-export-impl-args <lisp-implementation>
+# @USAGE: <lisp-implementation>
 # @DESCRIPTION:
-#   Export a few variables containing the switches necessary
-#   to make the CL implementation perform basic functions:
+# Export a few variables containing the switches necessary
+# to make the CL implementation perform basic functions:
+#   * CL_BINARY: Common Lisp implementation
 #   * CL_NORC: don't load syste-wide or user-specific initfiles
 #   * CL_LOAD: load a certain file
 #   * CL_EVAL: eval a certain expression at startup
@@ -176,13 +194,20 @@ common-lisp-export-impl-args() {
                eerror "Usage: ${FUNCNAME[0]} lisp-implementation"
                die "${FUNCNAME[0]}: wrong number of arguments: $#"
        fi
-       case ${1} in
+       CL_BINARY="${1}"
+       case "${CL_BINARY}" in
+               sbcl)
+                       CL_NORC="--sysinit /dev/null --userinit /dev/null"
+                       CL_LOAD="--load"
+                       CL_EVAL="--eval"
+                       ;;
                clisp)
                        CL_NORC="-norc"
                        CL_LOAD="-i"
                        CL_EVAL="-x"
                        ;;
-               clozure | ccl | openmcl)
+               clozure | clozurecl | ccl | openmcl)
+                       CL_BINARY="ccl"
                        CL_NORC="--no-init"
                        CL_LOAD="--load"
                        CL_EVAL="--eval"
@@ -192,19 +217,20 @@ common-lisp-export-impl-args() {
                        CL_LOAD="-load"
                        CL_EVAL="-eval"
                        ;;
-               ecl)
+               ecl | ecls)
+                       CL_BINARY="ecl"
                        CL_NORC="-norc"
                        CL_LOAD="-load"
                        CL_EVAL="-eval"
                        ;;
-               sbcl)
-                       CL_NORC="--sysinit /dev/null --userinit /dev/null"
+               abcl)
+                       CL_NORC="--noinit"
                        CL_LOAD="--load"
                        CL_EVAL="--eval"
                        ;;
                *)
-                       die ${1} is not supported by ${0}
+                       die "${CL_BINARY} is not supported by ${0}"
                        ;;
        esac
-       export CL_NORC CL_LOAD CL_EVAL
+       export CL_BINARY CL_NORC CL_LOAD CL_EVAL
 }