summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dev-lisp/clx/Manifest1
-rw-r--r--dev-lisp/clx/clx-0.7.4-r1.ebuild45
-rw-r--r--dev-lisp/clx/files/gentoo-fix-asd.patch303
-rw-r--r--dev-lisp/clx/files/gentoo-fix-dep-openmcl.patch21
-rw-r--r--dev-lisp/clx/files/gentoo-fix-dynamic-extent-sbcl-1.0.45.patch13
-rw-r--r--dev-lisp/clx/files/gentoo-fix-obsolete-eval-when.patch12
-rw-r--r--dev-lisp/clx/files/gentoo-fix-unused-vars.patch69
-rw-r--r--eclass/common-lisp-3.eclass211
8 files changed, 675 insertions, 0 deletions
diff --git a/dev-lisp/clx/Manifest b/dev-lisp/clx/Manifest
new file mode 100644
index 0000000..09db63d
--- /dev/null
+++ b/dev-lisp/clx/Manifest
@@ -0,0 +1 @@
+DIST clx-0.7.4.tgz 444490 SHA256 4a80f80255ace26eb8df214957dda3d7b7e51955537405ec893a34b18e569028
diff --git a/dev-lisp/clx/clx-0.7.4-r1.ebuild b/dev-lisp/clx/clx-0.7.4-r1.ebuild
new file mode 100644
index 0000000..513a5b7
--- /dev/null
+++ b/dev-lisp/clx/clx-0.7.4-r1.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+inherit common-lisp-3 eutils
+
+DESCRIPTION="CLX is the Common Lisp interface to the X11 protocol primarily for SBCL."
+HOMEPAGE="http://www.cliki.net/CLX"
+SRC_URI="http://common-lisp.net/~abridgewater/dist/${PN}/${P}.tgz"
+
+LICENSE="as-is"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~sparc ~x86"
+IUSE="doc"
+
+DEPEND="sys-apps/texinfo
+ doc? ( virtual/texi2dvi )"
+RDEPEND="!dev-lisp/cl-${PN}"
+
+src_prepare() {
+ rm -v {exclcmac,sockcl,defsystem,provide,cmudep}.lisp || die
+ epatch "${FILESDIR}"/gentoo-fix-asd.patch
+ epatch "${FILESDIR}"/gentoo-fix-dep-openmcl.patch
+ epatch "${FILESDIR}"/gentoo-fix-unused-vars.patch
+ epatch "${FILESDIR}"/gentoo-fix-obsolete-eval-when.patch
+ epatch "${FILESDIR}"/gentoo-fix-dynamic-extent-sbcl-1.0.45.patch
+}
+
+src_compile() {
+ cd manual
+ makeinfo ${PN}.texinfo -o ${PN}.info || die "Cannot compile info docs"
+ if use doc ; then
+ VARTEXFONTS="${T}"/fonts \
+ texi2pdf ${PN}.texinfo -o ${PN}.pdf || die "Cannot build PDF docs"
+ fi
+}
+
+src_install() {
+ common-lisp-install-sources *.lisp debug demo test
+ common-lisp-install-asdf
+ dodoc NEWS CHANGES README*
+ doinfo manual/${PN}.info
+ use doc && dodoc manual/${PN}.pdf
+}
diff --git a/dev-lisp/clx/files/gentoo-fix-asd.patch b/dev-lisp/clx/files/gentoo-fix-asd.patch
new file mode 100644
index 0000000..62ad587
--- /dev/null
+++ b/dev-lisp/clx/files/gentoo-fix-asd.patch
@@ -0,0 +1,303 @@
+diff -ur clx-0.7.4.orig/clx.asd clx-0.7.4/clx.asd
+--- clx-0.7.4.orig/clx.asd 2009-11-28 16:43:30.000000000 +0100
++++ clx-0.7.4/clx.asd 2009-11-29 22:29:11.000000000 +0100
+@@ -21,116 +21,80 @@
+ ;;; or implied warranty.
+
+ (defpackage :clx-system (:use :cl :asdf))
+-(in-package :clx-system)
++(in-package :clx-system)
+
+ (pushnew :clx-ansi-common-lisp *features*)
+
+ (defclass clx-source-file (cl-source-file) ())
+ (defclass xrender-source-file (clx-source-file) ())
+
+-;;; CL-SOURCE-FILE, not CLX-SOURCE-FILE, so that we're not accused of
+-;;; cheating by rebinding *DERIVE-FUNCTION-TYPES* :-)
+-(defclass example-source-file (cl-source-file) ())
+-
+-(defclass legacy-file (static-file) ())
+-
+-(defsystem CLX
+- :depends-on (#+sbcl sb-bsd-sockets)
+- :version "0.7.2"
+- :serial t
+- :default-component-class clx-source-file
++(defsystem clx
++ :depends-on (#+sbcl :sb-bsd-sockets)
++ :version "0.7.4"
++ :serial t
++ :default-component-class clx-source-file
++ :components
++ ((:file "package")
++ (:file "depdefs")
++ (:file "clx")
++ #-(or openmcl allegro) (:file "dependent")
++ #+openmcl (:file "dep-openmcl")
++ #+allegro (:file "dep-allegro")
++ (:file "macros")
++ (:file "bufmac")
++ (:file "buffer")
++ (:file "display")
++ (:file "gcontext")
++ (:file "input")
++ (:file "requests")
++ (:file "fonts")
++ (:file "graphics")
++ (:file "text")
++ (:file "attributes")
++ (:file "translate")
++ (:file "keysyms")
++ (:file "manager")
++ (:file "image")
++ (:file "resource")
++ #+allegro
++ (:file "excldep" :pathname "excldep.lisp")
++ (:module extensions
++ :pathname #.(make-pathname :directory '(:relative))
+ :components
+- ((:file "package")
+- (:file "depdefs")
+- (:file "clx")
+- #-(or openmcl allegro) (:file "dependent")
+- #+openmcl (:file "dep-openmcl")
+- #+allegro (:file "dep-allegro")
+- (:file "macros")
+- (:file "bufmac")
+- (:file "buffer")
+- (:file "display")
+- (:file "gcontext")
+- (:file "input")
+- (:file "requests")
+- (:file "fonts")
+- (:file "graphics")
+- (:file "text")
+- (:file "attributes")
+- (:file "translate")
+- (:file "keysyms")
+- (:file "manager")
+- (:file "image")
+- (:file "resource")
+- #+allegro
+- (:file "excldep" :pathname "excldep.lisp")
+- (:module extensions
+- :pathname #.(make-pathname :directory '(:relative))
+- :components
+- ((:file "shape")
+- (:file "big-requests")
+- (:file "xvidmode")
+- (:xrender-source-file "xrender")
+- (:file "glx")
+- (:file "gl" :depends-on ("glx"))
+- (:file "dpms")
+- (:file "xtest")
+- (:file "screensaver")
+- (:file "xinerama")))
+- (:module demo
+- :default-component-class example-source-file
+- :components
+- ((:file "bezier")
+- ;; KLUDGE: this requires "bezier" for proper operation,
+- ;; but we don't declare that dependency here, because
+- ;; asdf doesn't load example files anyway.
+- (:file "beziertest")
+- (:file "clclock")
+- (:file "clipboard")
+- (:file "clx-demos")
+- (:file "gl-test")
+- ;; FIXME: compiling this generates 30-odd spurious code
+- ;; deletion notes. Find out why, and either fix or
+- ;; workaround the problem.
+- (:file "mandel")
+- (:file "menu")
+- (:file "zoid")))
+- (:module test
+- :default-component-class example-source-file
+- :components
+- ((:file "image")
+- ;; KLUDGE: again, this depends on "zoid"
+- (:file "trapezoid")))
+- (:static-file "NEWS")
+- (:static-file "CHANGES")
+- (:static-file "README")
+- (:static-file "README-R5")
+- (:legacy-file "exclMakefile")
+- (:legacy-file "exclREADME")
+- (:legacy-file "exclcmac" :pathname "exclcmac.lisp")
+- (:legacy-file "excldepc" :pathname "excldep.c")
+- (:legacy-file "sockcl" :pathname "sockcl.lisp")
+- (:legacy-file "socket" :pathname "socket.c")
+- (:legacy-file "defsystem" :pathname "defsystem.lisp")
+- (:legacy-file "provide" :pathname "provide.lisp")
+- (:legacy-file "cmudep" :pathname "cmudep.lisp")
+- (:module manual
+- ;; TODO: teach asdf how to process texinfo files
+- :components ((:static-file "clx.texinfo")))
+- (:module debug
+- :default-component-class legacy-file
+- :components
+- ((:file "debug" :pathname "debug.lisp")
+- (:file "describe" :pathname "describe.lisp")
+- (:file "event-test" :pathname "event-test.lisp")
+- (:file "keytrans" :pathname "keytrans.lisp")
+- (:file "trace" :pathname "trace.lisp")
+- (:file "util" :pathname "util.lisp")))))
+-
+-(defmethod perform ((o load-op) (f example-source-file))
+- ;; do nothing. We want to compile them when CLX is compiled, but
+- ;; not load them when CLX is loaded.
+- t)
++ ((:file "shape")
++ (:file "big-requests")
++ (:file "xvidmode")
++ (:xrender-source-file "xrender")
++ (:file "glx")
++ (:file "gl" :depends-on ("glx"))
++ (:file "dpms")
++ (:file "xtest")
++ (:file "screensaver")
++ (:file "xinerama")))))
++
++(defsystem clx-test
++ :depends-on (:clx)
++ :serial t
++ :components
++ ((:file "image")
++ (:file "trapezoid")))
++
++(defsystem clx-demo
++ :depends-on (:clx)
++ :serial t
++ :components
++ ((:file "bezier")
++ (:file "beziertest")
++ (:file "clclock")
++ (:file "clipboard")
++ (:file "clx-demos")
++ (:file "gl-test")
++ ;; FIXME: compiling this generates 30-odd spurious code
++ ;; deletion notes. Find out why, and either fix or
++ ;; workaround the problem.
++ (:file "mandel")
++ (:file "menu")
++ (:file "zoid")))
+
+ #+sbcl
+ (defmethod perform :around ((o compile-op) (f xrender-source-file))
+@@ -146,35 +110,35 @@
+ ;; without STYLE-WARNINGs. Since it currently does, let's enforce
+ ;; it here so that we can catch regressions easily.
+ (let ((on-warnings (operation-on-warnings o))
+- (on-failure (operation-on-failure o)))
++ (on-failure (operation-on-failure o)))
+ (unwind-protect
+- (progn
+- (setf (operation-on-warnings o) :error
+- (operation-on-failure o) :error)
+- ;; a variety of accessors, such as AREF-CARD32, are not
+- ;; declared INLINE. Without this (non-ANSI)
+- ;; static-type-inference behaviour, SBCL emits an extra 100
+- ;; optimization notes (roughly one fifth of all of the
+- ;; notes emitted). Since the internals are unlikely to
+- ;; change much, and certainly the internals should stay in
+- ;; sync, enabling this extension is a win. (Note that the
+- ;; use of this does not imply that applications using CLX
+- ;; calls that expand into calls to these accessors will be
+- ;; optimized in the same way).
+- (let ((sb-ext:*derive-function-types* t)
++ (progn
++ (setf (operation-on-warnings o) :error
++ (operation-on-failure o) :error)
++ ;; a variety of accessors, such as AREF-CARD32, are not
++ ;; declared INLINE. Without this (non-ANSI)
++ ;; static-type-inference behaviour, SBCL emits an extra 100
++ ;; optimization notes (roughly one fifth of all of the
++ ;; notes emitted). Since the internals are unlikely to
++ ;; change much, and certainly the internals should stay in
++ ;; sync, enabling this extension is a win. (Note that the
++ ;; use of this does not imply that applications using CLX
++ ;; calls that expand into calls to these accessors will be
++ ;; optimized in the same way).
++ (let ((sb-ext:*derive-function-types* t)
+ (sadx (find-symbol "STACK-ALLOCATE-DYNAMIC-EXTENT" :sb-c))
+ (sadx-var (find-symbol "*STACK-ALLOCATE-DYNAMIC-EXTENT*" :sb-ext)))
+- ;; deeply unportable stuff, this. I will be shot. We
+- ;; want to enable the dynamic-extent declarations in CLX.
+- (when (and sadx (sb-c::policy-quality-name-p sadx))
+- ;; no way of setting it back short of yet more yukky stuff
+- (proclaim `(optimize (,sadx 3))))
++ ;; deeply unportable stuff, this. I will be shot. We
++ ;; want to enable the dynamic-extent declarations in CLX.
++ (when (and sadx (sb-c::policy-quality-name-p sadx))
++ ;; no way of setting it back short of yet more yukky stuff
++ (proclaim `(optimize (,sadx 3))))
+ (if sadx-var
+ (progv (list sadx-var) (list t)
+ (call-next-method))
+ (call-next-method))))
+ (setf (operation-on-warnings o) on-warnings
+- (operation-on-failure o) on-failure))))
++ (operation-on-failure o) on-failure))))
+
+ #+sbcl
+ (defmethod perform :around (o (f clx-source-file))
+@@ -186,31 +150,31 @@
+ ;; structured data is sufficiently equal.
+ (handler-bind
+ ((sb-ext:defconstant-uneql
+- (lambda (c)
+- ;; KLUDGE: this really means "don't warn me about
+- ;; efficiency of generic array access, please"
+- (declare (optimize (sb-ext:inhibit-warnings 3)))
+- (let ((old (sb-ext:defconstant-uneql-old-value c))
+- (new (sb-ext:defconstant-uneql-new-value c)))
+- (typecase old
+- (list (when (equal old new) (abort c)))
+- (string (when (and (typep new 'string)
+- (string= old new))
+- (abort c)))
+- (simple-vector
+- (when (and (typep new 'simple-vector)
+- (= (length old) (length new))
+- (every #'eql old new))
+- (abort c)))
+- (array
+- (when (and (typep new 'array)
+- (equal (array-dimensions old)
+- (array-dimensions new))
+- (equal (array-element-type old)
+- (array-element-type new))
+- (dotimes (i (array-total-size old) t)
+- (unless (eql (row-major-aref old i)
+- (row-major-aref new i))
+- (return nil))))
+- (abort c))))))))
++ (lambda (c)
++ ;; KLUDGE: this really means "don't warn me about
++ ;; efficiency of generic array access, please"
++ (declare (optimize (sb-ext:inhibit-warnings 3)))
++ (let ((old (sb-ext:defconstant-uneql-old-value c))
++ (new (sb-ext:defconstant-uneql-new-value c)))
++ (typecase old
++ (list (when (equal old new) (abort c)))
++ (string (when (and (typep new 'string)
++ (string= old new))
++ (abort c)))
++ (simple-vector
++ (when (and (typep new 'simple-vector)
++ (= (length old) (length new))
++ (every #'eql old new))
++ (abort c)))
++ (array
++ (when (and (typep new 'array)
++ (equal (array-dimensions old)
++ (array-dimensions new))
++ (equal (array-element-type old)
++ (array-element-type new))
++ (dotimes (i (array-total-size old) t)
++ (unless (eql (row-major-aref old i)
++ (row-major-aref new i))
++ (return nil))))
++ (abort c))))))))
+ (call-next-method)))
diff --git a/dev-lisp/clx/files/gentoo-fix-dep-openmcl.patch b/dev-lisp/clx/files/gentoo-fix-dep-openmcl.patch
new file mode 100644
index 0000000..1ec3eca
--- /dev/null
+++ b/dev-lisp/clx/files/gentoo-fix-dep-openmcl.patch
@@ -0,0 +1,21 @@
+diff -ur clx-0.7.4.orig/dep-openmcl.lisp clx-0.7.4/dep-openmcl.lisp
+--- clx-0.7.4.orig/dep-openmcl.lisp 2009-11-28 16:43:30.000000000 +0100
++++ clx-0.7.4/dep-openmcl.lisp 2009-11-29 22:39:36.000000000 +0100
+@@ -492,7 +492,7 @@
+ ;;; value changes.
+
+ (defun process-block (whostate predicate &rest predicate-args)
+- (declare (dynamic-extern predicate-args))
++ (declare (dynamic-extent predicate-args))
+ (apply #'ccl:process-wait whostate predicate predicate-args))
+
+ ;;; PROCESS-WAKEUP: Check some other process' wait function.
+@@ -1113,7 +1113,7 @@
+ unit byte-lsb-first-p bit-lsb-first-p)
+ (declare (ignore bbuf boffset pixarray x y width height
+ padded-bytes-per-line bits-per-pixel unit
+- byte-lsb-first-p bit-lsp-first-p))
++ byte-lsb-first-p bit-lsb-first-p))
+ nil)
+
+ ;;; FAST-COPY-PIXARRAY - copy part of a pixarray into another
diff --git a/dev-lisp/clx/files/gentoo-fix-dynamic-extent-sbcl-1.0.45.patch b/dev-lisp/clx/files/gentoo-fix-dynamic-extent-sbcl-1.0.45.patch
new file mode 100644
index 0000000..961d1be
--- /dev/null
+++ b/dev-lisp/clx/files/gentoo-fix-dynamic-extent-sbcl-1.0.45.patch
@@ -0,0 +1,13 @@
+diff -ur clx-0.7.4.orig/requests.lisp clx-0.7.4/requests.lisp
+--- clx-0.7.4.orig/requests.lisp 2009-11-28 16:43:30.000000000 +0100
++++ clx-0.7.4/requests.lisp 2010-12-16 23:37:07.122629835 +0100
+@@ -466,8 +466,7 @@
+ (type event-key event-key)
+ (type (or null event-mask) event-mask)
+ (type generalized-boolean propagate-p)
+- (type (or null display) display)
+- (dynamic-extent args))
++ (type (or null display) display))
+ (unless event-mask (setq event-mask 0))
+ (unless display (setq display (window-display window)))
+ (let ((internal-event-code (get-event-code event-key))
diff --git a/dev-lisp/clx/files/gentoo-fix-obsolete-eval-when.patch b/dev-lisp/clx/files/gentoo-fix-obsolete-eval-when.patch
new file mode 100644
index 0000000..e1df016
--- /dev/null
+++ b/dev-lisp/clx/files/gentoo-fix-obsolete-eval-when.patch
@@ -0,0 +1,12 @@
+diff -ur clx-0.7.4.orig/depdefs.lisp clx-0.7.4/depdefs.lisp
+--- clx-0.7.4.orig/depdefs.lisp 2009-11-28 16:43:30.000000000 +0100
++++ clx-0.7.4/depdefs.lisp 2009-11-29 22:56:38.000000000 +0100
+@@ -142,7 +142,7 @@
+ ;;; overlapping array and image code.
+
+ #+(or lispm vax little-endian Minima)
+-(eval-when (eval compile load)
++(eval-when (:compile-toplevel :load-toplevel :execute)
+ (pushnew :clx-little-endian *features*))
+
+ #+lcl3.0
diff --git a/dev-lisp/clx/files/gentoo-fix-unused-vars.patch b/dev-lisp/clx/files/gentoo-fix-unused-vars.patch
new file mode 100644
index 0000000..96dc255
--- /dev/null
+++ b/dev-lisp/clx/files/gentoo-fix-unused-vars.patch
@@ -0,0 +1,69 @@
+diff -ur clx-0.7.4.orig/gl.lisp clx-0.7.4/gl.lisp
+--- clx-0.7.4.orig/gl.lisp 2009-11-28 16:43:30.000000000 +0100
++++ clx-0.7.4/gl.lisp 2009-11-29 22:46:37.000000000 +0100
+@@ -2274,7 +2274,7 @@
+ (let ((constant 0)
+ (calculated ()))
+ (loop
+- for (name type length length-var) in argspecs
++ for (nil type length length-var) in argspecs
+ do (let ((byte-width (byte-width type)))
+ (typecase length
+ (number (incf constant (* byte-width length)))
+@@ -2287,7 +2287,7 @@
+
+ (defun composite-args (argspecs)
+ (loop
+- for (name type length length-var) in argspecs
++ for (nil nil length length-var) in argspecs
+ when (consp length)
+ collect (list length-var length)))
+
+diff -ur clx-0.7.4.orig/xrender.lisp clx-0.7.4/xrender.lisp
+--- clx-0.7.4.orig/xrender.lisp 2009-11-28 16:43:30.000000000 +0100
++++ clx-0.7.4/xrender.lisp 2009-11-29 22:50:42.000000000 +0100
+@@ -408,7 +408,7 @@
+
+ (macrolet ((foo (&rest specs)
+ `(progn
+- ,@(loop for (type slot default) in specs
++ ,@(loop for (nil slot nil) in specs
+ for index from 0
+ collect
+ `(progn
+@@ -426,7 +426,7 @@
+ (data +X-RenderChangePicture+)
+ (picture picture)
+ (mask
+- ,@(loop for (type slot default) in specs
++ ,@(loop for (type slot nil) in specs
+ for index from 0
+ collect
+ `(,type (and
+@@ -454,7 +454,7 @@
+ (drawable
+ &key format
+ (picture (make-picture :display (drawable-display drawable)))
+- ,@(loop for (type slot default-value) in specs
++ ,@(loop for (nil slot nil) in specs
+ collect (cond ((eql slot 'clip-mask)
+ `(clip-mask :none))
+ (t
+@@ -475,7 +475,7 @@
+ (drawable drawable)
+ (picture-format format)
+ (mask
+- ,@(loop for (type slot default) in specs
++ ,@(loop for (type slot nil) in specs
+ collect
+ (cond ((eql slot 'clip-mask)
+ (list type `(and
+@@ -487,7 +487,7 @@
+ (%render-change-picture-clip-rectangles picture clip-mask))
+ (setf (picture-format picture) format)
+ (setf (picture-%server-values picture)
+- (vector ,@(loop for (type slot default) in specs
++ (vector ,@(loop for (nil slot default) in specs
+ collect
+ `(or ,slot ,default))))
+ (setf (picture-%values picture) (copy-seq (picture-%server-values picture)))
diff --git a/eclass/common-lisp-3.eclass b/eclass/common-lisp-3.eclass
new file mode 100644
index 0000000..52160cc
--- /dev/null
+++ b/eclass/common-lisp-3.eclass
@@ -0,0 +1,211 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+# @ECLASS: common-lisp-3.eclass
+# @MAINTAINER:
+# Common Lisp project <common-lisp@gentoo.org>
+# @BLURB: functions to support the installation of Common Lisp libraries
+# @DESCRIPTION:
+# Since Common Lisp libraries share similar structure, this eclass aims
+# to provide a simple way to write ebuilds with these characteristics.
+
+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: CLSOURCEROOT
+# @DESCRIPTION:
+# Default path of Common Lisp libraries sources. Sources will
+# be installed into ${CLSOURCEROOT}/${CLPACKAGE}.
+CLSOURCEROOT="${ROOT%/}"/usr/share/common-lisp/source
+
+# @ECLASS-VARIABLE: CLSYSTEMROOT
+# @DESCRIPTION:
+# Default path to find any asdf file. Any asdf files will be
+# symlinked in ${CLSYSTEMROOT}/${CLSYSTEM} as they may be in
+# an arbitrarily deeply nested directory under ${CLSOURCEROOT}/${CLPACKAGE}.
+CLSYSTEMROOT="${ROOT%/}"/usr/share/common-lisp/systems
+
+# @ECLASS-VARIABLE: CLPACKAGE
+# @DESCRIPTION:
+# Default package name. To override, set these after inheriting this eclass.
+CLPACKAGE="${PN}"
+
+PDEPEND="virtual/commonlisp"
+
+EXPORT_FUNCTIONS src_compile src_install
+
+# @FUNCTION: common-lisp-3_src_compile
+# @DESCRIPTION:
+# Since there's nothing to build in most cases, default doesn't do
+# anything.
+common-lisp-3_src_compile() { true; }
+
+# @FUNCTION: absolute-path-p
+# @DESCRIPTION:
+# Returns true if ${1} is an absolute path.
+absolute-path-p() {
+ [[ $# -eq 1 ]] || die "${FUNCNAME[0]} must receive one argument"
+ [[ ${1} == /* ]]
+}
+
+# @FUNCTION: common-lisp-install-one-source
+# @DESCRIPTION:
+# Installs ${2} source file in ${3} inside CLSOURCEROOT/CLPACKAGE.
+common-lisp-install-one-source() {
+ [[ $# -eq 3 ]] || die "${FUNCNAME[0]} must receive exactly three arguments"
+
+ local fpredicate=${1}
+ local source=${2}
+ local target="${CLSOURCEROOT}/${CLPACKAGE}/${3}"
+
+ if absolute-path-p "${source}" ; then
+ die "Cannot install files with absolute path: ${source}"
+ fi
+
+ if ${fpredicate} "${source}" ; then
+ insinto "${target}"
+ doins "${source}" || die "Failed to install ${source} into $(dirname "${target}")"
+ fi
+}
+
+# @FUNCTION: lisp-file-p
+# @DESCRIPTION:
+# Returns true if ${1} is lisp source file.
+lisp-file-p() {
+ [[ $# -eq 1 ]] || die "${FUNCNAME[0]} must receive one argument"
+
+ [[ ${1} =~ \.(lisp|lsp|cl)$ ]]
+}
+
+# @FUNCTION: common-lisp-get-fpredicate
+# @DESCRIPTION:
+# Outputs the corresponding predicate to check files of type ${1}.
+common-lisp-get-fpredicate() {
+ [[ $# -eq 1 ]] || die "${FUNCNAME[0]} must receive one argument"
+
+ local ftype=${1}
+ case ${ftype} in
+ "lisp") echo "lisp-file-p" ;;
+ "all" ) echo "true" ;;
+ * ) die "Unknown filetype specifier ${ftype}" ;;
+ esac
+}
+
+# @FUNCTION: common-lisp-install-sources
+# @USAGE: common-lisp-install-sources path [<other_paths>...]
+# @DESCRIPTION:
+# Recursively install lisp sources of type ${2} if ${1} is -t or
+# Lisp by default. When given a directory, it will be recursively
+# scanned for Lisp source files with suffixes: .lisp, .lsp or .cl.
+common-lisp-install-sources() {
+ local ftype="lisp"
+ if [[ ${1} == "-t" ]] ; then
+ ftype=${2}
+ shift ; shift
+ fi
+
+ [[ $# -ge 1 ]] || die "${FUNCNAME[0]} must receive one non-option argument"
+
+ local fpredicate=$(common-lisp-get-fpredicate "${ftype}")
+
+ for path in "${@}" ; do
+ if [[ -f ${path} ]] ; then
+ common-lisp-install-one-source ${fpredicate} "${path}" "$(dirname "${path}")"
+ 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"
+ fi
+ done
+}
+
+# @FUNCTION: common-lisp-install-one-asdf
+# @DESCRIPTION:
+# Installs ${1} asdf file in CLSOURCEROOT/CLPACKAGE and symlinks it in
+# CLSYSTEMROOT.
+common-lisp-install-one-asdf() {
+ [[ $# != 1 ]] && die "${FUNCNAME[0]} must receive exactly one argument"
+
+ # the suffix «.asd» is optional
+ local source=${1/.asd}.asd
+ common-lisp-install-one-source true "${source}" "$(dirname "${source}")"
+ local target="${CLSOURCEROOT%/}/${CLPACKAGE}/${source}"
+ dosym "${target}" "${CLSYSTEMROOT%/}/$(basename ${target})"
+}
+
+# @FUNCTION: common-lisp-install-asdf
+# @USAGE: common-lisp-install-asdf path [<other_paths>...]
+# @DESCRIPTION:
+# Installs all ASDF files and creates symlinks in CLSYSTEMROOT.
+# When given a directory, it will be recursively scanned for ASDF
+# files with extension .asd.
+common-lisp-install-asdf() {
+ dodir "${CLSYSTEMROOT}"
+
+ [[ $# = 0 ]] && set - ${CLSYSTEMS}
+ [[ $# = 0 ]] && set - $(find . -type f -name \*.asd)
+ for sys in "${@}" ; do
+ common-lisp-install-one-asdf ${sys}
+ done
+}
+
+# @FUNCTION: common-lisp-3_src_install
+# @DESCRIPTION:
+# Recursively install Lisp sources, asdf files and most common doc files.
+common-lisp-3_src_install() {
+ common-lisp-install-sources .
+ common-lisp-install-asdf
+ for i in AUTHORS README* HEADER TODO* CHANGELOG Change[lL]og CHANGES BUGS CONTRIBUTORS *NEWS* ; do
+ [[ -f ${i} ]] && dodoc ${i}
+ done
+}
+
+# @FUNCTION: common-lisp-export-impl-args
+# @USAGE: common-lisp-export-impl-args <lisp-implementation>
+# @DESCRIPTION:
+# Export a few variables containing the switches necessary
+# to make the CL implementation perform basic functions:
+# * 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
+common-lisp-export-impl-args() {
+ if [[ $# != 1 ]]; then
+ eerror "Usage: ${FUNCNAME[0]} lisp-implementation"
+ die "${FUNCNAME[0]}: wrong number of arguments: $#"
+ fi
+ case ${1} in
+ clisp)
+ CL_NORC="-norc"
+ CL_LOAD="-i"
+ CL_EVAL="-x"
+ ;;
+ clozure | ccl | openmcl)
+ CL_NORC="--no-init"
+ CL_LOAD="--load"
+ CL_EVAL="--eval"
+ ;;
+ cmucl)
+ CL_NORC="-nositeinit -noinit"
+ CL_LOAD="-load"
+ CL_EVAL="-eval"
+ ;;
+ ecl)
+ CL_NORC="-norc"
+ CL_LOAD="-load"
+ CL_EVAL="-eval"
+ ;;
+ sbcl)
+ CL_NORC="--sysinit /dev/null --userinit /dev/null"
+ CL_LOAD="--load"
+ CL_EVAL="--eval"
+ ;;
+ *)
+ die ${1} is not supported by ${0}
+ ;;
+ esac
+ export CL_NORC CL_LOAD CL_EVAL
+}