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