From 7a5080241174cd241809b1091af6e2b589ff2440 Mon Sep 17 00:00:00 2001 From: qbisi Date: Thu, 1 May 2025 00:02:10 +0800 Subject: [PATCH] libsupermesh: init at 2025.3.0 --- pkgs/by-name/li/libsupermesh/package.nix | 77 +++++++++++++++++++ .../python-modules/libsupermesh/default.nix | 48 ++++++++++++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 127 insertions(+) create mode 100644 pkgs/by-name/li/libsupermesh/package.nix create mode 100644 pkgs/development/python-modules/libsupermesh/default.nix diff --git a/pkgs/by-name/li/libsupermesh/package.nix b/pkgs/by-name/li/libsupermesh/package.nix new file mode 100644 index 000000000000..ea15c72ccf21 --- /dev/null +++ b/pkgs/by-name/li/libsupermesh/package.nix @@ -0,0 +1,77 @@ +{ + lib, + stdenv, + fetchFromGitHub, + validatePkgConfig, + gfortran, + mpi, + cmake, + ninja, + libspatialindex, + mpiCheckPhaseHook, + testers, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "libsupermesh"; + version = "2025.3.0"; + + src = fetchFromGitHub { + owner = "firedrakeproject"; + repo = "libsupermesh"; + tag = "v${finalAttrs.version}"; + hash = "sha256-RKBi89bUhkbRATaSB8629D+/NeYE3YNDIMEGzSK8z04="; + }; + + strictDeps = true; + + outputs = [ + "out" + "dev" + ]; + + nativeBuildInputs = [ + mpi + gfortran + cmake + ninja + validatePkgConfig + ]; + + cmakeFlags = [ + (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic)) + ]; + + buildInputs = [ + libspatialindex + gfortran.cc.lib + ]; + + __darwinAllowLocalNetworking = true; + + nativeCheckInputs = [ mpiCheckPhaseHook ]; + + # On aarch64-darwin platform, the test program segfault at the line + # https://github.com/firedrakeproject/libsupermesh/blob/09af7c9a3beefc715fbdc23e46fdc96da8169ff6/src/tests/test_parallel_p1_inner_product_2d.F90#L164 + # in defining the lambda subroutine pack_data_b with variable field_b. + # This error is test source and compiler related and does not indicate broken functionality of libsupermesh. + doCheck = !(stdenv.hostPlatform.system == "aarch64-darwin"); + + passthru = { + tests = { + pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + }; + }; + }; + + meta = { + homepage = "https://github.com/firedrakeproject/libsupermesh"; + description = "Parallel supermeshing library"; + changelog = "https://github.com/firedrakeproject/libsupermesh/releases/tag/v${finalAttrs.version}"; + license = lib.licenses.lgpl2Plus; + platforms = lib.platforms.unix; + maintainers = with lib.maintainers; [ qbisi ]; + pkgConfigModules = [ "libsupermesh" ]; + }; +}) diff --git a/pkgs/development/python-modules/libsupermesh/default.nix b/pkgs/development/python-modules/libsupermesh/default.nix new file mode 100644 index 000000000000..bed0e1607932 --- /dev/null +++ b/pkgs/development/python-modules/libsupermesh/default.nix @@ -0,0 +1,48 @@ +{ + lib, + pkgs, + buildPythonPackage, + fetchFromGitHub, + scikit-build-core, + gfortran, + cmake, + ninja, + mpi, + libspatialindex, + rtree, +}: + +buildPythonPackage rec { + inherit (pkgs.libsupermesh) + pname + version + src + meta + ; + pyproject = true; + + build-system = [ + scikit-build-core + ]; + + nativeBuildInputs = [ + gfortran + cmake + ninja + mpi + ]; + + dontUseCmakeConfigure = true; + + buildInputs = [ + libspatialindex + gfortran.cc.lib + ]; + + dependencies = [ + rtree + ]; + + # Only build tests if not built by scikit-build-core + doCheck = false; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 1613dfd9e0b5..c64b96ca9116 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7912,6 +7912,8 @@ self: super: with self; { libsoundtouch = callPackage ../development/python-modules/libsoundtouch { }; + libsupermesh = callPackage ../development/python-modules/libsupermesh { }; + libthumbor = callPackage ../development/python-modules/libthumbor { }; libtmux = callPackage ../development/python-modules/libtmux { };