PageRenderTime 73ms CodeModel.GetById 36ms RepoModel.GetById 1ms app.codeStats 0ms

/editors/emacs/modules.mk

https://github.com/jsonn/pkgsrc
Makefile | 364 lines | 105 code | 27 blank | 232 comment | 5 complexity | 5767da1940326877a62db12c18a481b1 MD5 | raw file
  1. # $NetBSD: modules.mk,v 1.21 2017/01/01 02:48:43 dholland Exp $
  2. #
  3. # This Makefile fragment handles Emacs Lisp Packages (== ELPs).
  4. #
  5. # Note to users:
  6. #
  7. # * Users choose one favourite Emacs version.
  8. #
  9. # * Emacs Lisp files are installed...
  10. # GNU emacs
  11. # -> ${PREFIX}/share/emacs/site-lisp/foo/...
  12. # XEmacs
  13. # ->${PREFIX}/lib/xemacs/site-packages/lisp/foo/...
  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:
  41. # The user's favourite Emacs version. The default
  42. # value is set in mk/defaults/mk.conf.
  43. # Possible values:
  44. # emacs25, emacs24, emacs24nox,
  45. # emacs23, emacs23nox, emacs22, emacs22nox,
  46. # emacs21, emacs21nox, emacs20,
  47. # xemacs215, xemacs215nox, xemacs214, xemacs214nox
  48. # Default value:
  49. # emacs25
  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:
  66. # emacs25, emacs24, emacs24nox,
  67. # emacs23, emacs23nox, emacs22, emacs22nox,
  68. # emacs21, emacs21nox, emacs20,
  69. # xemacs215, xemacs215nox, xemacs214, xemacs214nox
  70. # Default value:
  71. # emacs25, emacs24, emacs24nox,
  72. # emacs23, emacs23nox, emacs22, emacs22nox,
  73. # emacs21, emacs21nox, emacs20,
  74. # xemacs215, xemacs215nox, xemacs214, xemacs214nox
  75. #
  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. #
  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
  101. # ${PREFIX}/lib/xemacs/site-packages/etc
  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}
  116. # ${PREFIX}/lib/xemacs/site-packages/info
  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
  124. # ${PREFIX}/lib/xemacs/site-packages/lisp
  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:
  137. # 20, 21, 22, 23, 24, 25, <integers more than that in the future>
  138. #
  139. # EMACS_VERSION_MINOR
  140. # Description:
  141. # Emacs minor version.
  142. # Possible values:
  143. # <integer>
  144. #
  145. # EMACS_VERSION_MICRO
  146. # Description:
  147. # Emacs micro version.
  148. # Possible values:
  149. # <integer>
  150. #
  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
  159. # lib/xemacs/site-packages/etc
  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}
  167. # lib/xemacs/site-packages/info
  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
  175. # lib/xemacs/site-packages/lisp
  176. #
  177. # EMACS_VERSION
  178. # Description:
  179. # XXX
  180. # Possible values:
  181. # XXX
  182. #
  183. # FOR_{emacs25,emacs24,emacs24nox,emacs23,emacs23nox,emacs22,emacs22nox,emacs21,emacs21nox,emacs20,xemacs215,xemacs215nox,xemacs214,xemacs214nox}
  184. # FOR_{emacs,xemacs}
  185. # FOR_{emacs_x,emacs_nox}
  186. # NOTFOR_{emacs25,emacs24,emacs24nox,emacs23,emacs23nox,emacs22,emacs22nox,emacs21,emacs21nox,emacs20,xemacs215,xemacs215nox,xemacs214,xemacs214nox}
  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. # FOR_emacs_no_byte_compile
  203. # Description:
  204. # For .elc file of .el file marked as "no-byte-compile: t"
  205. # Possible values:
  206. # "", "@comment"
  207. .if !defined(EMACS_MK)
  208. EMACS_MK= # defined
  209. _VARGROUPS+= emacs
  210. _USER_VARS.emacs= EMACS_TYPE
  211. _PKG_VARS.emacs= EMACS_MODULES EMACS_VERSIONS_ACCEPTED
  212. _SYS_VARS.emacs= EMACS_BIN EMACS_ETCPREFIX EMACS_FLAVOR \
  213. EMACS_INFOPREFIX EMACS_LISPPREFIX \
  214. EMACS_PKGNAME_PREFIX \
  215. EMACS_VERSION_MAJOR EMACS_VERSION_MINOR \
  216. EMACS_VERSION_MICRO
  217. _DEF_VARS.emacs= _EMACS_TYPE _EMACS_PKGBASE
  218. BUILD_DEFS+= ${_USER_VARS.emacs}
  219. BUILD_DEFS_EFFECTS+= ${_SYS_VARS.emacs}
  220. .include "../../mk/bsd.prefs.mk"
  221. #
  222. # Constants
  223. #
  224. _EMACS_VERSIONS_ALL= \
  225. emacs20 emacs21 emacs21nox emacs22 emacs22nox emacs23 emacs23nox \
  226. emacs24 emacs24nox emacs25 emacs25nox \
  227. xemacs214 xemacs214nox xemacs215 xemacs215nox
  228. _EMACS_PKGDIR_MAP= \
  229. emacs20@../../editors/emacs20 \
  230. emacs21@../../editors/emacs21 \
  231. emacs21nox@../../editors/emacs21-nox11 \
  232. emacs22@../../editors/emacs22 \
  233. emacs22nox@../../editors/emacs22-nox11 \
  234. emacs23@../../editors/emacs23 \
  235. emacs23nox@../../editors/emacs23-nox11 \
  236. emacs24@../../editors/emacs24 \
  237. emacs24nox@../../editors/emacs24-nox11 \
  238. emacs25@../../editors/emacs25 \
  239. emacs25nox@../../editors/emacs25-nox11 \
  240. xemacs214@../../editors/xemacs \
  241. xemacs214nox@../../editors/xemacs-nox11 \
  242. xemacs215@../../editors/xemacs-current \
  243. xemacs215nox@../../editors/xemacs-current-nox11
  244. _EMACS_ETCDIR.emacs= share
  245. _EMACS_INFODIR.emacs= ${PKGINFODIR}
  246. _EMACS_LISPDIR.emacs= share/emacs/site-lisp
  247. _EMACS_PKGNAME_PREFIX.emacs=
  248. _EMACS_CONFLICTS.emacs= xemacs-${PKGBASE}-[0-9]*
  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. # Version decision
  256. #
  257. # 1. Pick up an emacs version.
  258. #
  259. # add a dependency to the version;
  260. #
  261. # 2. Check if a given package can be used for the emacs version.
  262. #
  263. # if (package accepts the emacs version)
  264. # nothing to do;
  265. # else
  266. # abort;
  267. #
  268. _EMACS_TYPE= ${EMACS_TYPE}
  269. EMACS_VERSIONS_ACCEPTED?= ${_EMACS_VERSIONS_ALL}
  270. .if empty(EMACS_VERSIONS_ACCEPTED:M${_EMACS_TYPE})
  271. PKG_FAIL_REASON+= "Accepted versions are: ${EMACS_VERSIONS_ACCEPTED}"
  272. PKG_FAIL_REASON+= "No valid Emacs version installed found"
  273. .endif
  274. _EMACS_PKGDIR= ${_EMACS_PKGDIR_MAP:M${_EMACS_TYPE}@*:C|${_EMACS_TYPE}@||}
  275. .include "${_EMACS_PKGDIR}/version.mk"
  276. #
  277. # Dependencies and conflicts
  278. #
  279. DEPENDS+= ${_EMACS_REQD}:${_EMACS_PKGDIR}
  280. CONFLICTS+= ${_EMACS_CONFLICTS.${_EMACS_FLAVOR}}
  281. EMACS_MODULES?=
  282. .for _mod_ in ${EMACS_MODULES}
  283. .if !empty(_EMACS_PKGDEP.${_mod_})
  284. DEPENDS+= ${_EMACS_PKGDEP.${_mod_}}
  285. .endif
  286. .endfor
  287. #
  288. # Macros for packages
  289. #
  290. EMACS_FLAVOR= ${_EMACS_FLAVOR}
  291. EMACS_BIN= ${PREFIX}/bin/${_EMACS_FLAVOR}
  292. EMACS_VERSION_MAJOR= ${_EMACS_VERSION_MAJOR}
  293. EMACS_VERSION_MINOR= ${_EMACS_VERSION_MINOR}
  294. EMACS_VERSION_MICRO= ${_EMACS_VERSION_MICRO}
  295. EMACS_ETCPREFIX= ${PREFIX}/${_EMACS_ETCDIR.${_EMACS_FLAVOR}}
  296. EMACS_INFOPREFIX= ${PREFIX}/${_EMACS_INFODIR.${_EMACS_FLAVOR}}
  297. EMACS_LISPPREFIX= ${PREFIX}/${_EMACS_LISPDIR.${_EMACS_FLAVOR}}
  298. EMACS_PKGNAME_PREFIX= ${_EMACS_PKGNAME_PREFIX.${_EMACS_FLAVOR}}
  299. GNU_CONFIGURE_INFODIR?= ${EMACS_INFOPREFIX}
  300. _EMACS_PLIST_SUBST=
  301. .for e in ${_EMACS_VERSIONS_ALL} emacs xemacs
  302. . if "${e}" == ${EMACS_FLAVOR} || "${e}" == ${_EMACS_TYPE}
  303. _EMACS_PLIST_SUBST+= FOR_${e}="" NOTFOR_${e}="@comment "
  304. . else
  305. _EMACS_PLIST_SUBST+= FOR_${e}="@comment " NOTFOR_${e}=""
  306. . endif
  307. .endfor
  308. .if empty(EMACS_TYPE:M*nox)
  309. _EMACS_PLIST_SUBST+= FOR_emacs_x="" NOTFOR_emacs_x="@comment "
  310. _EMACS_PLIST_SUBST+= FOR_emacs_nox="@comment " NOTFOR_emacs_nox=""
  311. .else
  312. _EMACS_PLIST_SUBST+= FOR_emacs_x="@comment " NOTFOR_emacs_x=""
  313. _EMACS_PLIST_SUBST+= FOR_emacs_nox="" NOTFOR_emacs_nox="@comment "
  314. .endif
  315. _EMACS_PLIST_SUBST+= EMACS_FLAVOR=${EMACS_FLAVOR:Q}
  316. _EMACS_PLIST_SUBST+= EMACS_VERSION=${_EMACS_VERSION_MAJOR:Q}.${_EMACS_VERSION_MINOR:Q}
  317. _EMACS_PLIST_SUBST+= EMACS_ETCPREFIX=${EMACS_ETCPREFIX:C|^${PREFIX}/||}
  318. _EMACS_PLIST_SUBST+= EMACS_INFOPREFIX=${EMACS_INFOPREFIX:C|^${PREFIX}/||}
  319. _EMACS_PLIST_SUBST+= EMACS_LISPPREFIX=${EMACS_LISPPREFIX:C|^${PREFIX}/||}
  320. _EMACS_PLIST_SUBST+= FOR_emacs_no_byte_compile="${${EMACS_VERSION_MAJOR}>22:?@comment :}"
  321. PLIST_SUBST+= ${_EMACS_PLIST_SUBST}
  322. PRINT_PLIST_AWK+= { gsub(/${EMACS_LISPPREFIX:S|${PREFIX}/||:S|/|\\/|g}/, \
  323. "$${EMACS_LISPPREFIX}"); \
  324. print; next; }
  325. #
  326. # Build environment (buildlink3)
  327. #
  328. .if defined(EMACS_BUILDLINK)
  329. _EMACS_DIR= ${BUILDLINK_DIR}/share/emacs
  330. . if empty(EMACS_TYPE:Memacs26)
  331. ALL_ENV+= EMACSLOADPATH=${_EMACS_DIR}/${_EMACS_VERSION_MAJOR}.${_EMACS_VERSION_MINOR}/lisp:${_EMACS_DIR}/site-lisp
  332. . else
  333. ALL_ENV+= EMACSLOADPATH=${_EMACS_DIR}/${_EMACS_VERSION_MAJOR}.${_EMACS_VERSION_MINOR}.${_EMACS_VERSION_MICRO}/lisp:${_EMACS_DIR}/site-lisp
  334. . endif
  335. .include "${_EMACS_PKGDIR}/buildlink3.mk"
  336. .endif
  337. .endif # EMACS_MK