Annotation of pkgsrc/editors/emacs/modules.mk, Revision 1.24
1.24 ! wiz 1: # $NetBSD: modules.mk,v 1.23 2018/06/20 11:15:44 mef Exp $
1.1 uebayasi 2: #
3: # This Makefile fragment handles Emacs Lisp Packages (== ELPs).
4: #
5: # Note to users:
6: #
1.4 uebayasi 7: # * Users choose one favourite Emacs version.
1.1 uebayasi 8: #
9: # * Emacs Lisp files are installed...
1.4 uebayasi 10: # GNU emacs
11: # -> ${PREFIX}/share/emacs/site-lisp/foo/...
1.1 uebayasi 12: # XEmacs
1.4 uebayasi 13: # ->${PREFIX}/lib/xemacs/site-packages/lisp/foo/...
1.1 uebayasi 14: #
15: # * You can't install an ELP for both Emacs and XEmacs
16: # simultaneously.
17: #
18: # * XEmacs package's names are prefix'ed by "xemacs-".
19: #
20: # Note to package developers:
21: #
22: # * XEmacs package's names are prefix'ed by "xemacs-".
23: #
24: # This is to make sure ELPs for XEmacs keep their own dependency
25: # tree (for example, if an ELP "bar" depends on another ELP "foo",
26: # "xemacs-bar" depends on "xemacs-foo". "foo" (installed for GNU
27: # Emacs) is useless for "xemacs-bar" in this case.).
28: #
29: # Make sure too that "foo" and "xemacs-foo" conflict each other,
30: # since they can share some files. (Making all ELPs separately
31: # installable for GNU Emacs/XEmacs might be possible.)
32: #
33: # * Assume each ELP supports all Emacs versions by default. If the
34: # ELP supports only certain Emacs versions, define EMACS_VERSIONS
35: # _ACCEPTED explicitly before including mk/emacs.mk.
36: #
37: # Variables for users:
38: #
39: # EMACS_TYPE
40: # Description:
1.4 uebayasi 41: # The user's favourite Emacs version. The default
42: # value is set in mk/defaults/mk.conf.
1.1 uebayasi 43: # Possible values:
1.24 ! wiz 44: # emacs26, emacs26nox, emacs25, emacs25nox, emacs21,
! 45: # emacs21nox, emacs20, xemacs215, xemacs215nox,
! 46: # xemacs214, xemacs214nox
1.1 uebayasi 47: # Default value:
1.24 ! wiz 48: # emacs26
1.1 uebayasi 49: #
50: # Variables ELPs can provide:
51: #
52: # EMACS_MODULES
53: # Description:
54: # List of Emacs LISP modules that the current ELP
55: # needs at run-time.
56: # Possible values:
57: # base, leim
58: # Default value:
59: # <undefined>
60: #
61: # EMACS_VERSIONS_ACCEPTED
62: # Description:
63: # Versions the ELP accepts (supports).
64: # Possible values:
1.24 ! wiz 65: # emacs26, emacs26nox, emacs25, emacs25nox, emacs21,
! 66: # emacs21nox, emacs20, xemacs215, xemacs215nox,
! 67: # xemacs214, xemacs214nox
1.1 uebayasi 68: # Default value:
1.24 ! wiz 69: # emacs26, emacs26nox, emacs25, emacs25nox, emacs21,
! 70: # emacs21nox, emacs20, xemacs215, xemacs215nox,
! 71: # xemacs214, xemacs214nox
1.1 uebayasi 72: #
1.2 uebayasi 73: # EMACS_BUILDLINK
74: # Description:
75: # Whether create buildlink directory of *.el / *.elc
76: # files. ELPs which include other ELP's buildlink3.mk
77: # must define this value.
78: # Possible values:
79: # <defined>, <undefined>
80: # Default value:
81: # <undefined>
82: #
1.1 uebayasi 83: # Variables provided for ELPs:
84: #
85: # EMACS_BIN
86: # Description:
87: # Path to Emacs executable.
88: # Possible values:
89: # ${PREFIX}/bin/emacs, ${PREFIX}/bin/xemacs
90: #
91: # EMACS_ETCPREFIX
92: # Description:
93: # Path to the directory misc. files should be
94: # installed into. ELPs should append a short
95: # name as a subdirectory.
96: # Possible values:
97: # ${PREFIX}/share
1.4 uebayasi 98: # ${PREFIX}/lib/xemacs/site-packages/etc
1.1 uebayasi 99: #
100: # EMACS_FLAVOR
101: # Description:
102: # GNU Emacs (emacs) or XEmacs (xemacs).
103: # Possible values:
104: # emacs, xemacs
105: #
106: # EMACS_INFOPREFIX
107: # Description:
108: # Path to the directory Info files should be
109: # installed into. Unlike EMACS_ETCPREFIX or
110: # EMACS_LISPPREFIX, subdirectory is not needed.
111: # Possible values:
112: # ${PREFIX}/${PKGINFODIR}
1.4 uebayasi 113: # ${PREFIX}/lib/xemacs/site-packages/info
1.1 uebayasi 114: #
115: # EMACS_LISPPREFIX
116: # Description:
117: # installed into. ELPs should append a short name
118: # as a subdirectory.
119: # Possible values:
120: # ${PREFIX}/share/emacs/site-lisp
1.4 uebayasi 121: # ${PREFIX}/lib/xemacs/site-packages/lisp
1.1 uebayasi 122: #
123: # EMACS_PKGNAME_PREFIX
124: # Description:
125: # The prefix of PKGNAME and DEPENDS lines. All ELPs
126: # must honour this!
127: # Possible values:
128: # "", "xemacs-"
129: #
130: # EMACS_VERSION_MAJOR
131: # Description:
132: # Emacs major version.
133: # Possible values:
1.24 ! wiz 134: # 20, 21, 25, 26, <integers more than that in the future>
1.1 uebayasi 135: #
136: # EMACS_VERSION_MINOR
137: # Description:
138: # Emacs minor version.
139: # Possible values:
140: # <integer>
141: #
1.6 minskim 142: # EMACS_VERSION_MICRO
143: # Description:
144: # Emacs micro version.
145: # Possible values:
146: # <integer>
147: #
1.1 uebayasi 148: # Variables provided in ELPs' PLIST:
149: #
150: # EMACS_ETCPREFIX
151: # Description:
152: # Same as the one in Makefile, except that
153: # ${PREFIX} is omitted in PLIST.
154: # Possible values:
155: # share
1.4 uebayasi 156: # lib/xemacs/site-packages/etc
1.1 uebayasi 157: #
158: # EMACS_INFOPREFIX
159: # Description:
160: # Same as the one in Makefile, except that
161: # ${PREFIX} is omitted in PLIST.
162: # Possible values:
163: # ${PKGINFODIR}
1.4 uebayasi 164: # lib/xemacs/site-packages/info
1.1 uebayasi 165: #
166: # EMACS_LISPPREFIX
167: # Description:
168: # Same as the one in Makefile, except that
169: # ${PREFIX} is omitted in PLIST.
170: # Possible values:
171: # share/emacs/site-lisp
1.4 uebayasi 172: # lib/xemacs/site-packages/lisp
1.1 uebayasi 173: #
174: # EMACS_VERSION
175: # Description:
176: # XXX
177: # Possible values:
178: # XXX
179: #
1.24 ! wiz 180: # FOR_{emacs26,emacs26nox,emacs25,emacs25nox,emacs21,emacs21nox,emacs20,xemacs215,xemacs215nox,xemacs214,xemacs214nox}
1.1 uebayasi 181: # FOR_{emacs,xemacs}
182: # FOR_{emacs_x,emacs_nox}
1.24 ! wiz 183: # NOTFOR_{emacs26,eemacs26nox,macs25,emacs25nox,emacs21,emacs21nox,emacs20,xemacs215,xemacs215nox,xemacs214,xemacs214nox}
1.1 uebayasi 184: # NOTFOR_{emacs,xemacs}
185: # NOTFOR_{emacs_x,emacs_nox}
186: # Description:
187: # These macros will become either an empty string or
188: # "@comment" depending on the Emacs version; when
189: # "emacs21" is used, ${FOR_emacs} and ${FOR_emacs21}
190: # become "" (empty), and other macros become
191: # "@comment"; this means that only the PLIST lines
192: # prefixed by ${FOR_emacs} and ${FOR_emacs21} are
193: # valid.
194: #
195: # NOTFOR_* is the opposite of FOR_*.
196: # Possible values:
197: # "", "@comment"
198: #
1.18 obache 199: # FOR_emacs_no_byte_compile
200: # Description:
201: # For .elc file of .el file marked as "no-byte-compile: t"
202: # Possible values:
203: # "", "@comment"
1.1 uebayasi 204:
205: .if !defined(EMACS_MK)
206: EMACS_MK= # defined
207:
208: _VARGROUPS+= emacs
209: _USER_VARS.emacs= EMACS_TYPE
210: _PKG_VARS.emacs= EMACS_MODULES EMACS_VERSIONS_ACCEPTED
211: _SYS_VARS.emacs= EMACS_BIN EMACS_ETCPREFIX EMACS_FLAVOR \
212: EMACS_INFOPREFIX EMACS_LISPPREFIX \
213: EMACS_PKGNAME_PREFIX \
1.6 minskim 214: EMACS_VERSION_MAJOR EMACS_VERSION_MINOR \
215: EMACS_VERSION_MICRO
1.1 uebayasi 216: _DEF_VARS.emacs= _EMACS_TYPE _EMACS_PKGBASE
217: BUILD_DEFS+= ${_USER_VARS.emacs}
218: BUILD_DEFS_EFFECTS+= ${_SYS_VARS.emacs}
219:
220: .include "../../mk/bsd.prefs.mk"
221:
222: #
223: # Constants
224: #
225:
226: _EMACS_VERSIONS_ALL= \
1.23 mef 227: emacs20 emacs21 emacs21nox emacs25 emacs25nox emacs26 emacs26nox\
1.1 uebayasi 228: xemacs214 xemacs214nox xemacs215 xemacs215nox
229:
230: _EMACS_PKGDIR_MAP= \
231: emacs20@../../editors/emacs20 \
232: emacs21@../../editors/emacs21 \
233: emacs21nox@../../editors/emacs21-nox11 \
1.20 ryoon 234: emacs25@../../editors/emacs25 \
235: emacs25nox@../../editors/emacs25-nox11 \
1.23 mef 236: emacs26@../../editors/emacs26 \
237: emacs26nox@../../editors/emacs26-nox11 \
1.1 uebayasi 238: xemacs214@../../editors/xemacs \
239: xemacs214nox@../../editors/xemacs-nox11 \
240: xemacs215@../../editors/xemacs-current \
241: xemacs215nox@../../editors/xemacs-current-nox11
242:
243: _EMACS_ETCDIR.emacs= share
244: _EMACS_INFODIR.emacs= ${PKGINFODIR}
245: _EMACS_LISPDIR.emacs= share/emacs/site-lisp
246: _EMACS_PKGNAME_PREFIX.emacs=
247: _EMACS_CONFLICTS.emacs= xemacs-${PKGBASE}-[0-9]*
248:
249: _EMACS_ETCDIR.xemacs= lib/xemacs/site-packages/etc
250: _EMACS_INFODIR.xemacs= lib/xemacs/site-packages/info
251: _EMACS_LISPDIR.xemacs= lib/xemacs/site-packages/lisp
252: _EMACS_PKGNAME_PREFIX.xemacs= xemacs-
253: _EMACS_CONFLICTS.xemacs= ${PKGBASE:C|^xemacs-||}-[0-9]*
254:
255: #
256: # Version decision
257: #
258: # 1. Pick up an emacs version.
259: #
260: # add a dependency to the version;
261: #
262: # 2. Check if a given package can be used for the emacs version.
263: #
264: # if (package accepts the emacs version)
265: # nothing to do;
266: # else
267: # abort;
268: #
269:
270: _EMACS_TYPE= ${EMACS_TYPE}
271:
272: EMACS_VERSIONS_ACCEPTED?= ${_EMACS_VERSIONS_ALL}
273: .if empty(EMACS_VERSIONS_ACCEPTED:M${_EMACS_TYPE})
274: PKG_FAIL_REASON+= "Accepted versions are: ${EMACS_VERSIONS_ACCEPTED}"
275: PKG_FAIL_REASON+= "No valid Emacs version installed found"
276: .endif
277:
278: _EMACS_PKGDIR= ${_EMACS_PKGDIR_MAP:M${_EMACS_TYPE}@*:C|${_EMACS_TYPE}@||}
279:
280: .include "${_EMACS_PKGDIR}/version.mk"
281:
282: #
283: # Dependencies and conflicts
284: #
285:
286: DEPENDS+= ${_EMACS_REQD}:${_EMACS_PKGDIR}
287: CONFLICTS+= ${_EMACS_CONFLICTS.${_EMACS_FLAVOR}}
288:
289: EMACS_MODULES?=
290: .for _mod_ in ${EMACS_MODULES}
291: .if !empty(_EMACS_PKGDEP.${_mod_})
292: DEPENDS+= ${_EMACS_PKGDEP.${_mod_}}
293: .endif
294: .endfor
295:
296: #
297: # Macros for packages
298: #
299:
300: EMACS_FLAVOR= ${_EMACS_FLAVOR}
301: EMACS_BIN= ${PREFIX}/bin/${_EMACS_FLAVOR}
302: EMACS_VERSION_MAJOR= ${_EMACS_VERSION_MAJOR}
303: EMACS_VERSION_MINOR= ${_EMACS_VERSION_MINOR}
1.6 minskim 304: EMACS_VERSION_MICRO= ${_EMACS_VERSION_MICRO}
1.1 uebayasi 305: EMACS_ETCPREFIX= ${PREFIX}/${_EMACS_ETCDIR.${_EMACS_FLAVOR}}
306: EMACS_INFOPREFIX= ${PREFIX}/${_EMACS_INFODIR.${_EMACS_FLAVOR}}
307: EMACS_LISPPREFIX= ${PREFIX}/${_EMACS_LISPDIR.${_EMACS_FLAVOR}}
308: EMACS_PKGNAME_PREFIX= ${_EMACS_PKGNAME_PREFIX.${_EMACS_FLAVOR}}
309:
310: GNU_CONFIGURE_INFODIR?= ${EMACS_INFOPREFIX}
311:
312: _EMACS_PLIST_SUBST=
313: .for e in ${_EMACS_VERSIONS_ALL} emacs xemacs
314: . if "${e}" == ${EMACS_FLAVOR} || "${e}" == ${_EMACS_TYPE}
315: _EMACS_PLIST_SUBST+= FOR_${e}="" NOTFOR_${e}="@comment "
316: . else
317: _EMACS_PLIST_SUBST+= FOR_${e}="@comment " NOTFOR_${e}=""
318: . endif
319: .endfor
320: .if empty(EMACS_TYPE:M*nox)
321: _EMACS_PLIST_SUBST+= FOR_emacs_x="" NOTFOR_emacs_x="@comment "
1.4 uebayasi 322: _EMACS_PLIST_SUBST+= FOR_emacs_nox="@comment " NOTFOR_emacs_nox=""
1.1 uebayasi 323: .else
324: _EMACS_PLIST_SUBST+= FOR_emacs_x="@comment " NOTFOR_emacs_x=""
1.4 uebayasi 325: _EMACS_PLIST_SUBST+= FOR_emacs_nox="" NOTFOR_emacs_nox="@comment "
1.1 uebayasi 326: .endif
327:
328: _EMACS_PLIST_SUBST+= EMACS_FLAVOR=${EMACS_FLAVOR:Q}
329: _EMACS_PLIST_SUBST+= EMACS_VERSION=${_EMACS_VERSION_MAJOR:Q}.${_EMACS_VERSION_MINOR:Q}
330: _EMACS_PLIST_SUBST+= EMACS_ETCPREFIX=${EMACS_ETCPREFIX:C|^${PREFIX}/||}
331: _EMACS_PLIST_SUBST+= EMACS_INFOPREFIX=${EMACS_INFOPREFIX:C|^${PREFIX}/||}
332: _EMACS_PLIST_SUBST+= EMACS_LISPPREFIX=${EMACS_LISPPREFIX:C|^${PREFIX}/||}
333:
1.18 obache 334: _EMACS_PLIST_SUBST+= FOR_emacs_no_byte_compile="${${EMACS_VERSION_MAJOR}>22:?@comment :}"
335:
1.1 uebayasi 336: PLIST_SUBST+= ${_EMACS_PLIST_SUBST}
337:
338: PRINT_PLIST_AWK+= { gsub(/${EMACS_LISPPREFIX:S|${PREFIX}/||:S|/|\\/|g}/, \
339: "$${EMACS_LISPPREFIX}"); \
340: print; next; }
341:
342: #
343: # Build environment (buildlink3)
344: #
345:
1.2 uebayasi 346: .if defined(EMACS_BUILDLINK)
1.1 uebayasi 347: _EMACS_DIR= ${BUILDLINK_DIR}/share/emacs
1.23 mef 348: # development version usually claims three digit, say, 27.0.50 etc
349: . if !empty(EMACS_TYPE:Memacs27)
350: ALL_ENV+= EMACSLOADPATH=${_EMACS_DIR}/${_EMACS_VERSION_MAJOR}.${_EMACS_VERSION_MINOR}.${_EMACS_VERSION_MICRO}/lisp:${_EMACS_DIR}/site-lisp
351: . else
1.14 hiramats 352: ALL_ENV+= EMACSLOADPATH=${_EMACS_DIR}/${_EMACS_VERSION_MAJOR}.${_EMACS_VERSION_MINOR}/lisp:${_EMACS_DIR}/site-lisp
1.15 minskim 353: . endif
1.1 uebayasi 354: .include "${_EMACS_PKGDIR}/buildlink3.mk"
1.2 uebayasi 355: .endif
1.1 uebayasi 356:
357: .endif # EMACS_MK
CVSweb <webmaster@jp.NetBSD.org>