ocaml.port.mk 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. # $OpenBSD: ocaml.port.mk,v 1.30 2014/10/25 11:55:54 chrisz Exp $
  2. # regular file usage for bytecode:
  3. # PLIST -- bytecode base files
  4. # PFRAG.foo -- bytecode files for FLAVOR == foo
  5. # PFRAG.no-foo -- bytecode files for FLAVOR != foo
  6. # extended file usage for nativecode:
  7. # PFRAG.native -- nativecode base files
  8. # PFRAG.foo-native -- nativecode files for FLAVOR == foo
  9. # PFRAG.no-foo-native -- nativecode files for FLAVOR != foo
  10. .include <bsd.port.arch.mk>
  11. .if ${PROPERTIES:Mocaml_native}
  12. MODOCAML_NATIVE=Yes
  13. # include nativecode base files
  14. PKG_ARGS+=-Dnative=1
  15. .else
  16. MODOCAML_NATIVE=No
  17. # remove native base file entry from PLIST
  18. PKG_ARGS+=-Dnative=0
  19. .endif
  20. .if ${PROPERTIES:Mocaml_native_dynlink}
  21. MODOCAML_NATDYNLINK=Yes
  22. MODOCAML_OCAMLDOC?=ocamldoc.opt
  23. # include native dynlink base files
  24. PKG_ARGS+=-Ddynlink=1
  25. .else
  26. MODOCAML_NATDYNLINK=No
  27. MODOCAML_OCAMLDOC?=ocamldoc
  28. # remove native dynlink base file entry from PLIST
  29. PKG_ARGS+=-Ddynlink=0
  30. .endif
  31. RUN_DEPENDS += lang/ocaml
  32. BUILD_DEPENDS += lang/ocaml
  33. MAKE_ENV += OCAMLFIND_DESTDIR=${DESTDIR}${TRUEPREFIX}/lib/ocaml \
  34. OCAMLFIND_COMMANDS="ocamldoc=${MODOCAML_OCAMLDOC}"
  35. MODOCAML_pre-fake = \
  36. ${_FAKESUDO} ${INSTALL_DATA_DIR} ${WRKINST}${LOCALBASE}/lib/ocaml/stublibs
  37. ######################################################################
  38. #
  39. # CONFIGURE_STYLE for oasis.
  40. #
  41. # Also overrides do-{build,install,test}
  42. #
  43. .if ${CONFIGURE_STYLE:L:Moasis}
  44. ALL_TARGET ?= -build -doc
  45. # XXX can't do ?= here, because INSTALL_TARGET is already initialized
  46. # with default value
  47. INSTALL_TARGET = -install
  48. TEST_TARGET ?= -test
  49. _MODOASIS_SETUP = ${WRKDIR}/oasis_setup.byte
  50. ######################################################################
  51. # CONFIGURE
  52. .if ${PROPERTIES:Mocaml_native}
  53. _MODOASIS_OCAMLC = ocamlc.opt
  54. .else
  55. _MODOASIS_OCAMLC = ocamlc
  56. .endif
  57. . if ${CONFIGURE_STYLE:L:Moasis_setup}
  58. BUILD_DEPENDS += sysutils/oasis
  59. MODOASIS_configure += cd ${WRKSRC} && oasis setup &&
  60. . endif
  61. MODOASIS_configure += \
  62. ${_MODOASIS_OCAMLC} -o ${_MODOASIS_SETUP} ${WRKSRC}/setup.ml && \
  63. cd ${WRKSRC} && \
  64. rm setup.cm[io] && \
  65. ${SETENV} ${CONFIGURE_ENV} ${_MODOASIS_SETUP} -configure \
  66. --destdir ${WRKINST} \
  67. --mandir ${PREFIX}/man \
  68. --infodir ${PREFIX}/info \
  69. --override pkg_name ${PKGNAME:C/-[0-9].*//} \
  70. ${CONFIGURE_ARGS}
  71. ######################################################################
  72. # BUILD
  73. BUILD_DEPENDS+= sysutils/findlib
  74. MODOASIS_BUILD_TARGET = cd ${WRKSRC}
  75. . for TARGET in ${ALL_TARGET}
  76. MODOASIS_BUILD_TARGET += \
  77. && ${SETENV} ${MAKE_ENV} ${_MODOASIS_SETUP} ${TARGET}
  78. . endfor
  79. . if !target(do-build)
  80. do-build:
  81. ${MODOASIS_BUILD_TARGET}
  82. . endif
  83. ######################################################################
  84. # INSTALL
  85. MODOASIS_INSTALL_TARGET = cd ${WRKSRC}
  86. . for TARGET in ${INSTALL_TARGET}
  87. MODOASIS_INSTALL_TARGET += \
  88. && ${SETENV} ${MAKE_ENV} ${_MODOASIS_SETUP} ${TARGET}
  89. . endfor
  90. . if !target(do-install)
  91. do-install:
  92. ${MODOASIS_INSTALL_TARGET}
  93. . endif
  94. ######################################################################
  95. # TEST
  96. MODOASIS_TEST_TARGET = cd ${WRKSRC}
  97. . for TARGET in ${TEST_TARGET}
  98. MODOASIS_TEST_TARGET += \
  99. && ${SETENV} ${MAKE_ENV} ${_MODOASIS_SETUP} ${TARGET}
  100. . endfor
  101. . if !target(do-test)
  102. do-test:
  103. ${MODOASIS_TEST_TARGET}
  104. . endif
  105. .endif