sci-physics/espresso: added live ebuild
[gentoo.git] / sci-physics / espresso / espresso-9999.ebuild
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=6
6
7 PYTHON_COMPAT=( python2_7 )
8 CMAKE_MAKEFILE_GENERATOR="ninja"
9
10 inherit cmake-utils python-single-r1 savedconfig
11
12 DESCRIPTION="Extensible Simulation Package for Research on Soft matter"
13 HOMEPAGE="http://espressomd.org"
14
15 if [[ ${PV} = 9999 ]]; then
16         EGIT_REPO_URI="git://github.com/espressomd/espresso.git https://github.com/espressomd/espresso.git"
17         EGIT_BRANCH="master"
18         inherit git-r3
19         KEYWORDS=""
20 else
21         SRC_URI="mirror://nongnu/${PN}md/${P}.tar.gz"
22         KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-macos"
23 fi
24
25 LICENSE="GPL-3"
26 SLOT="0"
27 IUSE="cuda doc examples +fftw +hdf5 packages python test -tk"
28
29 REQUIRED_USE=" python? ( ${PYTHON_REQUIRED_USE} )"
30
31 RDEPEND="
32         python? (
33                 ${PYTHON_DEPS}
34                 >dev-python/cython-0.22[${PYTHON_USEDEP}]
35                 dev-python/numpy[${PYTHON_USEDEP}]
36         )
37         dev-lang/tcl:0=
38         cuda? ( >=dev-util/nvidia-cuda-toolkit-4.2.9-r1 )
39         fftw? ( sci-libs/fftw:3.0 )
40         dev-libs/boost:=[mpi]
41         virtual/mpi
42         hdf5? ( sci-libs/hdf5 )
43         packages? ( dev-tcltk/tcllib )
44         tk? ( >=dev-lang/tk-8.4.18-r1:0= )"
45
46 DEPEND="${RDEPEND}
47         doc? (
48                 app-doc/doxygen[dot]
49                 dev-texlive/texlive-latexextra
50                 virtual/latex-base )"
51
52 DOCS=( AUTHORS NEWS README ChangeLog )
53
54 pkg_setup() {
55         use python && python-single-r1_pkg_setup
56 }
57
58 src_prepare() {
59         use cuda && cuda_src_prepare
60         cmake-utils_src_prepare
61 }
62
63 src_configure() {
64         mycmakeargs=(
65                 -DWITH_CUDA=$(usex cuda)
66                 -DWITH_PYTHON=$(usex python)
67                 -DWITH_TESTS=$(usex test)
68                 -DWITH_H5MD=$(usex hdf5)
69                 -DCMAKE_DISABLE_FIND_PACKAGE_FFTW3=$(usex !fftw)
70                 -DCMAKE_DISABLE_FIND_PACKAGE_HDF5=$(usex !hdf5)
71                 -DCMAKE_SKIP_RPATH=YES
72         )
73         cmake-utils_src_configure
74 }
75
76 src_compile() {
77         cmake-utils_src_compile
78         use doc && cmake-utils_src_make doxygen
79         [[ ${PV} = 9999 ]] && use doc && cmake-utils_src_make ug dg tutorials
80 }
81
82 src_install() {
83         local i
84
85         #https://github.com/espressomd/espresso/issues/733
86         #cmake-utils_src_install
87         dobin ${CMAKE_BUILD_DIR}/Espresso
88         dolib.so "${CMAKE_BUILD_DIR}"/src/core/{,*}/lib*.so
89         if use python; then
90                 insinto $(python_get_sitedir)/${PN}md
91                 doins -r "${CMAKE_BUILD_DIR}"/src/python/espressomd
92         fi
93
94         insinto /usr/share/${PN}/
95         doins ${CMAKE_BUILD_DIR}/myconfig-sample.hpp
96
97         save_config ${CMAKE_BUILD_DIR}/src/core/myconfig-final.hpp
98
99         if use doc; then
100                 if [[ ${PV} = 9999 ]] ; then
101                         newdoc ${CMAKE_BUILD_DIR}/doc/dg/dg.pdf developer_guide.pdf
102                         newdoc ${CMAKE_BUILD_DIR}/doc/ug/ug.pdf user_guide.pdf
103                         for i in ${CMAKE_BUILD_DIR}/doc/tutorials/*/*/[0-9]*.pdf; do
104                                 newdoc "${i}" "tutorial_${i##*/}"
105                         done
106                 else
107                         newdoc "${S}"/doc/ug/ug.pdf user_guide.pdf
108                         for i in "${S}"/doc/tutorials/*/*/[0-9]*.pdf; do
109                                 newdoc "${i}" "tutorial_${i##*/}"
110                         done
111                 fi
112                 dodoc -r ${CMAKE_BUILD_DIR}/doc/doxygen/html
113         fi
114
115         if use examples; then
116                 insinto /usr/share/${PN}/examples
117                 doins -r samples/*
118         fi
119
120         if use packages; then
121                 insinto /usr/share/${PN}/packages
122                 doins -r packages/*
123         fi
124 }
125
126 pkg_postinst() {
127         echo
128         elog "Please read and cite:"
129         elog "ESPResSo, Comput. Phys. Commun. 174(9) ,704, 2006."
130         elog "http://dx.doi.org/10.1016/j.cpc.2005.10.005"
131         echo
132         elog "If you need more features, change"
133         elog "/etc/portage/savedconfig/${CATEGORY}/${PF}"
134         elog "and reemerge with USE=savedconfig"
135         echo
136         elog "For a full feature list see:"
137         elog "/usr/share/${PN}/myconfig-sample.h"
138         echo
139 }