summaryrefslogtreecommitdiff
path: root/eclass/elisp.eclass
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /eclass/elisp.eclass
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
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
Diffstat (limited to 'eclass/elisp.eclass')
-rw-r--r--eclass/elisp.eclass204
1 files changed, 204 insertions, 0 deletions
diff --git a/eclass/elisp.eclass b/eclass/elisp.eclass
new file mode 100644
index 000000000000..6f1a6afdb140
--- /dev/null
+++ b/eclass/elisp.eclass
@@ -0,0 +1,204 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+#
+# @ECLASS: elisp.eclass
+# @MAINTAINER:
+# Gentoo GNU Emacs project <emacs@gentoo.org>
+# @AUTHOR:
+# Matthew Kennedy <mkennedy@gentoo.org>
+# Jeremy Maitin-Shepard <jbms@attbi.com>
+# Christian Faulhammer <fauli@gentoo.org>
+# Ulrich Müller <ulm@gentoo.org>
+# @BLURB: Eclass for Emacs Lisp packages
+# @DESCRIPTION:
+#
+# This eclass is designed to install elisp files of Emacs related
+# packages into the site-lisp directory. The majority of elisp packages
+# will only need to define the standard ebuild variables (like SRC_URI)
+# and optionally SITEFILE for successful installation.
+#
+# Emacs support for other than pure elisp packages is handled by
+# elisp-common.eclass where you won't have a dependency on Emacs itself.
+# All elisp-* functions are documented there.
+#
+# If the package's source is a single (in whatever way) compressed elisp
+# file with the file name ${P}.el, then this eclass will move ${P}.el to
+# ${PN}.el in src_unpack().
+
+# @ECLASS-VARIABLE: NEED_EMACS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If you need anything different from Emacs 23, use the NEED_EMACS
+# variable before inheriting elisp.eclass. Set it to the major version
+# your package uses and the dependency will be adjusted.
+
+# @ECLASS-VARIABLE: ELISP_PATCHES
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Space separated list of patches to apply after unpacking the sources.
+# Patch files are searched for in the current working dir, WORKDIR, and
+# FILESDIR.
+
+# @ECLASS-VARIABLE: ELISP_REMOVE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Space separated list of files to remove after unpacking the sources.
+
+# @ECLASS-VARIABLE: SITEFILE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Name of package's site-init file. The filename must match the shell
+# pattern "[1-8][0-9]*-gentoo.el"; numbers below 10 and above 89 are
+# reserved for internal use. "50${PN}-gentoo.el" is a reasonable choice
+# in most cases.
+
+# @ECLASS-VARIABLE: ELISP_TEXINFO
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Space separated list of Texinfo sources. Respective GNU Info files
+# will be generated in src_compile() and installed in src_install().
+
+# @ECLASS-VARIABLE: DOCS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# DOCS="blah.txt ChangeLog" is automatically used to install the given
+# files by dodoc in src_install().
+
+inherit elisp-common eutils
+
+case "${EAPI:-0}" in
+ 0|1) EXPORT_FUNCTIONS src_{unpack,compile,install} \
+ pkg_{setup,postinst,postrm} ;;
+ *) EXPORT_FUNCTIONS src_{unpack,prepare,configure,compile,install} \
+ pkg_{setup,postinst,postrm} ;;
+esac
+
+DEPEND=">=virtual/emacs-${NEED_EMACS:-23}"
+RDEPEND="${DEPEND}"
+
+# @FUNCTION: elisp_pkg_setup
+# @DESCRIPTION:
+# Test if the eselected Emacs version is sufficient to fulfil the major
+# version requirement of the NEED_EMACS variable.
+
+elisp_pkg_setup() {
+ elisp-need-emacs "${NEED_EMACS:-23}"
+ case $? in
+ 0) ;;
+ 1) die "Emacs version too low" ;;
+ *) die "Could not determine Emacs version" ;;
+ esac
+}
+
+# @FUNCTION: elisp_src_unpack
+# @DESCRIPTION:
+# Unpack the sources; also handle the case of a single *.el file in
+# WORKDIR for packages distributed that way. For EAPIs without
+# src_prepare, call elisp_src_prepare.
+
+elisp_src_unpack() {
+ [[ -n ${A} ]] && unpack ${A}
+ if [[ -f ${P}.el ]]; then
+ # the "simple elisp" case with a single *.el file in WORKDIR
+ mv ${P}.el ${PN}.el || die
+ [[ -d ${S} ]] || S=${WORKDIR}
+ fi
+
+ case "${EAPI:-0}" in
+ 0|1) [[ -d ${S} ]] && cd "${S}"
+ elisp_src_prepare ;;
+ esac
+}
+
+# @FUNCTION: elisp_src_prepare
+# @DESCRIPTION:
+# Apply any patches listed in ELISP_PATCHES. Patch files are searched
+# for in the current working dir, WORKDIR, and FILESDIR.
+
+elisp_src_prepare() {
+ local patch
+ for patch in ${ELISP_PATCHES}; do
+ if [[ -f ${patch} ]]; then
+ epatch "${patch}"
+ elif [[ -f ${WORKDIR}/${patch} ]]; then
+ epatch "${WORKDIR}/${patch}"
+ elif [[ -f ${FILESDIR}/${patch} ]]; then
+ epatch "${FILESDIR}/${patch}"
+ else
+ die "Cannot find ${patch}"
+ fi
+ done
+
+ # apply any user patches
+ epatch_user
+
+ if [[ -n ${ELISP_REMOVE} ]]; then
+ rm ${ELISP_REMOVE} || die
+ fi
+}
+
+# @FUNCTION: elisp_src_configure
+# @DESCRIPTION:
+# Do nothing, because Emacs packages seldomly bring a full build system.
+
+elisp_src_configure() { :; }
+
+# @FUNCTION: elisp_src_compile
+# @DESCRIPTION:
+# Call elisp-compile to byte-compile all Emacs Lisp (*.el) files.
+# If ELISP_TEXINFO lists any Texinfo sources, call makeinfo to generate
+# GNU Info files from them.
+
+elisp_src_compile() {
+ elisp-compile *.el
+ if [[ -n ${ELISP_TEXINFO} ]]; then
+ makeinfo ${ELISP_TEXINFO} || die
+ fi
+}
+
+# @FUNCTION: elisp_src_install
+# @DESCRIPTION:
+# Call elisp-install to install all Emacs Lisp (*.el and *.elc) files.
+# If the SITEFILE variable specifies a site-init file, install it with
+# elisp-site-file-install. Also install any GNU Info files listed in
+# ELISP_TEXINFO and documentation listed in the DOCS variable.
+
+elisp_src_install() {
+ elisp-install ${PN} *.el *.elc
+ if [[ -n ${SITEFILE} ]]; then
+ elisp-site-file-install "${FILESDIR}/${SITEFILE}"
+ fi
+ if [[ -n ${ELISP_TEXINFO} ]]; then
+ set -- ${ELISP_TEXINFO}
+ set -- ${@##*/}
+ doinfo ${@/%.*/.info*} || die
+ fi
+ if [[ -n ${DOCS} ]]; then
+ dodoc ${DOCS} || die
+ fi
+ if declare -f readme.gentoo_create_doc >/dev/null; then
+ readme.gentoo_create_doc
+ fi
+}
+
+# @FUNCTION: elisp_pkg_postinst
+# @DESCRIPTION:
+# Call elisp-site-regen, in order to collect the site initialisation for
+# all installed Emacs Lisp packages in the site-gentoo.el file.
+
+elisp_pkg_postinst() {
+ elisp-site-regen
+ if declare -f readme.gentoo_print_elog >/dev/null; then
+ readme.gentoo_print_elog
+ fi
+}
+
+# @FUNCTION: elisp_pkg_postrm
+# @DESCRIPTION:
+# Call elisp-site-regen, in order to collect the site initialisation for
+# all installed Emacs Lisp packages in the site-gentoo.el file.
+
+elisp_pkg_postrm() {
+ elisp-site-regen
+}