2021-01-15 13:21:58 +00:00
|
|
|
{ lib, stdenv, fetchurl, cmake, blas, lapack, gfortran, gmm, fltk, libjpeg
|
2023-01-06 20:11:47 +00:00
|
|
|
, zlib, libGL, libGLU, xorg, opencascade-occt
|
|
|
|
, python ? null, enablePython ? false }:
|
2016-06-09 16:51:21 +00:00
|
|
|
|
2020-04-20 20:50:55 +00:00
|
|
|
assert (!blas.isILP64) && (!lapack.isILP64);
|
2023-01-06 20:11:47 +00:00
|
|
|
assert enablePython -> (python != null);
|
2020-03-31 14:47:18 +00:00
|
|
|
|
2019-08-14 16:42:40 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "gmsh";
|
2022-12-30 14:18:27 +00:00
|
|
|
version = "4.11.1";
|
2016-06-09 16:51:21 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2022-01-08 00:18:15 +00:00
|
|
|
url = "https://gmsh.info/src/gmsh-${version}-source.tgz";
|
2022-12-30 14:18:27 +00:00
|
|
|
sha256 = "sha256-xf4bfL1AOIioFJKfL9D11p4nYAIioYx4bbW3boAFs2U=";
|
2016-06-09 16:51:21 +00:00
|
|
|
};
|
|
|
|
|
2022-02-12 16:13:53 +00:00
|
|
|
buildInputs = [
|
|
|
|
blas lapack gmm fltk libjpeg zlib opencascade-occt
|
|
|
|
] ++ lib.optionals (!stdenv.isDarwin) [
|
|
|
|
libGL libGLU xorg.libXrender xorg.libXcursor xorg.libXfixes
|
|
|
|
xorg.libXext xorg.libXft xorg.libXinerama xorg.libX11 xorg.libSM
|
|
|
|
xorg.libICE
|
2023-01-06 20:11:47 +00:00
|
|
|
] ++ lib.optional enablePython python;
|
2016-06-09 16:51:21 +00:00
|
|
|
|
2023-01-06 20:12:02 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2023-01-06 20:11:47 +00:00
|
|
|
patches = [ ./fix-python.patch ];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace api/gmsh.py --subst-var-by LIBPATH ${placeholder "out"}/lib/libgmsh.so
|
|
|
|
'';
|
|
|
|
|
2022-12-30 14:16:19 +00:00
|
|
|
# N.B. the shared object is used by bindings
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DENABLE_BUILD_SHARED=ON"
|
|
|
|
"-DENABLE_BUILD_DYNAMIC=ON"
|
2023-01-04 16:24:04 +00:00
|
|
|
"-DENABLE_OPENMP=ON"
|
2022-12-30 14:16:19 +00:00
|
|
|
];
|
|
|
|
|
2019-06-07 16:01:57 +00:00
|
|
|
nativeBuildInputs = [ cmake gfortran ];
|
2018-05-23 15:32:43 +00:00
|
|
|
|
2023-01-06 20:11:47 +00:00
|
|
|
postFixup = lib.optionalString enablePython ''
|
|
|
|
mkdir -p $out/lib/python${python.pythonVersion}/site-packages
|
|
|
|
mv $out/lib/gmsh.py $out/lib/python${python.pythonVersion}/site-packages
|
|
|
|
mv $out/lib/*.dist-info $out/lib/python${python.pythonVersion}/site-packages
|
|
|
|
'';
|
|
|
|
|
2022-02-12 16:15:57 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
2016-06-09 16:51:21 +00:00
|
|
|
meta = {
|
|
|
|
description = "A three-dimensional finite element mesh generator";
|
2022-01-08 00:18:15 +00:00
|
|
|
homepage = "https://gmsh.info/";
|
2021-01-15 13:21:58 +00:00
|
|
|
license = lib.licenses.gpl2Plus;
|
2016-06-09 16:51:21 +00:00
|
|
|
};
|
|
|
|
}
|