mercury-13.05.1.ebuild 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=2
  4. inherit autotools elisp-common eutils flag-o-matic java-pkg-opt-2 multilib
  5. PATCHSET_VER="0"
  6. MY_P=${PN}-srcdist-${PV}
  7. DESCRIPTION="Mercury is a modern general-purpose logic/functional programming language"
  8. HOMEPAGE="http://www.mercurylang.org/index.html"
  9. SRC_URI="http://dl.mercurylang.org/release/${MY_P}.tar.gz
  10. mirror://gentoo/${P}-gentoo-patchset-${PATCHSET_VER}.tar.gz"
  11. LICENSE="GPL-2 LGPL-2"
  12. SLOT="0"
  13. KEYWORDS="~amd64 ~x86"
  14. IUSE="debug emacs erlang examples java minimal readline threads"
  15. DEPEND="!dev-libs/mpatrol
  16. !dev-util/mono-debugger
  17. readline? ( sys-libs/readline )
  18. erlang? ( dev-lang/erlang )
  19. java? ( >=virtual/jdk-1.5 )"
  20. RDEPEND="${DEPEND}
  21. emacs? ( virtual/emacs )"
  22. S="${WORKDIR}"/${MY_P}
  23. SITEFILE=50${PN}-gentoo.el
  24. src_prepare() {
  25. cd "${WORKDIR}" || die
  26. EPATCH_FORCE=yes
  27. EPATCH_SUFFIX=patch
  28. epatch "${WORKDIR}"/${PV}
  29. sed -i -e "s/@libdir@/$(get_libdir)/" \
  30. "${S}"/scripts/Mmake.vars.in \
  31. || die "sed libdir failed"
  32. cd "${S}" || die
  33. eautoconf
  34. }
  35. src_configure() {
  36. strip-flags
  37. local myconf
  38. myconf="--libdir=/usr/$(get_libdir) \
  39. --disable-deep-profiler \
  40. --disable-dotnet-grades \
  41. --without-hwloc \
  42. $(use_enable erlang erlang-grade) \
  43. $(use_enable java java-grade) \
  44. $(use_enable debug debug-grades) \
  45. $(use_enable threads par-grades) \
  46. $(use_enable !minimal most-grades) \
  47. $(use_with readline)"
  48. econf ${myconf}
  49. }
  50. src_compile() {
  51. # Build Mercury using base llds grade
  52. emake \
  53. PARALLEL=${MAKEOPTS} \
  54. MMAKEFLAGS="EXTRA_MLFLAGS=--no-strip \
  55. EXTRA_LDFLAGS='${LDFLAGS}' \
  56. EXTRA_LD_LIBFLAGS='${LDFLAGS}'" \
  57. || die "emake failed"
  58. # We can now patch .m Mercury compiler files since we
  59. # have just built mercury_compiler.
  60. EPATCH_FORCE=yes
  61. EPATCH_SUFFIX=patch
  62. epatch "${WORKDIR}"/${PV}-mmc
  63. sed -i -e "s/@libdir@/$(get_libdir)/" \
  64. "${S}"/compiler/file_util.m \
  65. "${S}"/compiler/make.program_target.m \
  66. || die "sed libdir failed"
  67. # Rebuild Mercury compiler using the just built mercury_compiler
  68. emake \
  69. PARALLEL=${MAKEOPTS} \
  70. MMAKEFLAGS="EXTRA_MLFLAGS=--no-strip \
  71. EXTRA_LDFLAGS='${LDFLAGS}' \
  72. EXTRA_LD_LIBFLAGS='${LDFLAGS}'" \
  73. MERCURY_COMPILER="${S}"/compiler/mercury_compile \
  74. compiler || die "emake compiler failed"
  75. # The default Mercury grade may not be the same as the grade used to
  76. # compile the llds base grade. Since src_test() is run before
  77. # src_install() we compile the default grade now
  78. emake \
  79. PARALLEL=${MAKEOPTS} \
  80. MMAKEFLAGS="EXTRA_MLFLAGS=--no-strip \
  81. EXTRA_LDFLAGS='${LDFLAGS}' \
  82. EXTRA_LD_LIBFLAGS='${LDFLAGS}'" \
  83. MERCURY_COMPILER="${S}"/compiler/mercury_compile \
  84. default_grade || die "emake default_grade failed"
  85. }
  86. src_test() {
  87. TEST_GRADE=`scripts/ml --print-grade`
  88. if [ -d "${S}"/install_grade_dir.${TEST_GRADE} ] ; then
  89. TWS="${S}"/install_grade_dir.${TEST_GRADE}
  90. cp runtime/mer_rt.init "${TWS}"/runtime/
  91. cp mdbcomp/mer_mdbcomp.init "${TWS}"/mdbcomp/
  92. cp browser/mer_browser.init "${TWS}"/browser/
  93. else
  94. TWS="${S}"
  95. fi
  96. cd "${S}"/tests || die
  97. sed -e "s:@WORKSPACE@:${TWS}:" < WS_FLAGS.ws > WS_FLAGS \
  98. || die "sed WORKSPACE failed"
  99. # Mercury tests must be run in C locale since Mercury output is
  100. # compared to hard-coded warnings/errors
  101. LC_ALL="C" \
  102. PATH="${TWS}"/scripts:"${TWS}"/util:"${S}"/slice:"${PATH}" \
  103. TERM="" \
  104. WORKSPACE="${TWS}" \
  105. WORKSPACE_FLAGS=yes \
  106. MERCURY_COMPILER="${TWS}"/compiler/mercury_compile \
  107. MMAKE_DIR="${TWS}"/scripts \
  108. MERCURY_SUPPRESS_STACK_TRACE=yes \
  109. GRADE=${TEST_GRADE} \
  110. MERCURY_ALL_LOCAL_C_INCL_DIRS=" -I${TWS}/boehm_gc/include \
  111. -I${TWS}/runtime \
  112. -I${TWS}/library" \
  113. mmake || die "mmake test failed"
  114. }
  115. src_install() {
  116. emake \
  117. PARALLEL=${MAKEOPTS} \
  118. MMAKEFLAGS="EXTRA_LDFLAGS='${LDFLAGS}' \
  119. EXTRA_LD_LIBFLAGS='${LDFLAGS}'" \
  120. MERCURY_COMPILER="${S}"/compiler/mercury_compile \
  121. INSTALL_PREFIX="${D}"/usr \
  122. INSTALL_MAN_DIR="${D}"/usr/share/man \
  123. INSTALL_INFO_DIR="${D}"/usr/share/info \
  124. INSTALL_HTML_DIR="${D}"/usr/share/doc/${PF}/html \
  125. INSTALL_ELISP_DIR="${D}/${SITELISP}"/${PN} \
  126. install || die "emake install failed"
  127. if use emacs; then
  128. elisp-site-file-install "${FILESDIR}/${SITEFILE}" \
  129. || die "elisp-site-file-install failed"
  130. fi
  131. dodoc \
  132. BUGS HISTORY LIMITATIONS NEWS README README.Linux \
  133. README.Linux-Alpha README.Linux-m68k README.Linux-PPC \
  134. RELEASE_NOTES TODO VERSION WORK_IN_PROGRESS || die
  135. if use erlang; then
  136. dodoc README.Erlang || die
  137. fi
  138. if use java; then
  139. dodoc README.Java || die
  140. fi
  141. if use examples; then
  142. insinto /usr/share/doc/${PF}/samples
  143. doins samples/{*.m,README,Mmakefile} || die
  144. doins -r samples/c_interface \
  145. samples/diff \
  146. samples/muz \
  147. samples/rot13 \
  148. samples/solutions \
  149. samples/solver_types || die
  150. if use java; then
  151. doins -r samples/java_interface || die
  152. fi
  153. ecvs_clean "${D}"/usr/share/doc/${PF}/samples
  154. fi
  155. }
  156. pkg_postinst() {
  157. use emacs && elisp-site-regen
  158. }
  159. pkg_postrm() {
  160. use emacs && elisp-site-regen
  161. }