Unverified Commit 5d5fddc0 authored by Nick Cao's avatar Nick Cao Committed by GitHub
Browse files

gmsh: 3.13.1 -> 3.14.0 (#426043)

parents 496d7958 2de67f8b
Loading
Loading
Loading
Loading
+50 −33
Original line number Diff line number Diff line
@@ -2,7 +2,8 @@
  lib,
  stdenv,
  fetchurl,
  fetchpatch,
  makeDesktopItem,
  copyDesktopItems,
  cmake,
  blas,
  lapack,
@@ -16,22 +17,30 @@
  xorg,
  opencascade-occt,
  llvmPackages,
  python ? null,
  python3Packages,
  enablePython ? false,
}:

assert (!blas.isILP64) && (!lapack.isILP64);
assert enablePython -> (python != null);

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "gmsh";
  version = "4.13.1";
  version = "4.14.0";

  src = fetchurl {
    url = "https://gmsh.info/src/gmsh-${version}-source.tgz";
    hash = "sha256-d5chRfQxcmAm1QWWpqRPs8HJXCElUhjWaVWAa4btvo0=";
    url = "https://gmsh.info/src/gmsh-${finalAttrs.version}-source.tgz";
    hash = "sha256-2019ogYumkNWqCCDITirmfl69jiL/rIVmaLq37C3aig=";
  };

  nativeBuildInputs = [
    cmake
    gfortran
  ]
  ++ lib.optional (
    enablePython && stdenv.buildPlatform == stdenv.hostPlatform
  ) python3Packages.pythonImportsCheckHook
  ++ lib.optional stdenv.hostPlatform.isLinux copyDesktopItems;

  buildInputs = [
    blas
    lapack
@@ -54,22 +63,7 @@ stdenv.mkDerivation rec {
    xorg.libSM
    xorg.libICE
  ]
  ++ lib.optional stdenv.cc.isClang llvmPackages.openmp
  ++ lib.optional enablePython python;

  enableParallelBuilding = true;

  patches = [
    (fetchpatch {
      url = "https://gitlab.onelab.info/gmsh/gmsh/-/commit/7d5094fb0a5245cb435afd3f3e8c35e2ecfe70fd.patch";
      hash = "sha256-3atm1NGsMI4KEct2xakRG6EasRpF6YRI4raoVYxBV4g=";
    })
  ];

  postPatch = ''
    substituteInPlace api/gmsh.py \
      --replace-fail 'find_library("gmsh")' \"$out/lib/libgmsh${stdenv.hostPlatform.extensions.sharedLibrary}\"
  '';
  ++ lib.optional stdenv.cc.isClang llvmPackages.openmp;

  # N.B. the shared object is used by bindings
  cmakeFlags = [
@@ -78,23 +72,46 @@ stdenv.mkDerivation rec {
    "-DENABLE_OPENMP=ON"
  ];

  nativeBuildInputs = [
    cmake
    gfortran
  doCheck = true;

  desktopItems = [
    (makeDesktopItem {
      name = "gmsh";
      exec = "gmsh";
      comment = finalAttrs.meta.description;
      desktopName = "Gmsh";
      genericName = "3D Mesh Generator";
      categories = [
        "Science"
        "Math"
      ];
      icon = "gmsh";
    })
  ];

  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
  postInstall =
    let
      logo = fetchurl {
        url = "https://salsa.debian.org/science-team/gmsh/-/raw/d2d8b4e3488c7b0f51879f809f624b537b4bd28f/debian/gmsh.svg";
        hash = "sha256-p69Cju3bn1ShWmESOSOmJj0x3IYDGI9oD25SFTh2GLo=";
      };
    in
    lib.optionalString stdenv.hostPlatform.isLinux ''
      install -Dm644 ${logo} $out/share/icons/hicolor/scalable/apps/gmsh.svg
    ''
    + lib.optionalString enablePython ''
      mkdir -p $out/${python3Packages.python.sitePackages}
      mv $out/lib/gmsh.py $out/${python3Packages.python.sitePackages}
      mv $out/lib/*.dist-info $out/${python3Packages.python.sitePackages}
    '';

  doCheck = true;
  pythonImportsCheck = [ "gmsh" ];

  meta = {
    description = "Three-dimensional finite element mesh generator";
    mainProgram = "gmsh";
    homepage = "https://gmsh.info/";
    changelog = "https://gitlab.onelab.info/gmsh/gmsh/-/releases/gmsh_${lib.concatStringsSep "_" (lib.versions.splitVersion finalAttrs.version)}#changelog";
    license = lib.licenses.gpl2Plus;
  };
}
})
+1 −1
Original line number Diff line number Diff line
@@ -5897,7 +5897,7 @@ self: super: with self; {
  gmsh = toPythonModule (
    pkgs.gmsh.override {
      inherit (self) python;
      python3Packages = self;
      enablePython = true;
    }
  );