2024-04-21 15:54:59 +00:00
|
|
|
{ lib, stdenv, fetchurl, cmake, blas, lapack, gfortran, gmm, fltk, libjpeg
|
2023-01-11 07:51:40 +00:00
|
|
|
, zlib, libGL, libGLU, xorg, opencascade-occt
|
|
|
|
, python ? null, enablePython ? false }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
assert (!blas.isILP64) && (!lapack.isILP64);
|
2023-01-11 07:51:40 +00:00
|
|
|
assert enablePython -> (python != null);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "gmsh";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "4.12.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2022-01-13 20:06:32 +00:00
|
|
|
url = "https://gmsh.info/src/gmsh-${version}-source.tgz";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-E+CdnKgQLlxAFx1u4VDGaHQrmMOmylf4N/e2Th4q9I8=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-02-20 05:27:41 +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-11 07:51:40 +00:00
|
|
|
] ++ lib.optional enablePython python;
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
patches = [
|
|
|
|
./fix-python.patch
|
|
|
|
];
|
2023-01-11 07:51:40 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace api/gmsh.py --subst-var-by LIBPATH ${placeholder "out"}/lib/libgmsh.so
|
|
|
|
'';
|
|
|
|
|
|
|
|
# N.B. the shared object is used by bindings
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DENABLE_BUILD_SHARED=ON"
|
|
|
|
"-DENABLE_BUILD_DYNAMIC=ON"
|
|
|
|
"-DENABLE_OPENMP=ON"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake gfortran ];
|
|
|
|
|
2023-01-11 07:51:40 +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-20 05:27:41 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
|
|
|
description = "A three-dimensional finite element mesh generator";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "gmsh";
|
2022-01-13 20:06:32 +00:00
|
|
|
homepage = "https://gmsh.info/";
|
2021-01-17 00:15:33 +00:00
|
|
|
license = lib.licenses.gpl2Plus;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|