charm-6.6.0.ebuild 5.4 KB

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