charm-6.5.1-r3.ebuild 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. PYTHON_COMPAT=( python2_7 )
  5. inherit eutils flag-o-matic fortran-2 multilib toolchain-funcs python-any-r1
  6. DESCRIPTION="Message-passing parallel language and runtime system"
  7. HOMEPAGE="http://charm.cs.uiuc.edu/"
  8. SRC_URI="http://charm.cs.uiuc.edu/distrib/${P}.tar.gz"
  9. LICENSE="charm"
  10. SLOT="0"
  11. KEYWORDS="~amd64 ~x86"
  12. IUSE="charmdebug charmtracing charmproduction cmkopt doc examples mlogft mpi numa smp static-libs syncft tcp"
  13. RDEPEND="mpi? ( virtual/mpi )"
  14. DEPEND="
  15. ${RDEPEND}
  16. doc? (
  17. >=app-text/poppler-0.12.3-r3[utils]
  18. dev-tex/latex2html
  19. virtual/tex-base
  20. $(python_gen_any_dep '
  21. >=dev-python/beautifulsoup-4[${PYTHON_USEDEP}]
  22. dev-python/lxml[${PYTHON_USEDEP}]
  23. ')
  24. media-libs/netpbm
  25. ${PYTHON_DEPS}
  26. )"
  27. REQUIRED_USE="
  28. cmkopt? ( !charmdebug !charmtracing )
  29. charmproduction? ( !charmdebug !charmtracing )"
  30. FORTRAN_STANDARD="90"
  31. pkg_setup() {
  32. use doc && python-any-r1_pkg_setup
  33. }
  34. get_opts() {
  35. local CHARM_OPTS
  36. # TCP instead of default UDP for socket comunication
  37. # protocol
  38. CHARM_OPTS+="$(usex tcp ' tcp' '')"
  39. # enable direct SMP support using shared memory
  40. CHARM_OPTS+="$(usex smp ' smp' '')"
  41. CHARM_OPTS+="$(usex mlogft ' mlogft' '')"
  42. CHARM_OPTS+="$(usex syncft ' syncft' '')"
  43. # Build shared libraries by default.
  44. CHARM_OPTS+=" --build-shared"
  45. if use charmproduction; then
  46. CHARM_OPTS+=" --with-production"
  47. else
  48. if use charmdebug; then
  49. CHARM_OPTS+=" --enable-charmdebug"
  50. fi
  51. if use charmtracing; then
  52. CHARM_OPTS+=" --enable-tracing --enable-tracing-commthread"
  53. fi
  54. fi
  55. CHARM_OPTS+="$(usex numa ' --with-numa' '')"
  56. echo $CHARM_OPTS
  57. }
  58. src_prepare() {
  59. sed \
  60. -e "/CMK_CF90/s:f90:$(usex mpi "mpif90" "$(tc-getFC)"):g" \
  61. -e "/CMK_CXX/s:g++:$(usex mpi "mpic++" "$(tc-getCXX)"):g" \
  62. -e "/CMK_CC/s:gcc:$(usex mpi "mpicc" "$(tc-getCC)"):g" \
  63. -e '/CMK_F90_MODINC/s:-p:-I:g' \
  64. -e "/CMK_LD/s:\"$: ${LDFLAGS} \":g" \
  65. -i src/arch/$(usex mpi "mpi" "net")-linux*/*sh || die
  66. sed \
  67. -e "s:-o conv-cpm:${LDFLAGS} &:g" \
  68. -e "s:-o charmxi:${LDFLAGS} &:g" \
  69. -e "s:-o charmrun-silent:${LDFLAGS} &:g" \
  70. -e "s:-o charmrun-notify:${LDFLAGS} &:g" \
  71. -e "s:-o charmrun:${LDFLAGS} &:g" \
  72. -e "s:-o charmd_faceless:${LDFLAGS} &:g" \
  73. -e "s:-o charmd:${LDFLAGS} &:g" \
  74. -i \
  75. src/scripts/Makefile \
  76. src/arch/net/charmrun/Makefile || die
  77. # CMK optimization
  78. use cmkopt && append-cppflags -DCMK_OPTIMIZE=1
  79. # Fix QA notice. Filed report with upstream.
  80. append-cflags -DALLOCA_H
  81. epatch "${FILESDIR}/charm-6.5.1-cleanup-config.patch"
  82. epatch "${FILESDIR}/charm-6.5.1-CkReductionMgr.patch"
  83. epatch "${FILESDIR}/charm-6.5.1-fix-string-parsing.patch"
  84. epatch "${FILESDIR}/charm-6.5.1-fix-navmenuGenerator.patch"
  85. epatch "${FILESDIR}/charm-6.5.1-fix-markupSanitizer.patch"
  86. epatch "${FILESDIR}/charm-6.5.1-static-library-fix.patch"
  87. }
  88. src_compile() {
  89. local mybuildoptions="$(usex mpi "mpi" "net")-linux$(usex amd64 "-amd64" '') $(get_opts) ${MAKEOPTS} -j1 ${CFLAGS}"
  90. # Build charmm++ first.
  91. einfo "running ./build charm++ ${mybuildoptions}"
  92. ./build charm++ ${mybuildoptions} || die "Failed to build charm++"
  93. # make pdf/html docs
  94. if use doc; then
  95. emake -j1 -C doc/charm++
  96. fi
  97. }
  98. src_test() {
  99. make -C tests/charm++ test TESTOPTS="++local" || die
  100. }
  101. src_install() {
  102. # Make charmc play well with gentoo before we move it into /usr/bin. This
  103. # patch cannot be applied during src_prepare() because the charmc wrapper
  104. # is used during building.
  105. epatch "${FILESDIR}/charm-6.5.1-charmc-gentoo.patch"
  106. sed -e "s|gentoo-include|${P}|" \
  107. -e "s|gentoo-libdir|$(get_libdir)|g" \
  108. -e "s|VERSION|${P}/VERSION|" \
  109. -i ./src/scripts/charmc || die "failed patching charmc script"
  110. # In the following, some of the files are symlinks to ../tmp which we need
  111. # to dereference first (see bug 432834).
  112. local i
  113. # Install binaries.
  114. for i in bin/*; do
  115. if [[ -L ${i} ]]; then
  116. i=$(readlink -e "${i}") || die
  117. fi
  118. dobin "${i}"
  119. done
  120. # Install headers.
  121. insinto /usr/include/${P}
  122. for i in include/*; do
  123. if [[ -L ${i} ]]; then
  124. i=$(readlink -e "${i}") || die
  125. fi
  126. doins "${i}"
  127. done
  128. # Install static libs. Charm has a lot of .o "libs" that it requires at
  129. # runtime.
  130. if use static-libs; then
  131. for i in lib/*.{a,o}; do
  132. if [[ -L ${i} ]]; then
  133. i=$(readlink -e "${i}") || die
  134. fi
  135. dolib "${i}"
  136. done
  137. fi
  138. # Install shared libs.
  139. for i in lib_so/*; do
  140. if [[ -L ${i} ]]; then
  141. i=$(readlink -e "${i}") || die
  142. fi
  143. dolib.so "${i}"
  144. done
  145. # Basic docs.
  146. dodoc CHANGES README
  147. # Install examples.
  148. if use examples; then
  149. find examples/ -name 'Makefile' | xargs sed \
  150. -r "s:(../)+bin/charmc:/usr/bin/charmc:" -i || \
  151. die "Failed to fix examples"
  152. find examples/ -name 'Makefile' | xargs sed \
  153. -r "s:./charmrun:./charmrun ++local:" -i || \
  154. die "Failed to fix examples"
  155. insinto /usr/share/doc/${PF}/examples
  156. doins -r examples/charm++/*
  157. fi
  158. # Install pdf/html docs
  159. if use doc; then
  160. cd "${S}/doc/charm++"
  161. # Install pdfs.
  162. insinto /usr/share/doc/${PF}/pdf
  163. doins *.pdf
  164. # Install html.
  165. docinto html
  166. dohtml -r manual/*
  167. fi
  168. }
  169. pkg_postinst() {
  170. einfo "Please test your charm installation by copying the"
  171. einfo "content of /usr/share/doc/${PF}/examples to a"
  172. einfo "temporary location and run 'make test'."
  173. }