Files
gentoo/eclass/common-lisp-3.eclass
T
Robin H. Johnson 56bd759df1 proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.

This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.

Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
2015-08-08 17:38:18 -07:00

212 lines
6.0 KiB
Bash

# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
# @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
}