]> Pileus Git - ~andy/sunrise/blob - sci-chemistry/hoomd/hoomd-0.9.1.3815.ebuild
6da086d3c0eee84061eb9fbafcdba15d238ce045
[~andy/sunrise] / sci-chemistry / hoomd / hoomd-0.9.1.3815.ebuild
1 # Copyright 1999-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI="2"
6 PYTHON_DEPEND="2"
7 SUPPORT_PYTHON_ABIS="1"
8 MY_DOC_PV="0.9.1"
9
10 inherit cmake-utils eutils fdo-mime python versionator
11 DESCRIPTION="HOOMD performs general purpose molecular dynamics simulations on NVIDIA GPUs"
12 HOMEPAGE="http://codeblue.umich.edu/hoomd-blue/index.html"
13 SRC_URI="http://umich.edu/~rjsm/${P}.tar.bz2
14         doc? ( http://codeblue.umich.edu/hoomd-blue/downloads/0.9/hoomd-userdoc-${MY_DOC_PV}.pdf
15                 http://codeblue.umich.edu/hoomd-blue/downloads/0.9/hoomd-devdoc-${MY_DOC_PV}.tar.bz2 )"
16
17 LICENSE="BSD"
18 SLOT="0"
19 KEYWORDS="~amd64 ~x86"
20 IUSE="+cuda debug doc +openmp +single-precision static-libs zlib"
21
22 RDEPEND="dev-libs/boost
23         cuda? ( >=dev-util/nvidia-cuda-toolkit-2.0 dev-util/nvidia-cuda-sdk )
24         sys-libs/zlib"
25 DEPEND="${RDEPEND}"
26 RESTRICT_PYTHON_ABIS="3.*"
27
28 pkg_setup() {
29         python_pkg_setup
30
31         if use cuda; then
32                 if has_version '<=dev-util/nvidia-cuda-toolkit-3.0'; then
33                         if version_is_at_least 4.4 $(gcc-version); then
34                                 ewarn "Nvidia CUDA SDK version 3.0 and below requires a gcc version less than 4.4"
35                                 ewarn "Enabling the cuda use flag with gcc version 4.4 or higher will cause build failures in those SDK versions."
36                                 ewarn "Please use gcc-config to set a gcc version less than 4.4 ."
37                         fi
38
39                 elif has_version '<=dev-util/nvidia-cuda-toolkit-3.2'; then
40                         if version_is_at_least 4.5 $(gcc-version); then
41                                 ewarn "Nvidia CUDA SDK Version 3.2 and below require a gcc version less than 4.5"
42                                 ewarn "Enabling the cuda use flag with gcc version 4.5 or higher will cause build failures in those SDK versions."
43                                 ewarn "Please use gcc-config to set a gcc version less than 4.5."
44                         fi
45                 fi
46         fi
47 }
48
49 src_prepare(){
50         python_copy_sources
51 }
52
53 src_configure(){
54         use single-precision && local sp="ON" || local sp="OFF"
55
56         if use !single-precision && use cuda ; then
57                 ewarn "Single precision must be enabled to have cuda support built-in."
58                 ewarn "Single-precision will be enabled for this build."
59                 local sp="ON"
60         fi
61         my_config() {
62                 local mycmakeargs=(
63                         $(cmake-utils_use_enable cuda CUDA)
64                         $(cmake-utils_use_enable static-libs STATIC)
65                         $(cmake-utils_use_enable test BUILD_TESTING)
66                         $(cmake-utils_use_enable openmp OPENMP)
67                         $(cmake-utils_use_enable zlib ZLIB)
68                         -DENABLE_VALGRIND=OFF
69                         -DENABLE_NATIVE_INSTALL=0N
70                         -DENABLE_DOXYGEN=OFF
71                         -DPYTHON_SITEDIR="$(python_get_sitedir)"
72                         -DENABLE_SINGLE_PRECISION=${sp}
73                         -DCMAKE_BUILD_TYPE=${cbt}
74                         -DENABLE_OCELOT:BOOL=OFF
75                         )
76
77                 cmake-utils_src_configure
78         }
79
80         python_execute_function -s my_config
81 }
82
83 src_test(){
84         python_execute_function -s cmake-utils_src_test
85 }
86
87 src_install(){
88         if use doc; then
89                 insinto /usr/share/doc/${PF}
90                 newins  "${DISTDIR}/hoomd-userdoc-${MY_DOC_PV}.pdf" hoom-userdoc-${PV}.pdf || die "docs failed"
91
92                 insinto /usr/share/doc/${PF}/devdocs
93                 mv "${WORKDIR}/hoomd-devdoc-${MY_DOC_PV}/" "${WORKDIR}/hoomd-devdoc-${PV}" || die
94                 doins -r "${WORKDIR}/hoomd-devdoc-${PV}/" || die "docs failed"
95         fi
96
97         python_execute_function -s cmake-utils_src_install
98 }
99
100 pkg_postinst() {
101         fdo-mime_desktop_database_update
102         fdo-mime_mime_database_update
103 }
104
105 pkg_postrm() {
106         fdo-mime_desktop_database_update
107         fdo-mime_mime_database_update
108 }