bsd.ocaml.mk 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. # ex:ts=4
  2. #
  3. # $MBSDlabs: portmk/bsd.ocaml.mk,v 1.18 2006/08/06 18:47:23 stas Exp $
  4. #
  5. # bsd.ocaml.mk - Support for the Objective Caml language packages
  6. #
  7. # Author: Stanislav Sedov <ssedov@mbsd.msk.ru>
  8. #
  9. # Feel free to send any comments and suggestions to maintainer.
  10. #
  11. # Currently recognised variables are:
  12. #
  13. # USE_OCAML - Set if your port uses OCaml to build/install.
  14. # NO_OCAML_BUILDDEPENDS - Don't add ocamlc to BUILD|EXTRACT|PATCH_DEPENDS.
  15. # NO_OCAML_RUNDEPENDS - Don't add ocamlc to RUN_DEPENDS.
  16. # USE_OCAML_FINDLIB - Set if your port uses ocamlfind to install
  17. # packages. Package direcories will be
  18. # automatically deleted.
  19. # USE_OCAML_CAMLP4 - Set if your port uses camlp4 to build.
  20. # USE_OCAML_TK - Set if you port needs ocaml-labltk.
  21. # NO_OCAMLTK_BUILDDEPENDS - Don't add labltk to BUILD|EXTRACT|PATCH_DEPENDS.
  22. # NO_OCAMLTK_RUNDEPENDS - Don't add labltk to RUN_DEPENDS.
  23. # USE_OCAML_LDCONFIG - Set if your port installs shared libraries
  24. # into ocaml site-lib dir. OCaml ld.conf file
  25. # will be automatically processed.
  26. # USE_OCAMLFIND_PLIST - Add contents of findlib target directories
  27. # automatically.
  28. # USE_OCAML_WASH - Set if your port wants to automatically
  29. # purge shared Ocaml dirs on uninstall. It's
  30. # useful when installing to non-standard PREFIX
  31. # OCAML_PKGDIRS - Directories under site-lib to be processed
  32. # if USE_OCAML_FINDLIB specified.
  33. # Default: ${PORTNAME}
  34. # OCAML_LDLIBS - Directories under PREFIX to be automatically
  35. # added/removed from ld.conf
  36. # Default: ${OCAML_SITELIBDIR}/${PORTNAME}
  37. .if !defined(OCAML_include)
  38. OCAML_MAINTAINER= ports@FreeBSD.org
  39. OCAML_include= bsd.ocaml.mk
  40. #
  41. # OCaml programs location
  42. #
  43. OCAMLC?= ${LOCALBASE}/bin/ocamlc
  44. OCAMLC_OPT?= ${LOCALBASE}/bin/ocamlc.opt
  45. OCAMLCP?= ${LOCALBASE}/bin/ocamlcp
  46. OCAMLFIND?= ${LOCALBASE}/bin/ocamlfind
  47. CAMLP4?= ${LOCALBASE}/bin/camlp4
  48. OCAMLTK?= ${LOCALBASE}/bin/labltk
  49. #
  50. # OCaml library directory
  51. #
  52. OCAML_LIBDIR?= lib/ocaml
  53. #
  54. # Where to install site libraries
  55. #
  56. OCAML_SITELIBDIR?= ${OCAML_LIBDIR}/site-lib
  57. #
  58. # OCaml compiler port dependency
  59. #
  60. OCAMLC_PORT?= lang/ocaml
  61. OCAMLC_DEPEND?= ${OCAMLC}:${OCAMLC_PORT}
  62. #
  63. # OCaml package manager port dependency
  64. #
  65. OCAMLFIND_PORT?= devel/ocaml-findlib
  66. OCAMLFIND_DEPEND?= ${OCAMLFIND}:${OCAMLFIND_PORT}
  67. #
  68. # OCaml camlp4 port dependency
  69. #
  70. CAMLP4_PORT?= devel/ocaml-camlp4
  71. CAMLP4_DEPEND?= ${CAMLP4}:${CAMLP4_PORT}
  72. #
  73. # OCaml TK bindings dependency
  74. #
  75. OCAMLTK_PORT?= x11-toolkits/ocaml-labltk
  76. OCAMLTK_DEPENDS?= ${OCAMLTK}:${OCAMLTK_PORT}
  77. #
  78. # Common OCaml examples and documents location
  79. #
  80. OCAML_DOCSDIR= ${PREFIX}/share/doc/ocaml
  81. OCAML_EXAMPLESDIR= ${PREFIX}/share/examples/ocaml
  82. #
  83. # Location of OCaml ld.conf file
  84. #
  85. OCAML_LDCONF?= ${OCAML_LIBDIR}/ld.conf
  86. # ocaml-findlib-1.4.1_1 wants to edit our ld.conf file, which does not
  87. # work well with staging.
  88. . if defined(USE_OCAML_LDCONFIG)
  89. . if !target(ocaml-ldconfig)
  90. OCAMLFIND_LDCONF?= /dev/null
  91. . endif
  92. . endif
  93. OCAMLFIND_DESTDIR?= ${PREFIX}/${OCAML_SITELIBDIR}
  94. OCAMLFIND_LDCONF?= ${PREFIX}/${OCAML_LDCONF}
  95. . if defined(USE_OCAML)
  96. . if !defined(NO_OCAML_BUILDDEPENDS)
  97. EXTRACT_DEPENDS+= ${OCAMLC_DEPEND}
  98. PATCH_DEPENDS+= ${OCAMLC_DEPEND}
  99. BUILD_DEPENDS+= ${OCAMLC_DEPEND}
  100. . endif
  101. . if !defined(NO_OCAML_RUNDEPENDS)
  102. RUN_DEPENDS+= ${OCAMLC_DEPEND}
  103. . endif
  104. PLIST_SUB+= OCAML_SITELIBDIR="${OCAML_SITELIBDIR}"
  105. . endif
  106. . if defined(USE_OCAML_FINDLIB)
  107. #
  108. # We'll additionally add ocamlfind to RUN_DEPENDS, since
  109. # if the port requires ocamlfind to install - it requires
  110. # some ocaml libraries and these libraries RUN_DEPENDS on
  111. # ocamlfind
  112. #
  113. BUILD_DEPENDS+= ${OCAMLFIND_DEPEND}
  114. RUN_DEPENDS+= ${OCAMLFIND_DEPEND}
  115. MAKE_ENV+= OCAMLFIND_DESTDIR="${STAGEDIR}${OCAMLFIND_DESTDIR}" \
  116. OCAMLFIND_LDCONF="${OCAMLFIND_LDCONF}"
  117. #
  118. # Directories under site-lib to process automatically
  119. #
  120. OCAML_PKGDIRS?= ${PORTNAME}
  121. _USES_install+= 735:ocaml-findlib
  122. . if !target(ocaml-findlib)
  123. ocaml-findlib:
  124. . for DIR in ${OCAML_PKGDIRS}
  125. . if defined(USE_OCAMLFIND_PLIST)
  126. @${FIND} ${STAGEDIR}${PREFIX}/${OCAML_SITELIBDIR}/${DIR}/ -type f -print | ${SED} -e \
  127. 's,^${STAGEDIR}${PREFIX}/,,' >> ${TMPPLIST}
  128. . endif
  129. @${ECHO_CMD} "@postunexec ${OCAMLFIND} remove ${DIR} 2>/dev/null" \
  130. >> ${TMPPLIST}
  131. . endfor
  132. . endif
  133. . endif
  134. . if defined(USE_OCAML_CAMLP4)
  135. BUILD_DEPENDS+= ${CAMLP4_DEPEND}
  136. . endif
  137. . if defined(USE_OCAML_TK)
  138. . if !defined(NO_OCAMLTK_BUILDDEPENDS)
  139. EXTRACT_DEPENDS+= ${OCAMLTK_DEPENDS}
  140. PATCH_DEPENDS+= ${OCAMLTK_DEPENDS}
  141. BUILD_DEPENDS+= ${OCAMLTK_DEPENDS}
  142. . endif
  143. . if !defined(NO_OCAMLTK_RUNDEPENDS)
  144. RUN_DEPENDS+= ${OCAMLTK_DEPENDS}
  145. . endif
  146. . endif
  147. . if defined(USE_OCAML_LDCONFIG)
  148. #
  149. # Directories under PREFIX for appending to ld.conf
  150. #
  151. OCAML_LDLIBS?= ${OCAML_SITELIBDIR}/${PORTNAME}
  152. _USES_install+= 740:ocaml-ldconfig
  153. . if !target(ocaml-ldconfig)
  154. ocaml-ldconfig:
  155. . for LIB in ${OCAML_LDLIBS}
  156. @${ECHO_CMD} "@postexec ${ECHO_CMD} "%D/${LIB}" >> %D/${OCAML_LDCONF}" \
  157. >> ${TMPPLIST}
  158. @${ECHO_CMD} "@postunexec ${SED} -i \"\" -e '/${LIB:S#/#\/#g}/d' %D/${OCAML_LDCONF}" >> ${TMPPLIST}
  159. . endfor
  160. . endif
  161. . endif
  162. . if defined(USE_OCAML_WASH)
  163. PLIST_FILES+= "@rmempty ${OCAML_LDCONF}"
  164. . endif
  165. .endif #!defined(OCAML_include)
  166. .if defined(_POSTMKINCLUDED)
  167. . if defined(USE_OCAML_FINDLIB)
  168. pre-install: ${STAGEDIR}${OCAMLFIND_DESTDIR}
  169. ${STAGEDIR}${OCAMLFIND_DESTDIR}:
  170. @${MKDIR} ${.TARGET}
  171. . endif
  172. .endif # _POSTMKINCLUDED