lammps: 16Feb16 -> patch_2Aug2018
Major changes and update to lammps build - using fetchFromGitHub to get source instead of lammps mirror - configurable lammps packages included and includes for compilation - cleaner build script - preserving the executable, shared library names, and include headers
This commit is contained in:
parent
b55c02e878
commit
9745611ed6
@ -1,25 +1,37 @@
|
|||||||
{ stdenv, writeText, fetchurl,
|
{ lib
|
||||||
libpng, fftw,
|
, bash
|
||||||
mpiSupport ? false, mpi ? null
|
, stdenv
|
||||||
|
, writeText
|
||||||
|
, fetchFromGitHub
|
||||||
|
, libpng
|
||||||
|
, gzip
|
||||||
|
, fftw
|
||||||
|
, openblas
|
||||||
|
, mpiSupport ? false, mpi ? null
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert mpiSupport -> mpi != null;
|
assert mpiSupport -> mpi != null;
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
# LAMMPS has weird versioning converted to ISO 8601 format
|
# LAMMPS has weird versioning converted to ISO 8601 format
|
||||||
version = "2016-02-16";
|
version = "patch_2Aug2018";
|
||||||
name = "lammps-${version}";
|
name = "lammps-${version}";
|
||||||
|
|
||||||
src = fetchurl {
|
lammps_packages = "asphere body class2 colloid compress coreshell dipole granular kspace manybody mc misc molecule opt peri qeq replica rigid shock snap srd user-reaxc";
|
||||||
url = "mirror://sourceforge/lammps/lammps-16Feb16.tar.gz";
|
lammps_includes = "-DLAMMPS_EXCEPTIONS -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64";
|
||||||
sha256 = "1yzfbkxma3xa1288rnn66h4w0smbmjkwq1fx1y60pjiw0prmk105";
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "lammps";
|
||||||
|
repo = "lammps";
|
||||||
|
rev = "${version}";
|
||||||
|
sha256 = "1ph9pr7s11wgmspmnhxa55bh1pq2cyl8iimfi62lbpbpl9pr1ilc";
|
||||||
};
|
};
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit mpi;
|
inherit mpi;
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [ fftw libpng ]
|
buildInputs = [ fftw libpng openblas gzip bash ]
|
||||||
++ (stdenv.lib.optionals mpiSupport [ mpi ]);
|
++ (stdenv.lib.optionals mpiSupport [ mpi ]);
|
||||||
|
|
||||||
# Must do manual build due to LAMMPS requiring a seperate build for
|
# Must do manual build due to LAMMPS requiring a seperate build for
|
||||||
@ -27,13 +39,19 @@ stdenv.mkDerivation rec {
|
|||||||
builder = writeText "builder.sh" ''
|
builder = writeText "builder.sh" ''
|
||||||
source $stdenv/setup
|
source $stdenv/setup
|
||||||
|
|
||||||
tar xzf $src
|
mkdir lammps
|
||||||
cd lammps-*/src
|
cp -r $src/lib $src/src lammps
|
||||||
make mode=exe ${if mpiSupport then "mpi" else "serial"} SHELL=$SHELL LMP_INC="-DLAMMPS_GZIP -DLAMMPS_PNG" FFT_PATH=-DFFT_FFTW3 FFT_LIB=-lfftw3 JPG_LIB=-lpng
|
chmod -R 755 lammps/src/
|
||||||
make mode=shlib ${if mpiSupport then "mpi" else "serial"} SHELL=$SHELL LMP_INC="-DLAMMPS_GZIP -DLAMMPS_PNG" FFT_PATH=-DFFT_FFTW3 FFT_LIB=-lfftw3 JPG_LIB=-lpng
|
cd lammps/src
|
||||||
|
for pack in ${lammps_packages}; do make "yes-$pack" SHELL=$SHELL; done
|
||||||
|
make mode=exe ${if mpiSupport then "mpi" else "serial"} SHELL=$SHELL LMP_INC="${lammps_includes}" FFT_PATH=-DFFT_FFTW3 FFT_LIB=-lfftw3 JPG_LIB=-lpng
|
||||||
|
make mode=shlib ${if mpiSupport then "mpi" else "serial"} SHELL=$SHELL LMP_INC="${lammps_includes}" FFT_PATH=-DFFT_FFTW3 FFT_LIB=-lfftw3 JPG_LIB=-lpng
|
||||||
|
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
cp -v lmp_* $out/bin/lammps
|
cp -v lmp_* $out/bin/
|
||||||
|
|
||||||
|
mkdir -p $out/include
|
||||||
|
cp -v *.h $out/include/
|
||||||
|
|
||||||
mkdir -p $out/lib
|
mkdir -p $out/lib
|
||||||
cp -v liblammps* $out/lib/
|
cp -v liblammps* $out/lib/
|
||||||
@ -51,5 +69,6 @@ stdenv.mkDerivation rec {
|
|||||||
homepage = http://lammps.sandia.gov;
|
homepage = http://lammps.sandia.gov;
|
||||||
license = stdenv.lib.licenses.gpl2;
|
license = stdenv.lib.licenses.gpl2;
|
||||||
platforms = stdenv.lib.platforms.linux;
|
platforms = stdenv.lib.platforms.linux;
|
||||||
|
maintainers = with lib.maintainers; [ costrouc ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user