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