1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 PYTHON_COMPAT=( python2_7 )
9 inherit eutils flag-o-matic fortran-2 multilib toolchain-funcs python-single-r1
11 DESCRIPTION="Message-passing parallel language and runtime system"
12 HOMEPAGE="http://charm.cs.uiuc.edu/"
13 SRC_URI="http://charm.cs.uiuc.edu/distrib/${P}.tar.gz"
17 KEYWORDS="~amd64 ~x86"
18 IUSE="charmdebug charmtracing charmproduction cmkopt doc examples mlogft mpi numa smp static-libs syncft tcp"
20 RDEPEND="mpi? ( virtual/mpi )"
24 >=app-text/poppler-0.12.3-r3[utils]
27 >=dev-python/beautifulsoup-4[${PYTHON_USEDEP}]
28 dev-python/lxml[${PYTHON_USEDEP}]
34 doc? ( ${PYTHON_REQUIRED_USE} )
35 cmkopt? ( !charmdebug !charmtracing )
36 charmproduction? ( !charmdebug !charmtracing )"
43 # TCP instead of default UDP for socket comunication
45 CHARM_OPTS+="$(usex tcp ' tcp' '')"
47 # enable direct SMP support using shared memory
48 CHARM_OPTS+="$(usex smp ' smp' '')"
50 CHARM_OPTS+="$(usex mlogft ' mlogft' '')"
51 CHARM_OPTS+="$(usex syncft ' syncft' '')"
53 # Build shared libraries by default.
54 CHARM_OPTS+=" --build-shared"
56 if use charmproduction; then
57 CHARM_OPTS+=" --with-production"
59 if use charmdebug; then
60 CHARM_OPTS+=" --enable-charmdebug"
63 if use charmtracing; then
64 CHARM_OPTS+=" --enable-tracing --enable-tracing-commthread"
68 CHARM_OPTS+="$(usex numa ' --with-numa' '')"
74 -e "/CMK_CF90/s:f90:$(usex mpi "mpif90" "$(tc-getFC)"):g" \
75 -e "/CMK_CXX/s:g++:$(usex mpi "mpic++" "$(tc-getCXX)"):g" \
76 -e "/CMK_CC/s:gcc:$(usex mpi "mpicc" "$(tc-getCC)"):g" \
77 -e '/CMK_F90_MODINC/s:-p:-I:g' \
78 -e "/CMK_LD/s:\"$: ${LDFLAGS} \":g" \
79 -i src/arch/$(usex mpi "mpi" "net")-linux*/*sh || die
82 -e "s:-o conv-cpm:${LDFLAGS} &:g" \
83 -e "s:-o charmxi:${LDFLAGS} &:g" \
84 -e "s:-o charmrun-silent:${LDFLAGS} &:g" \
85 -e "s:-o charmrun-notify:${LDFLAGS} &:g" \
86 -e "s:-o charmrun:${LDFLAGS} &:g" \
87 -e "s:-o charmd_faceless:${LDFLAGS} &:g" \
88 -e "s:-o charmd:${LDFLAGS} &:g" \
90 src/scripts/Makefile \
91 src/arch/net/charmrun/Makefile || die
94 use cmkopt && append-cppflags -DCMK_OPTIMIZE=1
96 # Fix QA notice. Filed report with upstream.
97 append-cflags -DALLOCA_H
99 epatch "${FILESDIR}/charm-6.5.1-cleanup-config.patch"
100 epatch "${FILESDIR}/charm-6.5.1-CkReductionMgr.patch"
101 epatch "${FILESDIR}/charm-6.5.1-fix-string-parsing.patch"
102 epatch "${FILESDIR}/charm-6.5.1-fix-navmenuGenerator.patch"
103 epatch "${FILESDIR}/charm-6.5.1-static-library-fix.patch"
107 local mybuildoptions="$(usex mpi "mpi" "net")-linux$(usex amd64 "-amd64" '') $(get_opts) ${MAKEOPTS} -j1 ${CFLAGS}"
109 # Build charmm++ first.
110 einfo "running ./build charm++ ${mybuildoptions}"
111 ./build charm++ ${mybuildoptions} || die "Failed to build charm++"
115 python-single-r1_pkg_setup
116 python_fix_shebang "${S}/doc"
117 einfo "forcing ${EPYTHON}"
118 emake -j1 -C doc/charm++
123 make -C tests/charm++ test TESTOPTS="++local" || die
127 # Make charmc play well with gentoo before we move it into /usr/bin. This
128 # patch cannot be applied during src_prepare() because the charmc wrapper
129 # is used during building.
130 epatch "${FILESDIR}/charm-6.5.1-charmc-gentoo.patch"
132 sed -e "s|gentoo-include|${P}|" \
133 -e "s|gentoo-libdir|$(get_libdir)|g" \
134 -e "s|VERSION|${P}/VERSION|" \
135 -i ./src/scripts/charmc || die "failed patching charmc script"
137 # In the following, some of the files are symlinks to ../tmp which we need
138 # to dereference first (see bug 432834).
144 if [[ -L ${i} ]]; then
145 i=$(readlink -e "${i}") || die
151 insinto /usr/include/${P}
152 for i in include/*; do
153 if [[ -L ${i} ]]; then
154 i=$(readlink -e "${i}") || die
159 # Install static libs. Charm has a lot of .o "libs" that it requires at
161 if use static-libs; then
162 for i in lib/*.{a,o}; do
163 if [[ -L ${i} ]]; then
164 i=$(readlink -e "${i}") || die
170 # Install shared libs.
171 for i in lib_so/*; do
172 if [[ -L ${i} ]]; then
173 i=$(readlink -e "${i}") || die
182 if use examples; then
183 find examples/ -name 'Makefile' | xargs sed \
184 -r "s:(../)+bin/charmc:/usr/bin/charmc:" -i || \
185 die "Failed to fix examples"
186 find examples/ -name 'Makefile' | xargs sed \
187 -r "s:./charmrun:./charmrun ++local:" -i || \
188 die "Failed to fix examples"
189 insinto /usr/share/doc/${PF}/examples
190 doins -r examples/charm++/*
193 # Install pdf/html docs
195 cd "${S}/doc/charm++"
197 insinto /usr/share/doc/${PF}/pdf
206 einfo "Please test your charm installation by copying the"
207 einfo "content of /usr/share/doc/${PF}/examples to a"
208 einfo "temporary location and run 'make test'."