Gentoo Archives: gentoo-commits

From: Nicolas Bock <nicolasbock@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-physics/lammps/
Date: Thu, 08 Oct 2015 12:32:26
Message-Id: 1444307521.379b7d2b4be5ebc8a952f2531e07396ba8d24a96.nicolasbock@gentoo
1 commit: 379b7d2b4be5ebc8a952f2531e07396ba8d24a96
2 Author: Nicolas Bock <nicolasbock <AT> gentoo <DOT> org>
3 AuthorDate: Thu Oct 8 12:31:31 2015 +0000
4 Commit: Nicolas Bock <nicolasbock <AT> gentoo <DOT> org>
5 CommitDate: Thu Oct 8 12:32:01 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=379b7d2b
7
8 sci-physics/lammps: Version bump.
9
10 Package-Manager: portage-2.2.20.1
11
12 sci-physics/lammps/Manifest | 1 +
13 sci-physics/lammps/lammps-20151005.ebuild | 267 ++++++++++++++++++++++++++++++
14 2 files changed, 268 insertions(+)
15
16 diff --git a/sci-physics/lammps/Manifest b/sci-physics/lammps/Manifest
17 index 5562a01..9d1cdf0 100644
18 --- a/sci-physics/lammps/Manifest
19 +++ b/sci-physics/lammps/Manifest
20 @@ -7,4 +7,5 @@ DIST lammps-21Aug15.tar.gz 87096749 SHA256 46f68e7b61e50ab3e790c53cadd82fde7c7aa
21 DIST lammps-24Sep15.tar.gz 87307191 SHA256 e03cdeb2b3b6107d98969febea26575c85590603ab4f79d26efc46bac6d6cc60 SHA512 356dd556f845cec456865062375120c0898cef1870617d80b31b0e8e964585140120b21f891cd9b40ecde7aaf43beb34d7b15396830e08273624a9b14da551e4 WHIRLPOOL 667b8aaf927d268c569a192c835b7dbdc80a0f25abb1f2c96007517ea218a69b2816dde4ebe28ca82974d01472c0e1126b67e89a19fb3ef49e4020f3d9c69fba
22 DIST lammps-29Aug15.tar.gz 87253305 SHA256 fff69b47c40936d4ccd90a8443ce5bb1bcf4cb449ae06a5822c1b11a2ab2dd67 SHA512 991c56608a3288ebdcd2fb0857c595d42047b5ed0780b6d4ddb98388627499727b6c04fe0eff3e7221238dba2a8601f0b4b4067b5aa5ec2f356b4ee13f6c129c WHIRLPOOL 88da74fa65aeb187330439417512d516fe8adf4a5df4be48fdafafa198e8c4d657ecce7f04f749d77cb2f8a7881ac47f4604cf6bc8eb3ca8b2cbc7988d866a87
23 DIST lammps-4Sep15.tar.gz 87259558 SHA256 8652c801e4ce8b6b7d42a6c71f76b68a6e741dc8efb8d7d3dad36b624fe8f150 SHA512 ee730c8bd96e14931192a68c12e4ebde301cc3525b20816d051059f155b70c6edcea7dc2ed911e0b89685d751cd5a74b4bb5eedd6c16a042a2191bf8a9665fc9 WHIRLPOOL 271ac0d74e03d3e3e118a8b2385d98ce3f566ead67f1c329a219c265f886dc267b11be17c2caa52749ebac212bbc7456fba2d0d6ec69cd25815316e601b3360a
24 +DIST lammps-5Oct15.tar.gz 88451532 SHA256 a76f92ae05b99f9257abf7d79d9365c5743fa5a16b941a5e40f74036c5879211 SHA512 e0a034778cd5e3b9a27c9fc6257f1f7a6a9161732cd83bac2c4b0f82c39d5a6a385bb4640322478bfbe9467afb28b998cd19108b3d4a21e369b80c39a486e065 WHIRLPOOL 291e7820d4736421aeda9a1295854bd7b52d8ca3f14900e9394373410ee5db02ad6ab53991cf4dc8e73328b24fa44659d10693aca7cb48301227299ad622ce31
25 DIST lammps-9Sep15.tar.gz 87275742 SHA256 c783be8bf2c2fbef75522b09b4420006d94104f2a60b82f55f7bc255c6163079 SHA512 60fa8c818c72c3c236095c7aa23c2ec30cc3370b6dc14d0c1d9e347772e70c96dab43019092eb93f2327377f1b4cc642416be65d156b1faf934bfa805d228bcf WHIRLPOOL 4a9dbb0f1b493177614646dcef124c723a3b6171d0894fee8b34e9fff7d0962ada0a2a27564338fef6551aaff322f4b50784b98c250555173cba5478cc60e9af
26
27 diff --git a/sci-physics/lammps/lammps-20151005.ebuild b/sci-physics/lammps/lammps-20151005.ebuild
28 new file mode 100644
29 index 0000000..5400e87
30 --- /dev/null
31 +++ b/sci-physics/lammps/lammps-20151005.ebuild
32 @@ -0,0 +1,267 @@
33 +# Copyright 1999-2015 Gentoo Foundation
34 +# Distributed under the terms of the GNU General Public License v2
35 +# $Id$
36 +
37 +EAPI=5
38 +
39 +PYTHON_COMPAT=( python{2_7,3_3} )
40 +
41 +inherit eutils flag-o-matic fortran-2 multilib python-r1
42 +
43 +convert_month() {
44 + case $1 in
45 + 01) echo Jan
46 + ;;
47 + 02) echo Feb
48 + ;;
49 + 03) echo Mar
50 + ;;
51 + 04) echo Apr
52 + ;;
53 + 05) echo May
54 + ;;
55 + 06) echo Jun
56 + ;;
57 + 07) echo Jul
58 + ;;
59 + 08) echo Aug
60 + ;;
61 + 09) echo Sep
62 + ;;
63 + 10) echo Oct
64 + ;;
65 + 11) echo Nov
66 + ;;
67 + 12) echo Dec
68 + ;;
69 + *) echo unknown
70 + ;;
71 + esac
72 +}
73 +
74 +MY_P=${PN}-$((10#${PV:6:2}))$(convert_month ${PV:4:2})${PV:2:2}
75 +
76 +DESCRIPTION="Large-scale Atomic/Molecular Massively Parallel Simulator"
77 +HOMEPAGE="http://lammps.sandia.gov/"
78 +SRC_URI="http://lammps.sandia.gov/tars/${MY_P}.tar.gz"
79 +
80 +LICENSE="GPL-2"
81 +SLOT="0"
82 +KEYWORDS="~amd64 ~x86"
83 +IUSE="doc examples gzip lammps-memalign mpi python static-libs"
84 +
85 +DEPEND="
86 + mpi? (
87 + virtual/blas
88 + virtual/lapack
89 + virtual/mpi
90 + )
91 + gzip? ( app-arch/gzip )
92 + sci-libs/voro++
93 + python? ( ${PYTHON_DEPS} )
94 + "
95 +RDEPEND="${DEPEND}"
96 +
97 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
98 +
99 +S="${WORKDIR}/${MY_P}"
100 +
101 +lmp_emake() {
102 + local LAMMPS_INCLUDEFLAGS
103 + LAMMPS_INCLUDEFLAGS="$(usex gzip '-DLAMMPS_GZIP' '')"
104 + LAMMPS_INCLUDEFLAGS+="$(usex lammps-memalign ' -DLAMMPS_MEMALIGN=64' '')"
105 +
106 + # The lammps makefile uses CC to indicate the C++ compiler.
107 + emake \
108 + ARCHIVE=$(tc-getAR) \
109 + CC=$(usex mpi "mpic++" "$(tc-getCXX)") \
110 + F90=$(usex mpi "mpif90" "$(tc-getFC)") \
111 + LINK=$(usex mpi "mpic++" "$(tc-getCXX)") \
112 + CCFLAGS="${CXXFLAGS}" \
113 + F90FLAGS="${FCFLAGS}" \
114 + LINKFLAGS="${LDFLAGS}" \
115 + LMP_INC="${LAMMPS_INCLUDEFLAGS}" \
116 + MPI_INC=$(usex mpi "" "-I../STUBS") \
117 + MPI_PATH=$(usex mpi "" "-L../STUBS") \
118 + MPI_LIB=$(usex mpi "" "-lmpi_stubs") \
119 + user-atc_SYSLIB="$(usex mpi "$($(tc-getPKG_CONFIG) --libs blas) $($(tc-getPKG_CONFIG) --libs lapack)" '')"\
120 + "$@"
121 +}
122 +
123 +lmp_activate_packages() {
124 + # Build packages
125 + lmp_emake -C src yes-asphere
126 + lmp_emake -C src yes-body
127 + lmp_emake -C src yes-class2
128 + lmp_emake -C src yes-colloid
129 + lmp_emake -C src yes-coreshell
130 + lmp_emake -C src yes-dipole
131 + lmp_emake -C src yes-fld
132 + #lmp_emake -C src yes-gpu
133 + lmp_emake -C src yes-granular
134 + # Need OpenKIM external dependency.
135 + #lmp_emake -C src yes-kim
136 + # Need Kokkos external dependency.
137 + #lmp_emake -C src yes-kokkos
138 + lmp_emake -C src yes-kspace
139 + lmp_emake -C src yes-manybody
140 + lmp_emake -C src yes-mc
141 + lmp_emake -C src yes-meam
142 + lmp_emake -C src yes-misc
143 + lmp_emake -C src yes-molecule
144 + #lmp_emake -C src yes-mpiio
145 + lmp_emake -C src yes-opt
146 + lmp_emake -C src yes-peri
147 + lmp_emake -C src yes-poems
148 + lmp_emake -C src yes-qeq
149 + lmp_emake -C src yes-reax
150 + lmp_emake -C src yes-replica
151 + lmp_emake -C src yes-rigid
152 + lmp_emake -C src yes-shock
153 + lmp_emake -C src yes-snap
154 + lmp_emake -C src yes-srd
155 + lmp_emake -C src yes-voronoi
156 + lmp_emake -C src yes-xtc
157 +
158 + if use mpi; then
159 + lmp_emake -C src yes-user-atc
160 + fi
161 + lmp_emake -C src yes-user-eff
162 + lmp_emake -C src yes-user-fep
163 + use mpi && lmp_emake -C src yes-user-lb
164 + lmp_emake -C src yes-user-phonon
165 + lmp_emake -C src yes-user-sph
166 +}
167 +
168 +lmp_build_packages() {
169 + lmp_emake -C lib/meam -j1 -f Makefile.gfortran
170 + lmp_emake -C lib/poems -f Makefile.g++
171 + lmp_emake -C lib/reax -j1 -f Makefile.gfortran
172 + use mpi && lmp_emake -C lib/atc -f Makefile.g++
173 +}
174 +
175 +lmp_clean_packages() {
176 + lmp_emake -C lib/meam -f Makefile.gfortran clean
177 + lmp_emake -C lib/poems -f Makefile.g++ clean
178 + lmp_emake -C lib/reax -f Makefile.gfortran clean
179 + use mpi && lmp_emake -C lib/atc -f Makefile.g++ clean
180 +}
181 +
182 +src_prepare() {
183 + # Fix inconsistent use of SHFLAGS.
184 + sed -i \
185 + -e 's:voronoi_SYSINC\s\+=.*$:voronoi_SYSINC = -I/usr/include/voro++:' \
186 + -e 's:voronoi_SYSPATH\s\+=.*$:voronoi_SYSPATH =:' \
187 + lib/voronoi/Makefile.lammps || die
188 +
189 + # Fix missing .so name.
190 + sed -i \
191 + -e 's:SHLIBFLAGS\s\+=\s\+:SHLIBFLAGS = -Wl,-soname,liblammps.so.0 :' \
192 + src/MAKE/Makefile.serial || die
193 +
194 + # Fix makefile in tools.
195 + sed -i \
196 + -e 's:g++:$(CXX) $(CXXFLAGS):' \
197 + -e 's:gcc:$(CC) $(CCFLAGS):' \
198 + -e 's:ifort:$(FC) $(FCFLAGS):' \
199 + tools/Makefile || die
200 +
201 + # Patch python.
202 + epatch "${FILESDIR}/lammps-python3-r1.patch"
203 + epatch "${FILESDIR}/python-shebang.patch"
204 +}
205 +
206 +src_compile() {
207 + # Fix atc...
208 + append-cxxflags -I../../src
209 +
210 + # Acticate packages.
211 + elog "Activating lammps packages..."
212 + lmp_activate_packages
213 +
214 + # Compile stubs for serial version.
215 + use mpi || lmp_emake -C src mpi-stubs
216 +
217 + elog "Building packages..."
218 + lmp_build_packages
219 +
220 + if use static-libs; then
221 + # Build static library.
222 + elog "Building static library..."
223 + lmp_emake -C src mode=lib serial
224 + fi
225 +
226 + # Clean out packages (that's not done by the build system with the clean
227 + # target), so we can rebuild the packages with -fPIC.
228 + elog "Cleaning packages..."
229 + lmp_clean_packages
230 +
231 + # The build system does not rebuild the packages with -fPIC, adding flag
232 + # manually.
233 + append-cxxflags -fPIC
234 + append-fflags -fPIC
235 +
236 + # Compile stubs for serial version.
237 + use mpi || lmp_emake -C src mpi-stubs
238 +
239 + elog "Building packages..."
240 + lmp_build_packages
241 +
242 + # Build shared library.
243 + elog "Building shared library..."
244 + lmp_emake -C src mode=shlib serial
245 +
246 + # Compile main executable. The shared library is always built, and
247 + # mode=shexe is simply a way to re-use the object files built in the
248 + # "shlib" step when linking the executable. The executable is not actually
249 + # using the shared library. If we have built the static library, then we
250 + # link that into the executable.
251 + elog "Linking executable..."
252 + if use static-libs; then
253 + lmp_emake -C src mode=exe serial
254 + else
255 + lmp_emake -C src mode=shexe serial
256 + fi
257 +
258 + # Compile tools.
259 + elog "Building tools..."
260 + lmp_emake -C tools binary2txt chain data2xmovie micelle2d
261 +}
262 +
263 +src_install() {
264 + use static-libs && newlib.a src/liblammps_serial.a liblammps.a
265 + newlib.so src/liblammps_serial.so liblammps.so.0.0.0
266 + dosym liblammps.so.0.0.0 /usr/$(get_libdir)/liblammps.so
267 + dosym liblammps.so.0.0.0 /usr/$(get_libdir)/liblammps.so.0
268 + newbin src/lmp_serial lmp
269 + dobin tools/binary2txt
270 + dobin tools/chain
271 + dobin tools/data2xmovie
272 + dobin tools/micelle2d
273 + # Don't forget to add header files of optional packages as they are added
274 + # to this ebuild. There may also be .mod files from Fortran based
275 + # packages.
276 + insinto "/usr/include/${PN}"
277 + doins -r src/*.h lib/meam/*.mod
278 +
279 + local LAMMPS_POTENTIALS="usr/share/${PN}/potentials"
280 + insinto "/${LAMMPS_POTENTIALS}"
281 + doins potentials/*
282 + echo "LAMMPS_POTENTIALS=${EROOT}${LAMMPS_POTENTIALS}" > 99lammps
283 + doenvd 99lammps
284 +
285 + # Install python script.
286 + use python && python_foreach_impl python_domodule python/lammps.py
287 +
288 + if use examples; then
289 + local LAMMPS_EXAMPLES="/usr/share/${PN}/examples"
290 + insinto "${LAMMPS_EXAMPLES}"
291 + doins -r examples/*
292 + fi
293 +
294 + dodoc README
295 + if use doc; then
296 + dodoc doc/Manual.pdf
297 + dohtml -r doc/*
298 + fi
299 +}