1 |
commit: 52fcc6b583bd158b7ff83789a5e9dbd24c0f2599 |
2 |
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jul 25 19:08:45 2020 +0000 |
4 |
Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Aug 3 16:43:39 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=52fcc6b5 |
7 |
|
8 |
elisp-common.eclass: Support installation of dynamic modules. |
9 |
|
10 |
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org> |
11 |
|
12 |
eclass/elisp-common.eclass | 42 ++++++++++++++++++++++++++++++++++++------ |
13 |
1 file changed, 36 insertions(+), 6 deletions(-) |
14 |
|
15 |
diff --git a/eclass/elisp-common.eclass b/eclass/elisp-common.eclass |
16 |
index 6fa2bbea614..0bf6c014af1 100644 |
17 |
--- a/eclass/elisp-common.eclass |
18 |
+++ b/eclass/elisp-common.eclass |
19 |
@@ -180,6 +180,12 @@ SITELISP=/usr/share/emacs/site-lisp |
20 |
# Directory where packages install miscellaneous (not Lisp) files. |
21 |
SITEETC=/usr/share/emacs/etc |
22 |
|
23 |
+# @ECLASS-VARIABLE: EMACSMODULES |
24 |
+# @DESCRIPTION: |
25 |
+# Directory where packages install dynamically loaded modules. |
26 |
+# May contain a @libdir@ token which will be replaced by $(get_libdir). |
27 |
+EMACSMODULES=/usr/@libdir@/emacs/modules |
28 |
+ |
29 |
# @ECLASS-VARIABLE: EMACS |
30 |
# @DESCRIPTION: |
31 |
# Path of Emacs executable. |
32 |
@@ -362,17 +368,37 @@ elisp-install() { |
33 |
eend $? "elisp-install: doins failed" || die |
34 |
} |
35 |
|
36 |
+# @FUNCTION: elisp-modules-install |
37 |
+# @USAGE: <subdirectory> <list of files> |
38 |
+# @DESCRIPTION: |
39 |
+# Install dynamic modules in EMACSMODULES directory. |
40 |
+ |
41 |
+elisp-modules-install() { |
42 |
+ local subdir="$1" |
43 |
+ shift |
44 |
+ # Don't bother inheriting multilib.eclass for get_libdir(), but |
45 |
+ # error out in old EAPIs that don't support it natively. |
46 |
+ [[ ${EAPI} == [45] ]] \ |
47 |
+ && die "${ECLASS}: Dynamic modules not supported in EAPI ${EAPI}" |
48 |
+ ebegin "Installing dynamic modules for GNU Emacs support" |
49 |
+ ( # subshell to avoid pollution of calling environment |
50 |
+ exeinto "${EMACSMODULES//@libdir@/$(get_libdir)}/${subdir}" |
51 |
+ doexe "$@" |
52 |
+ ) |
53 |
+ eend $? "elisp-modules-install: doins failed" || die |
54 |
+} |
55 |
+ |
56 |
# @FUNCTION: elisp-site-file-install |
57 |
# @USAGE: <site-init file> [subdirectory] |
58 |
# @DESCRIPTION: |
59 |
# Install Emacs site-init file in SITELISP directory. Automatically |
60 |
-# inserts a standard comment header with the name of the package (unless |
61 |
-# it is already present). Tokens @SITELISP@ and @SITEETC@ are replaced |
62 |
-# by the path to the package's subdirectory in SITELISP and SITEETC, |
63 |
-# respectively. |
64 |
+# inserts a standard comment header with the name of the package |
65 |
+# (unless it is already present). Tokens @SITELISP@, @SITEETC@, and |
66 |
+# @EMACSMODULES@ are replaced by the path to the package's subdirectory |
67 |
+# in SITELISP, SITEETC, and EMACSMODULES, respectively. |
68 |
|
69 |
elisp-site-file-install() { |
70 |
- local sf="${1##*/}" my_pn="${2:-${PN}}" ret |
71 |
+ local sf="${1##*/}" my_pn="${2:-${PN}}" modules ret |
72 |
local header=";;; ${PN} site-lisp configuration" |
73 |
|
74 |
[[ ${sf} == [0-9][0-9]*-gentoo*.el ]] \ |
75 |
@@ -381,9 +407,13 @@ elisp-site-file-install() { |
76 |
sf="${T}/${sf}" |
77 |
ebegin "Installing site initialisation file for GNU Emacs" |
78 |
[[ $1 = "${sf}" ]] || cp "$1" "${sf}" |
79 |
+ [[ ${EAPI} == [45] ]] && grep -q "@EMACSMODULES@" "${sf}" \ |
80 |
+ && die "${ECLASS}: Dynamic modules not supported in EAPI ${EAPI}" |
81 |
+ modules=${EMACSMODULES//@libdir@/$(get_libdir)} |
82 |
sed -i -e "1{:x;/^\$/{n;bx;};/^;.*${PN}/I!s:^:${header}\n\n:;1s:^:\n:;}" \ |
83 |
-e "s:@SITELISP@:${EPREFIX}${SITELISP}/${my_pn}:g" \ |
84 |
- -e "s:@SITEETC@:${EPREFIX}${SITEETC}/${my_pn}:g;\$q" "${sf}" |
85 |
+ -e "s:@SITEETC@:${EPREFIX}${SITEETC}/${my_pn}:g" \ |
86 |
+ -e "s:@EMACSMODULES@:${EPREFIX}${modules}/${my_pn}:g;\$q" "${sf}" |
87 |
( # subshell to avoid pollution of calling environment |
88 |
insinto "${SITELISP}/site-gentoo.d" |
89 |
doins "${sf}" |