Annotation of pkgsrc/editors/emacs/modules.mk, Revision 1.14
1.14 ! hiramats 1: # $NetBSD: modules.mk,v 1.13 2010/10/25 00:03:03 minskim 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.13 minskim 44: # emacs24,
1.9 minskim 45: # emacs23, emacs23nox, emacs22, emacs22nox,
46: # emacs21, emacs21nox, emacs20,
1.5 minskim 47: # xemacs215, xemacs215nox, xemacs214, xemacs214nox
1.1 uebayasi 48: # Default value:
1.9 minskim 49: # emacs23
1.1 uebayasi 50: #
51: # Variables ELPs can provide:
52: #
53: # EMACS_MODULES
54: # Description:
55: # List of Emacs LISP modules that the current ELP
56: # needs at run-time.
57: # Possible values:
58: # base, leim
59: # Default value:
60: # <undefined>
61: #
62: # EMACS_VERSIONS_ACCEPTED
63: # Description:
64: # Versions the ELP accepts (supports).
65: # Possible values:
1.13 minskim 66: # emacs24,
1.9 minskim 67: # emacs23, emacs23nox, emacs22, emacs22nox,
68: # emacs21, emacs21nox, emacs20,
1.5 minskim 69: # xemacs215, xemacs215nox, xemacs214, xemacs214nox
1.1 uebayasi 70: # Default value:
1.13 minskim 71: # emacs24,
1.9 minskim 72: # emacs23, emacs23nox, emacs22, emacs22nox,
73: # emacs21, emacs21nox, emacs20,
1.5 minskim 74: # xemacs215, xemacs215nox, xemacs214, xemacs214nox
1.1 uebayasi 75: #
1.2 uebayasi 76: # EMACS_BUILDLINK
77: # Description:
78: # Whether create buildlink directory of *.el / *.elc
79: # files. ELPs which include other ELP's buildlink3.mk
80: # must define this value.
81: # Possible values:
82: # <defined>, <undefined>
83: # Default value:
84: # <undefined>
85: #
1.1 uebayasi 86: # Variables provided for ELPs:
87: #
88: # EMACS_BIN
89: # Description:
90: # Path to Emacs executable.
91: # Possible values:
92: # ${PREFIX}/bin/emacs, ${PREFIX}/bin/xemacs
93: #
94: # EMACS_ETCPREFIX
95: # Description:
96: # Path to the directory misc. files should be
97: # installed into. ELPs should append a short
98: # name as a subdirectory.
99: # Possible values:
100: # ${PREFIX}/share
1.4 uebayasi 101: # ${PREFIX}/lib/xemacs/site-packages/etc
1.1 uebayasi 102: #
103: # EMACS_FLAVOR
104: # Description:
105: # GNU Emacs (emacs) or XEmacs (xemacs).
106: # Possible values:
107: # emacs, xemacs
108: #
109: # EMACS_INFOPREFIX
110: # Description:
111: # Path to the directory Info files should be
112: # installed into. Unlike EMACS_ETCPREFIX or
113: # EMACS_LISPPREFIX, subdirectory is not needed.
114: # Possible values:
115: # ${PREFIX}/${PKGINFODIR}
1.4 uebayasi 116: # ${PREFIX}/lib/xemacs/site-packages/info
1.1 uebayasi 117: #
118: # EMACS_LISPPREFIX
119: # Description:
120: # installed into. ELPs should append a short name
121: # as a subdirectory.
122: # Possible values:
123: # ${PREFIX}/share/emacs/site-lisp
1.4 uebayasi 124: # ${PREFIX}/lib/xemacs/site-packages/lisp
1.1 uebayasi 125: #
126: # EMACS_PKGNAME_PREFIX
127: # Description:
128: # The prefix of PKGNAME and DEPENDS lines. All ELPs
129: # must honour this!
130: # Possible values:
131: # "", "xemacs-"
132: #
133: # EMACS_VERSION_MAJOR
134: # Description:
135: # Emacs major version.
136: # Possible values:
1.13 minskim 137: # 20, 21, 22, 23, 24, <integers more than that in the future>
1.1 uebayasi 138: #
139: # EMACS_VERSION_MINOR
140: # Description:
141: # Emacs minor version.
142: # Possible values:
143: # <integer>
144: #
1.6 minskim 145: # EMACS_VERSION_MICRO
146: # Description:
147: # Emacs micro version.
148: # Possible values:
149: # <integer>
150: #
1.1 uebayasi 151: # Variables provided in ELPs' PLIST:
152: #
153: # EMACS_ETCPREFIX
154: # Description:
155: # Same as the one in Makefile, except that
156: # ${PREFIX} is omitted in PLIST.
157: # Possible values:
158: # share
1.4 uebayasi 159: # lib/xemacs/site-packages/etc
1.1 uebayasi 160: #
161: # EMACS_INFOPREFIX
162: # Description:
163: # Same as the one in Makefile, except that
164: # ${PREFIX} is omitted in PLIST.
165: # Possible values:
166: # ${PKGINFODIR}
1.4 uebayasi 167: # lib/xemacs/site-packages/info
1.1 uebayasi 168: #
169: # EMACS_LISPPREFIX
170: # Description:
171: # Same as the one in Makefile, except that
172: # ${PREFIX} is omitted in PLIST.
173: # Possible values:
174: # share/emacs/site-lisp
1.4 uebayasi 175: # lib/xemacs/site-packages/lisp
1.1 uebayasi 176: #
177: # EMACS_VERSION
178: # Description:
179: # XXX
180: # Possible values:
181: # XXX
182: #
1.9 minskim 183: # FOR_{emacs23,emacs23nox,emacs22,emacs22nox,emacs21,emacs21nox,emacs20,xemacs215,xemacs215nox,xemacs214,xemacs214nox}
1.1 uebayasi 184: # FOR_{emacs,xemacs}
185: # FOR_{emacs_x,emacs_nox}
1.9 minskim 186: # NOTFOR_{emacs23,emacs23nox,emacs22,emacs22nox,emacs21,emacs21nox,emacs20,xemacs215,xemacs215nox,xemacs214,xemacs214nox}
1.1 uebayasi 187: # NOTFOR_{emacs,xemacs}
188: # NOTFOR_{emacs_x,emacs_nox}
189: # Description:
190: # These macros will become either an empty string or
191: # "@comment" depending on the Emacs version; when
192: # "emacs21" is used, ${FOR_emacs} and ${FOR_emacs21}
193: # become "" (empty), and other macros become
194: # "@comment"; this means that only the PLIST lines
195: # prefixed by ${FOR_emacs} and ${FOR_emacs21} are
196: # valid.
197: #
198: # NOTFOR_* is the opposite of FOR_*.
199: # Possible values:
200: # "", "@comment"
201: #
202:
203: .if !defined(EMACS_MK)
204: EMACS_MK= # defined
205:
206: _VARGROUPS+= emacs
207: _USER_VARS.emacs= EMACS_TYPE
208: _PKG_VARS.emacs= EMACS_MODULES EMACS_VERSIONS_ACCEPTED
209: _SYS_VARS.emacs= EMACS_BIN EMACS_ETCPREFIX EMACS_FLAVOR \
210: EMACS_INFOPREFIX EMACS_LISPPREFIX \
211: EMACS_PKGNAME_PREFIX \
1.6 minskim 212: EMACS_VERSION_MAJOR EMACS_VERSION_MINOR \
213: EMACS_VERSION_MICRO
1.1 uebayasi 214: _DEF_VARS.emacs= _EMACS_TYPE _EMACS_PKGBASE
215: BUILD_DEFS+= ${_USER_VARS.emacs}
216: BUILD_DEFS_EFFECTS+= ${_SYS_VARS.emacs}
217:
218: .include "../../mk/bsd.prefs.mk"
219:
220: #
221: # Constants
222: #
223:
224: _EMACS_VERSIONS_ALL= \
1.9 minskim 225: emacs20 emacs21 emacs21nox emacs22 emacs22nox emacs23 emacs23nox \
1.13 minskim 226: emacs24 \
1.1 uebayasi 227: xemacs214 xemacs214nox xemacs215 xemacs215nox
228:
229: _EMACS_PKGDIR_MAP= \
230: emacs20@../../editors/emacs20 \
231: emacs21@../../editors/emacs21 \
232: emacs21nox@../../editors/emacs21-nox11 \
1.8 minskim 233: emacs22@../../editors/emacs22 \
234: emacs22nox@../../editors/emacs22-nox11 \
1.9 minskim 235: emacs23@../../editors/emacs \
236: emacs23nox@../../editors/emacs-nox11 \
1.13 minskim 237: emacs24@../../editors/emacs-snapshot \
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:
334: PLIST_SUBST+= ${_EMACS_PLIST_SUBST}
335:
336: PRINT_PLIST_AWK+= { gsub(/${EMACS_LISPPREFIX:S|${PREFIX}/||:S|/|\\/|g}/, \
337: "$${EMACS_LISPPREFIX}"); \
338: print; next; }
339:
340: #
341: # Build environment (buildlink3)
342: #
343:
1.2 uebayasi 344: .if defined(EMACS_BUILDLINK)
1.1 uebayasi 345: _EMACS_DIR= ${BUILDLINK_DIR}/share/emacs
1.14 ! hiramats 346: ALL_ENV+= EMACSLOADPATH=${_EMACS_DIR}/${_EMACS_VERSION_MAJOR}.${_EMACS_VERSION_MINOR}/lisp:${_EMACS_DIR}/site-lisp
1.1 uebayasi 347: .include "${_EMACS_PKGDIR}/buildlink3.mk"
1.2 uebayasi 348: .endif
1.1 uebayasi 349:
350: .endif # EMACS_MK
CVSweb <webmaster@jp.NetBSD.org>