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: Wed, 16 Dec 2015 13:54:44
Message-Id: 1450274063.c9aece8e23913355c604b7c1ebbb9807e0cf6747.nicolasbock@gentoo
1 commit: c9aece8e23913355c604b7c1ebbb9807e0cf6747
2 Author: Nicolas Bock <nicolasbock <AT> gentoo <DOT> org>
3 AuthorDate: Wed Dec 16 13:53:50 2015 +0000
4 Commit: Nicolas Bock <nicolasbock <AT> gentoo <DOT> org>
5 CommitDate: Wed Dec 16 13:54:23 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c9aece8e
7
8 sci-physics/lammps: Version bump
9
10 Package-Manager: portage-2.2.24
11
12 sci-physics/lammps/Manifest | 1 +
13 sci-physics/lammps/lammps-20151208.ebuild | 217 ++++++++++++++++++++++++++++++
14 2 files changed, 218 insertions(+)
15
16 diff --git a/sci-physics/lammps/Manifest b/sci-physics/lammps/Manifest
17 index 2545b3b..83fb838 100644
18 --- a/sci-physics/lammps/Manifest
19 +++ b/sci-physics/lammps/Manifest
20 @@ -12,4 +12,5 @@ DIST lammps-4Sep15.tar.gz 87259558 SHA256 8652c801e4ce8b6b7d42a6c71f76b68a6e741d
21 DIST lammps-5Oct15.tar.gz 88451532 SHA256 a76f92ae05b99f9257abf7d79d9365c5743fa5a16b941a5e40f74036c5879211 SHA512 e0a034778cd5e3b9a27c9fc6257f1f7a6a9161732cd83bac2c4b0f82c39d5a6a385bb4640322478bfbe9467afb28b998cd19108b3d4a21e369b80c39a486e065 WHIRLPOOL 291e7820d4736421aeda9a1295854bd7b52d8ca3f14900e9394373410ee5db02ad6ab53991cf4dc8e73328b24fa44659d10693aca7cb48301227299ad622ce31
22 DIST lammps-6Nov15.tar.gz 90177074 SHA256 b908d87106e89aa813c3d1a2e89f297ab42471ee463ef950f87f284d62aa24ac SHA512 91f8e33a00b3605dbb78f622a19886c11ca8ef3f4babe74e8d8f90bb176d5689e75d619155f58e6754a2756d20c05b74389e34f024167cba1841b8aade171daf WHIRLPOOL 4541537ea73292648764d6c8a7560f3127b8f911f4dcff0a97735c8e75868dc3aec7c2b32a2928ea446e8cfec87c81c9f86a635d29f3a65f42fd27661725911e
23 DIST lammps-7Dec15.tar.gz 82168656 SHA256 7fa1bb1089437c0f38f8c6920286e2f8424e6449956b4d570da2954f507af1e7 SHA512 13078e7614402efc310a178506134409b40fb2768c4d7ee1cfa6992b247ef25169288ec99d4314b1a98125037d7c1c954bd114abc6ac41c58f60506358d150e2 WHIRLPOOL f9ba52c0c93ea6950b2ee7e0f5e15ebef6ea50f647d23cb2f9a1caf523d3dfb8d52adbdf8f8840eebd7f79fc59ab294310b7bf7109b27c6b7e9d6e7d2f18b7ee
24 +DIST lammps-8Dec15.tar.gz 90700099 SHA256 1782a856dcba1696e6e921d891f259e525de750d7cf39ce9457a1992ee4db91f SHA512 0382683a363975bd27cc1722932cd5b8eda9933bc9c676af135d7e4d784acd93cf60b2b47a19dbb9e4a05e5cf2fbf6ccc2c2a914c39e92e87009e23ead2eb497 WHIRLPOOL dca88d8d55e96c20702856b2074d631ef8f6a0f6209672e612778209ad188c800a673e09605033851349b400241b1f7c8e5e05bad49519838abfe5fe44467c43
25 DIST lammps-9Sep15.tar.gz 87275742 SHA256 c783be8bf2c2fbef75522b09b4420006d94104f2a60b82f55f7bc255c6163079 SHA512 60fa8c818c72c3c236095c7aa23c2ec30cc3370b6dc14d0c1d9e347772e70c96dab43019092eb93f2327377f1b4cc642416be65d156b1faf934bfa805d228bcf WHIRLPOOL 4a9dbb0f1b493177614646dcef124c723a3b6171d0894fee8b34e9fff7d0962ada0a2a27564338fef6551aaff322f4b50784b98c250555173cba5478cc60e9af
26
27 diff --git a/sci-physics/lammps/lammps-20151208.ebuild b/sci-physics/lammps/lammps-20151208.ebuild
28 new file mode 100644
29 index 0000000..e692e6f
30 --- /dev/null
31 +++ b/sci-physics/lammps/lammps-20151208.ebuild
32 @@ -0,0 +1,217 @@
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,3_4} )
40 +
41 +inherit eutils flag-o-matic fortran-2 multilib python-r1
42 +
43 +convert_month() {
44 + local months=( "" Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec )
45 + echo ${months[${1#0}]}
46 +}
47 +
48 +MY_P=${PN}-$((10#${PV:6:2}))$(convert_month ${PV:4:2})${PV:2:2}
49 +
50 +DESCRIPTION="Large-scale Atomic/Molecular Massively Parallel Simulator"
51 +HOMEPAGE="http://lammps.sandia.gov/"
52 +SRC_URI="http://lammps.sandia.gov/tars/${MY_P}.tar.gz"
53 +
54 +LICENSE="GPL-2"
55 +SLOT="0"
56 +KEYWORDS="~amd64 ~x86"
57 +IUSE="doc examples gzip lammps-memalign mpi python static-libs"
58 +
59 +DEPEND="
60 + mpi? (
61 + virtual/blas
62 + virtual/lapack
63 + virtual/mpi
64 + )
65 + gzip? ( app-arch/gzip )
66 + sci-libs/voro++
67 + python? ( ${PYTHON_DEPS} )
68 + "
69 +RDEPEND="${DEPEND}"
70 +
71 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
72 +
73 +S="${WORKDIR}/${MY_P}"
74 +
75 +lmp_emake() {
76 + local LAMMPS_INCLUDEFLAGS
77 + LAMMPS_INCLUDEFLAGS="$(usex gzip '-DLAMMPS_GZIP' '')"
78 + LAMMPS_INCLUDEFLAGS+="$(usex lammps-memalign ' -DLAMMPS_MEMALIGN=64' '')"
79 +
80 + # The lammps makefile uses CC to indicate the C++ compiler.
81 + emake \
82 + ARCHIVE="$(tc-getAR)" \
83 + CC="$(usex mpi "mpic++" "$(tc-getCXX)")" \
84 + F90="$(usex mpi "mpif90" "$(tc-getFC)")" \
85 + LINK="$(usex mpi "mpic++" "$(tc-getCXX)")" \
86 + CCFLAGS="${CXXFLAGS}" \
87 + F90FLAGS="${FCFLAGS}" \
88 + LINKFLAGS="${LDFLAGS}" \
89 + LMP_INC="${LAMMPS_INCLUDEFLAGS}" \
90 + MPI_INC="$(usex mpi "" "-I../STUBS")" \
91 + MPI_PATH="$(usex mpi "" "-L../STUBS")" \
92 + MPI_LIB="$(usex mpi "" "-lmpi_stubs")" \
93 + user-atc_SYSLIB="$(usex mpi "$($(tc-getPKG_CONFIG) --libs blas) $($(tc-getPKG_CONFIG) --libs lapack)" '')"\
94 + "$@"
95 +}
96 +
97 +lmp_activate_packages() {
98 + # Build packages
99 + local packages=( yes-asphere yes-body yes-class2 yes-colloid \
100 + yes-coreshell yes-dipole yes-fld yes-granular yes-kspace \
101 + yes-manybody yes-mc yes-meam yes-misc \
102 + $(usex mpi "yes-user-atc" "") \
103 + yes-molecule yes-opt yes-peri yes-poems yes-qeq yes-reax \
104 + yes-replica yes-rigid yes-shock yes-snap yes-srd \
105 + yes-user-eff yes-user-fep \
106 + $(usex mpi "yes-user-lb" "") \
107 + yes-user-phonon yes-user-sph yes-voronoi yes-xtc )
108 +
109 + for p in ${packages[@]}; do
110 + lmp_emake -C src ${p}
111 + done
112 +}
113 +
114 +lmp_build_packages() {
115 + lmp_emake -C lib/meam -j1 -f Makefile.gfortran
116 + lmp_emake -C lib/poems -f Makefile.g++
117 + lmp_emake -C lib/reax -j1 -f Makefile.gfortran
118 + use mpi && lmp_emake -C lib/atc -f Makefile.g++
119 +}
120 +
121 +lmp_clean_packages() {
122 + lmp_emake -C lib/meam -f Makefile.gfortran clean
123 + lmp_emake -C lib/poems -f Makefile.g++ clean
124 + lmp_emake -C lib/reax -f Makefile.gfortran clean
125 + use mpi && lmp_emake -C lib/atc -f Makefile.g++ clean
126 +}
127 +
128 +src_prepare() {
129 + # Fix inconsistent use of SHFLAGS.
130 + sed -i \
131 + -e 's:voronoi_SYSINC\s\+=.*$:voronoi_SYSINC = -I/usr/include/voro++:' \
132 + -e 's:voronoi_SYSPATH\s\+=.*$:voronoi_SYSPATH =:' \
133 + lib/voronoi/Makefile.lammps || die
134 +
135 + # Fix missing .so name.
136 + sed -i \
137 + -e 's:SHLIBFLAGS\s\+=\s\+:SHLIBFLAGS = -Wl,-soname,liblammps.so.0 :' \
138 + src/MAKE/Makefile.serial || die
139 +
140 + # Fix makefile in tools.
141 + sed -i \
142 + -e 's:g++:$(CXX) $(CXXFLAGS):' \
143 + -e 's:gcc:$(CC) $(CCFLAGS):' \
144 + -e 's:ifort:$(FC) $(FCFLAGS):' \
145 + tools/Makefile || die
146 +
147 + # Patch python.
148 + epatch "${FILESDIR}/lammps-python3-r1.patch"
149 + epatch "${FILESDIR}/python-shebang.patch"
150 +}
151 +
152 +src_compile() {
153 + # Fix atc...
154 + append-cxxflags -I../../src
155 +
156 + # Acticate packages.
157 + elog "Activating lammps packages..."
158 + lmp_activate_packages
159 +
160 + # STUBS/mpi.c is using '#include <mpi.h>' now instead of '#include
161 + # "mpi.h"' which requires an additional '-I.'.
162 + append-cxxflags -I.
163 +
164 + # Compile stubs for serial version.
165 + use mpi || lmp_emake -C src mpi-stubs
166 +
167 + elog "Building packages..."
168 + lmp_build_packages
169 +
170 + if use static-libs; then
171 + # Build static library.
172 + elog "Building static library..."
173 + lmp_emake -C src mode=lib serial
174 + fi
175 +
176 + # Clean out packages (that's not done by the build system with the clean
177 + # target), so we can rebuild the packages with -fPIC.
178 + elog "Cleaning packages..."
179 + lmp_clean_packages
180 +
181 + # The build system does not rebuild the packages with -fPIC, adding flag
182 + # manually.
183 + append-cxxflags -fPIC
184 + append-fflags -fPIC
185 +
186 + # Compile stubs for serial version.
187 + use mpi || lmp_emake -C src mpi-stubs
188 +
189 + elog "Building packages..."
190 + lmp_build_packages
191 +
192 + # Build shared library.
193 + elog "Building shared library..."
194 + lmp_emake -C src mode=shlib serial
195 +
196 + # Compile main executable. The shared library is always built, and
197 + # mode=shexe is simply a way to re-use the object files built in the
198 + # "shlib" step when linking the executable. The executable is not actually
199 + # using the shared library. If we have built the static library, then we
200 + # link that into the executable.
201 + elog "Linking executable..."
202 + if use static-libs; then
203 + lmp_emake -C src mode=exe serial
204 + else
205 + lmp_emake -C src mode=shexe serial
206 + fi
207 +
208 + # Compile tools.
209 + elog "Building tools..."
210 + lmp_emake -C tools binary2txt chain data2xmovie micelle2d
211 +}
212 +
213 +src_install() {
214 + use static-libs && newlib.a src/liblammps_serial.a liblammps.a
215 + newlib.so src/liblammps_serial.so liblammps.so.0.0.0
216 + dosym liblammps.so.0.0.0 /usr/$(get_libdir)/liblammps.so
217 + dosym liblammps.so.0.0.0 /usr/$(get_libdir)/liblammps.so.0
218 + newbin src/lmp_serial lmp
219 + dobin tools/binary2txt
220 + dobin tools/chain
221 + dobin tools/data2xmovie
222 + dobin tools/micelle2d
223 + # Don't forget to add header files of optional packages as they are added
224 + # to this ebuild. There may also be .mod files from Fortran based
225 + # packages.
226 + insinto "/usr/include/${PN}"
227 + doins -r src/*.h lib/meam/*.mod
228 +
229 + local LAMMPS_POTENTIALS="usr/share/${PN}/potentials"
230 + insinto "/${LAMMPS_POTENTIALS}"
231 + doins potentials/*
232 + echo "LAMMPS_POTENTIALS=${EROOT}${LAMMPS_POTENTIALS}" > 99lammps
233 + doenvd 99lammps
234 +
235 + # Install python script.
236 + use python && python_foreach_impl python_domodule python/lammps.py
237 +
238 + if use examples; then
239 + local LAMMPS_EXAMPLES="/usr/share/${PN}/examples"
240 + insinto "${LAMMPS_EXAMPLES}"
241 + doins -r examples/*
242 + fi
243 +
244 + dodoc README
245 + if use doc; then
246 + dodoc doc/Manual.pdf
247 + dohtml -r doc/*
248 + fi
249 +}