From c1601a2afa8b504a7e5ec693f8d54eba59f2d613 Mon Sep 17 00:00:00 2001 From: qbisi Date: Fri, 26 Sep 2025 19:16:15 +0800 Subject: [PATCH] scotch: install *metis.h to subdirectory SCOTCH has compatibility headers/libraries for the MeTiS/ParMeTiS interface. However, the header files "metis.h" and "parmetis.h" might cause conflict with exsiting metis/parmetis packages. Hence move them to subdirectory. --- pkgs/by-name/mu/mumps/package.nix | 18 ++++++++---------- pkgs/by-name/sc/scotch/package.nix | 12 ++++++++++++ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/pkgs/by-name/mu/mumps/package.nix b/pkgs/by-name/mu/mumps/package.nix index f490a3ffcd01..d536e153cd37 100644 --- a/pkgs/by-name/mu/mumps/package.nix +++ b/pkgs/by-name/mu/mumps/package.nix @@ -108,16 +108,14 @@ stdenv.mkDerivation (finalAttrs: { ++ lib.optional mpiSupport mpi ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames; - # Parmetis should be placed before scotch to avoid conflict of header file "parmetis.h" - buildInputs = - lib.optional withParmetis parmetis - ++ lib.optional mpiSupport scalapack - ++ [ - blas - lapack - metis - scotch' - ]; + buildInputs = [ + blas + lapack + metis + scotch' + ] + ++ lib.optional mpiSupport scalapack + ++ lib.optional withParmetis parmetis; doInstallCheck = true; diff --git a/pkgs/by-name/sc/scotch/package.nix b/pkgs/by-name/sc/scotch/package.nix index 5e586bab1b66..9fafe1d1da77 100644 --- a/pkgs/by-name/sc/scotch/package.nix +++ b/pkgs/by-name/sc/scotch/package.nix @@ -35,6 +35,10 @@ stdenv.mkDerivation (finalAttrs: { cmakeFlags = [ (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic)) (lib.cmakeBool "BUILD_PTSCOTCH" withPtScotch) + # Prefix Scotch version of MeTiS routines + (lib.cmakeBool "SCOTCH_METIS_PREFIX" true) + # building tests is broken with SCOTCH_METIS_PREFIX enabled in 7.0.9 + (lib.cmakeBool "ENABLE_TESTS" false) ]; nativeBuildInputs = [ @@ -63,6 +67,14 @@ stdenv.mkDerivation (finalAttrs: { }; }; + # SCOTCH provide compatibility with Metis/Parmetis interface. + # We install the metis compatible headers to subdirectory to + # avoid conflict with metis/parmetis. + postFixup = '' + mkdir -p $dev/include/scotch + mv $dev/include/{*metis,metisf}.h $dev/include/scotch + ''; + meta = { description = "Graph and mesh/hypergraph partitioning, graph clustering, and sparse matrix ordering"; longDescription = ''