summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
Diffstat (limited to 'eclass')
-rw-r--r--eclass/elisp-common.eclass37
-rw-r--r--eclass/elisp.eclass25
2 files changed, 52 insertions, 10 deletions
diff --git a/eclass/elisp-common.eclass b/eclass/elisp-common.eclass
index 30dad3b..6fe54e3 100644
--- a/eclass/elisp-common.eclass
+++ b/eclass/elisp-common.eclass
@@ -10,7 +10,7 @@
# Mamoru Komachi <usata@gentoo.org>
# Christian Faulhammer <fauli@gentoo.org>
# Ulrich Müller <ulm@gentoo.org>
-# @SUPPORTED_EAPIS: 6 7
+# @SUPPORTED_EAPIS: 4 5 6 7
# @BLURB: Emacs-related installation utilities
# @DESCRIPTION:
#
@@ -166,7 +166,7 @@
# to above calls of elisp-site-regen().
case ${EAPI:-0} in
- 6) inherit eapi7-ver ;;
+ 4|5|6) inherit eapi7-ver ;;
7) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
@@ -277,6 +277,27 @@ elisp-check-emacs-version() {
fi
}
+# Test if the eselected Emacs version is at least the major version
+# of GNU Emacs specified as argument.
+# Return 0 if true, 1 if false, 2 if trouble.
+# Deprecated, use elisp-check-emacs-version instead.
+
+elisp-need-emacs() {
+ local need_emacs=$1 have_emacs
+ have_emacs=$(elisp-emacs-version) || return 2
+ einfo "Emacs version: ${have_emacs}"
+ if [[ ${have_emacs} =~ XEmacs|Lucid ]]; then
+ eerror "This package needs GNU Emacs."
+ return 1
+ fi
+ if ! [[ ${have_emacs%%.*} -ge ${need_emacs%%.*} ]]; then
+ eerror "This package needs at least Emacs ${need_emacs%%.*}."
+ eerror "Use \"eselect emacs\" to select the active version."
+ return 1
+ fi
+ return 0
+}
+
# @FUNCTION: elisp-compile
# @USAGE: <list of elisp files>
# @DESCRIPTION:
@@ -360,6 +381,10 @@ elisp-install() {
elisp-modules-install() {
local subdir="$1"
shift
+ # Don't bother inheriting multilib.eclass for get_libdir(), but
+ # error out in old EAPIs that don't support it natively.
+ [[ ${EAPI} == [45] ]] \
+ && die "${ECLASS}: Dynamic modules not supported in EAPI ${EAPI}"
ebegin "Installing dynamic modules for GNU Emacs support"
( # subshell to avoid pollution of calling environment
exeinto "${EMACSMODULES//@libdir@/$(get_libdir)}/${subdir}"
@@ -387,7 +412,13 @@ elisp-site-file-install() {
sf="${T}/${sf}"
ebegin "Installing site initialisation file for GNU Emacs"
[[ $1 == "${sf}" ]] || cp "$1" "${sf}"
- modules=${EMACSMODULES//@libdir@/$(get_libdir)}
+ [[ $1 == "${sf}" ]] || cp "$1" "${sf}"
+ if [[ ${EAPI} == [45] ]]; then
+ grep -q "@EMACSMODULES@" "${sf}" \
+ && die "${ECLASS}: Dynamic modules not supported in EAPI ${EAPI}"
+ else
+ modules=${EMACSMODULES//@libdir@/$(get_libdir)}
+ fi
sed -i -e "1{:x;/^\$/{n;bx;};/^;.*${PN}/I!s:^:${header}\n\n:;1s:^:\n:;}" \
-e "s:@SITELISP@:${EPREFIX}${SITELISP}/${my_pn}:g" \
-e "s:@SITEETC@:${EPREFIX}${SITEETC}/${my_pn}:g" \
diff --git a/eclass/elisp.eclass b/eclass/elisp.eclass
index d763a49..10c16ce 100644
--- a/eclass/elisp.eclass
+++ b/eclass/elisp.eclass
@@ -9,7 +9,7 @@
# Jeremy Maitin-Shepard <jbms@attbi.com>
# Christian Faulhammer <fauli@gentoo.org>
# Ulrich Müller <ulm@gentoo.org>
-# @SUPPORTED_EAPIS: 6 7
+# @SUPPORTED_EAPIS: 4 5 6 7
# @BLURB: Eclass for Emacs Lisp packages
# @DESCRIPTION:
#
@@ -40,7 +40,7 @@
# Space separated list of patches to apply after unpacking the sources.
# Patch files are searched for in the current working dir, WORKDIR, and
# FILESDIR. This variable is semi-deprecated, preferably use the
-# PATCHES array instead.
+# PATCHES array instead if the EAPI supports it.
# @ECLASS-VARIABLE: ELISP_REMOVE
# @DEFAULT_UNSET
@@ -64,6 +64,7 @@
inherit elisp-common
case ${EAPI:-0} in
+ 4|5) inherit epatch ;;
6|7) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
@@ -73,7 +74,8 @@ EXPORT_FUNCTIONS src_{unpack,prepare,configure,compile,install} \
RDEPEND=">=app-editors/emacs-${NEED_EMACS}:*"
case ${EAPI} in
- 6) DEPEND="${RDEPEND}" ;;
+ 4) RDEPEND="${RDEPEND%:*}"; DEPEND="${RDEPEND}" ;;
+ 5|6) DEPEND="${RDEPEND}" ;;
*) BDEPEND="${RDEPEND}" ;;
esac
@@ -117,11 +119,17 @@ elisp_src_prepare() {
else
die "Cannot find ${patch}"
fi
- eapply "${file}"
+ case ${EAPI} in
+ 4|5) epatch "${file}" ;;
+ *) eapply "${file}" ;;
+ esac
done
- # apply PATCHES and any user patches
- default
+ # apply PATCHES (if supported in EAPI), and any user patches
+ case ${EAPI} in
+ 4|5) epatch_user ;;
+ *) default ;;
+ esac
if [[ -n ${ELISP_REMOVE} ]]; then
rm ${ELISP_REMOVE} || die
@@ -165,7 +173,10 @@ elisp_src_install() {
doinfo ${@/%.*/.info*}
fi
# install documentation only when explicitly requested
- [[ $(declare -p DOCS 2>/dev/null) == *=* ]] && einstalldocs
+ case ${EAPI} in
+ 4|5) [[ -n ${DOCS} ]] && dodoc ${DOCS} ;;
+ *) [[ $(declare -p DOCS 2>/dev/null) == *=* ]] && einstalldocs ;;
+ esac
if declare -f readme.gentoo_create_doc >/dev/null; then
readme.gentoo_create_doc
fi