/[gentoo-x86]/sci-physics/lammps/lammps-20150210.ebuild
Gentoo

Contents of /sci-physics/lammps/lammps-20150210.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Tue Apr 21 17:40:20 2015 UTC (4 years, 9 months ago) by pacho
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +2 -2 lines
x86 stable wrt bug #544018

(Portage version: 2.2.18/cvs/Linux x86_64, RepoMan options: --include-arches="x86", signed Manifest commit with key A188FBD4)

1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sci-physics/lammps/lammps-20150210.ebuild,v 1.2 2015/03/21 13:10:45 nicolasbock Exp $
4
5 EAPI=5
6
7 inherit eutils flag-o-matic fortran-2 multilib
8
9 convert_month() {
10 case $1 in
11 01) echo Jan
12 ;;
13 02) echo Feb
14 ;;
15 03) echo Mar
16 ;;
17 04) echo Apr
18 ;;
19 05) echo May
20 ;;
21 06) echo Jun
22 ;;
23 07) echo Jul
24 ;;
25 08) echo Aug
26 ;;
27 09) echo Sep
28 ;;
29 10) echo Oct
30 ;;
31 11) echo Nov
32 ;;
33 12) echo Dec
34 ;;
35 *) echo unknown
36 ;;
37 esac
38 }
39
40 MY_P=${PN}-$((10#${PV:6:2}))$(convert_month ${PV:4:2})${PV:2:2}
41
42 DESCRIPTION="Large-scale Atomic/Molecular Massively Parallel Simulator"
43 HOMEPAGE="http://lammps.sandia.gov/"
44 SRC_URI="http://lammps.sandia.gov/tars/${MY_P}.tar.gz"
45
46 LICENSE="GPL-2"
47 SLOT="0"
48 KEYWORDS="amd64 x86"
49 IUSE="doc examples gzip lammps-memalign mpi static-libs"
50
51 DEPEND="
52 mpi? (
53 virtual/blas
54 virtual/lapack
55 virtual/mpi
56 )
57 sci-libs/voro++
58 "
59 RDEPEND="${DEPEND}"
60
61 S="${WORKDIR}/${MY_P}"
62
63 lmp_emake() {
64 local LAMMPS_INCLUDEFLAGS
65 LAMMPS_INCLUDEFLAGS="$(usex gzip '-DLAMMPS_GZIP' '')"
66 LAMMPS_INCLUDEFLAGS+="$(usex lammps-memalign ' -DLAMMPS_MEMALIGN' '')"
67
68 # The lammps makefile uses CC to indicate the C++ compiler.
69 emake \
70 ARCHIVE=$(tc-getAR) \
71 CC=$(usex mpi "mpic++" "$(tc-getCXX)") \
72 F90=$(usex mpi "mpif90" "$(tc-getFC)") \
73 LINK=$(usex mpi "mpic++" "$(tc-getCXX)") \
74 CCFLAGS="${CXXFLAGS}" \
75 F90FLAGS="${FCFLAGS}" \
76 LINKFLAGS="${LDFLAGS}" \
77 LMP_INC="${LAMMPS_INCLUDEFLAGS}" \
78 MPI_INC=$(usex mpi '' "-I../STUBS") \
79 MPI_PATH=$(usex mpi '' '-L../STUBS') \
80 MPI_LIB=$(usex mpi '' '-lmpi_stubs') \
81 user-atc_SYSLIB="$(usex mpi "$($(tc-getPKG_CONFIG) --libs blas) $($(tc-getPKG_CONFIG) --libs lapack)" '')"\
82 "$@"
83 }
84
85 src_prepare() {
86 # Fix inconsistent use of SHFLAGS.
87 sed -i \
88 -e 's:voronoi_SYSINC\s\+=.*$:voronoi_SYSINC = -I/usr/include/voro++:' \
89 -e 's:voronoi_SYSPATH\s\+=.*$:voronoi_SYSPATH =:' \
90 lib/voronoi/Makefile.lammps || die
91
92 # Fix missing .so name.
93 sed -i \
94 -e 's:SHLIBFLAGS\s\+=\s\+:SHLIBFLAGS = -Wl,-soname,liblammps.so.0 :' \
95 src/MAKE/Makefile.serial || die
96
97 # Fix makefile in tools.
98 sed -i \
99 -e 's:g++:$(CXX) $(CXXFLAGS):' \
100 -e 's:gcc:$(CC) $(CCFLAGS):' \
101 -e 's:ifort:$(FC) $(FCFLAGS):' \
102 tools/Makefile || die
103 }
104
105 src_compile() {
106 # Prepare compiler flags.
107 append-cxxflags -fPIC -I../../src
108 append-fflags -fPIC
109
110 # Compile stubs for serial version.
111 use mpi || lmp_emake -C src stubs
112
113 # Build packages
114 emake -C src yes-asphere
115 emake -C src yes-body
116 emake -C src yes-class2
117 emake -C src yes-colloid
118 emake -C src yes-dipole
119 emake -C src yes-fld
120 #emake -C src yes-gpu
121 emake -C src yes-granular
122 # Need OpenKIM external dependency.
123 #emake -C src yes-kim
124 # Need Kokkos external dependency.
125 #emake -C src yes-kokkos
126 emake -C src yes-kspace
127 emake -C src yes-manybody
128 emake -C src yes-mc
129 lmp_emake -C src yes-meam
130 lmp_emake -j1 -C lib/meam -f Makefile.gfortran
131 emake -C src yes-misc
132 emake -C src yes-molecule
133 #emake -C src yes-mpiio
134 emake -C src yes-opt
135 emake -C src yes-peri
136 emake -C src yes-poems
137 lmp_emake -C lib/poems -f Makefile.g++
138 emake -C src yes-reax
139 lmp_emake -j1 -C lib/reax -f Makefile.gfortran
140 emake -C src yes-replica
141 emake -C src yes-rigid
142 emake -C src yes-shock
143 emake -C src yes-snap
144 emake -C src yes-srd
145 emake -C src yes-voronoi
146 emake -C src yes-xtc
147
148 emake -C src yes-user-eff
149 emake -C src yes-user-fep
150 use mpi && emake -C src yes-user-lb
151 emake -C src yes-user-phonon
152 emake -C src yes-user-sph
153
154 if use mpi; then
155 emake -C src yes-user-atc
156 lmp_emake -C lib/atc -f Makefile.g++
157 fi
158
159 if use static-libs; then
160 # Build static library.
161 lmp_emake -C src makelib
162 lmp_emake -C src -f Makefile.lib serial
163 fi
164
165 # Build shared library.
166 lmp_emake -C src makeshlib
167 lmp_emake -C src -f Makefile.shlib serial
168
169 # Compile main executable.
170 lmp_emake -C src serial
171
172 # Compile tools.
173 emake -C tools binary2txt chain micelle2d data2xmovie
174 }
175
176 src_install() {
177 use static-libs && newlib.a src/liblammps_serial.a liblammps.a
178 newlib.so src/liblammps_serial.so liblammps.so.0.0.0
179 dosym liblammps.so.0.0.0 /usr/$(get_libdir)/liblammps.so
180 dosym liblammps.so.0.0.0 /usr/$(get_libdir)/liblammps.so.0
181 newbin src/lmp_serial lmp
182 dobin tools/binary2txt
183 # Don't forget to add header files of optional packages as they are added
184 # to this ebuild. There may also be .mod files from Fortran based
185 # packages.
186 insinto "/usr/include/${PN}"
187 doins -r src/*.h lib/meam/*.mod
188
189 local LAMMPS_POTENTIALS="usr/share/${PN}/potentials"
190 insinto "/${LAMMPS_POTENTIALS}"
191 doins potentials/*
192 echo "LAMMPS_POTENTIALS=${EROOT}${LAMMPS_POTENTIALS}" > 99lammps
193 doenvd 99lammps
194
195 if use examples; then
196 local LAMMPS_EXAMPLES="/usr/share/${PN}/examples"
197 insinto "${LAMMPS_EXAMPLES}"
198 doins -r examples/*
199 fi
200
201 dodoc README
202 if use doc; then
203 dodoc doc/Manual.pdf
204 dohtml -r doc/*
205 fi
206 }

  ViewVC Help
Powered by ViewVC 1.1.20