nixpkgs/pkgs/by-name/gm/gmsh/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

59 lines
1.6 KiB
Nix

{ lib, stdenv, fetchurl, cmake, blas, lapack, gfortran, gmm, fltk, libjpeg
, zlib, libGL, libGLU, xorg, opencascade-occt
, python ? null, enablePython ? false }:
assert (!blas.isILP64) && (!lapack.isILP64);
assert enablePython -> (python != null);
stdenv.mkDerivation rec {
pname = "gmsh";
version = "4.13.1";
src = fetchurl {
url = "https://gmsh.info/src/gmsh-${version}-source.tgz";
hash = "sha256-d5chRfQxcmAm1QWWpqRPs8HJXCElUhjWaVWAa4btvo0=";
};
buildInputs = [
blas lapack gmm fltk libjpeg zlib opencascade-occt
] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
libGL libGLU xorg.libXrender xorg.libXcursor xorg.libXfixes
xorg.libXext xorg.libXft xorg.libXinerama xorg.libX11 xorg.libSM
xorg.libICE
] ++ lib.optional enablePython python;
enableParallelBuilding = true;
patches = [
./fix-python.patch
];
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"
];
nativeBuildInputs = [ cmake gfortran ];
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
'';
doCheck = true;
meta = {
description = "Three-dimensional finite element mesh generator";
mainProgram = "gmsh";
homepage = "https://gmsh.info/";
license = lib.licenses.gpl2Plus;
};
}