Unverified Commit b4edd03f authored by jopejoe1's avatar jopejoe1 Committed by GitHub
Browse files

{python3packages.py,}meshlab: 2023.12 -> 2025.07 + use system dependencies ,...

{python3packages.py,}meshlab: 2023.12 -> 2025.07 + use system dependencies , and update dependencies (#445078)
parents 9b035a43 9c0cec04
Loading
Loading
Loading
Loading
+65 −68
Original line number Diff line number Diff line
{
  stdenv,
  lib,

  stdenv,
  fetchFromGitHub,
  libGLU,
  qtbase,
  qtscript,
  qtxmlpatterns,
  lib3ds,
  bzip2,
  muparser,
  eigen,
  glew,
  gmp,
  levmar,
  qhull,
  fetchpatch,

  # nativeBuildInputs
  cmake,
  cgal,
  boost,
  mpfr,
  xercesc,
  onetbb,
  embree,
  vcg,
  libigl,
  corto,
  openctm,
  structuresynth,
  wrapQtAppsHook,
  python3Packages,

  # propagatedBuildInputs
  meshlab,

  # buildInputs
  libsForQt5,
  llvmPackages,
  glew,
  vcg,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "pymeshlab";
  version = "2023.12";
  version = "2025.7";

  src = fetchFromGitHub {
    owner = "cnr-isti-vclab";
    repo = "pymeshlab";
    rev = "v${finalAttrs.version}";
    hash = "sha256-IOlRdXoUPOJt67g3HqsLchV5aL+JUEks2y1Sy+wpwsg=";
    fetchSubmodules = true;
    tag = "v${finalAttrs.version}";
    hash = "sha256-LCR2/AyX9uVX4xhZareUL6YlpUsCFiGDMBB5nFp+H6k=";
  };

  buildInputs = [
    libGLU
    qtbase
    qtscript
    qtxmlpatterns
    lib3ds
    bzip2
    muparser
    eigen
    glew
    gmp
    levmar
    qhull
    cgal
    boost
    mpfr
    xercesc
    onetbb
    embree
    vcg
    libigl
    corto
    structuresynth
    openctm
  patches = [
    # CMake: allow use of system-provided meshlab & pybind11
    # ref. https://github.com/cnr-isti-vclab/PyMeshLab/pull/445
    # merged upstream
    (fetchpatch {
      url = "https://github.com/cnr-isti-vclab/PyMeshLab/commit/b363caae4362746b3f9e9326fe7b72a2ec7824d9.patch";
      hash = "sha256-euKfOx/T0qdeMx79dpEalzmdWsr4nbDFJfKdksvULBw=";
    })
  ];

  nativeBuildInputs = [
    cmake
    wrapQtAppsHook
    python3Packages.pybind11
  ];

  nativeCheckInputs = [
    python3Packages.pythonImportsCheckHook
  ];

  propagatedBuildInputs = [
    meshlab
    python3Packages.numpy
  ];

  preConfigure = ''
    substituteInPlace src/meshlab/src/external/libigl.cmake \
      --replace-fail '$'{MESHLAB_EXTERNAL_DOWNLOAD_DIR}/libigl-2.4.0 ${libigl}
    substituteInPlace src/meshlab/src/external/nexus.cmake \
      --replace-fail '$'{NEXUS_DIR}/src/corto ${corto.src}
    substituteInPlace src/meshlab/src/external/levmar.cmake \
      --replace-fail '$'{LEVMAR_LINK} ${levmar.src} \
      --replace-warn "MD5 ''${LEVMAR_MD5}" ""
    substituteInPlace src/meshlab/src/external/ssynth.cmake \
      --replace-fail '$'{SSYNTH_LINK} ${structuresynth.src} \
      --replace-warn "MD5 ''${SSYNTH_MD5}" ""
  '';
  buildInputs = [
    glew
    libsForQt5.qtbase
    vcg
  ]
  ++ lib.optionals stdenv.cc.isClang [
    llvmPackages.openmp
  ];

  dontWrapQtApps = true;

  cmakeFlags = [
    "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}/${python3Packages.python.sitePackages}/pymeshlab"
    "-DVCGDIR=${vcg.src}"
  ];

  # Get io & filter plugins from meshlab, to avoild render, decorate & edit ones
  postInstall =
    let
      plugins =
        if stdenv.hostPlatform.isDarwin then
          "Applications/meshlab.app/Contents/PlugIns"
        else
          "lib/meshlab/plugins";
      pyPlugins = if stdenv.hostPlatform.isDarwin then "PlugIns" else "lib/plugins";
    in
    ''
      install -D -t $out/${python3Packages.python.sitePackages}/pymeshlab/${pyPlugins} \
        ${meshlab}/${plugins}/libio_* \
        ${meshlab}/${plugins}/libfilter_*
    '';

  postFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
    patchelf \
      --add-needed ${meshlab}/lib/meshlab/libmeshlab-common.so \
      $out/${python3Packages.python.sitePackages}/pymeshlab/pmeshlab.*.so
  '';

  pythonImportsCheck = [ "pymeshlab" ];

  meta = {
    description = "Open source mesh processing python library";
    homepage = "https://github.com/cnr-isti-vclab/PyMeshLab";
    license = lib.licenses.gpl3Only;
    maintainers = with lib.maintainers; [ nim65s ];
    platforms = with lib.platforms; linux;
    platforms = with lib.platforms; linux ++ darwin;
  };
})
+24 −8
Original line number Diff line number Diff line
@@ -2,26 +2,42 @@
  lib,
  stdenv,
  fetchFromGitHub,
  fetchpatch,
  cmake,
  nix-update-script,
}:

stdenv.mkDerivation {
stdenv.mkDerivation (finalAttrs: {
  pname = "corto";
  version = "0-unstable-2024-04-05";
  version = "2025.07";

  src = fetchFromGitHub {
    owner = "cnr-isti-vclab";
    repo = "corto";
    rev = "d880519c490c88a39d12c31a914b6a687a7019c3";
    hash = "sha256-0OUijrf+0ZNv3oYko2r8Kp9zgtg8b9RPL7DXHf15Ryc=";
    tag = "v${finalAttrs.version}";
    hash = "sha256-wfIZQdypBTfUZJgPE4DetSt1SUNSyZihmL1Uzapqh1o=";
  };

  patches = [
    # CMake: exports
    # ref. https://github.com/cnr-isti-vclab/corto/pull/47
    # merged upstream
    (fetchpatch {
      name = "cmake-exports.patch";
      url = "https://github.com/cnr-isti-vclab/corto/commit/169356e97b29587b278822118aef34ed742b6b37.patch";
      hash = "sha256-imJfQ8JEhCcSkkO35N7Z3NtGElCyVxENPMDMWfNqdW0=";
    })
  ];

  nativeBuildInputs = [ cmake ];

  meta = with lib; {
  updateScript = nix-update-script { };

  meta = {
    description = "Mesh compression library, designed for rendering and speed";
    homepage = "https://github.com/cnr-isti-vclab/corto";
    license = licenses.mit;
    maintainers = with maintainers; [ nim65s ];
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ nim65s ];
    mainProgram = "corto";
  };
}
})
+2 −2
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ stdenv.mkDerivation (finalAttrs: {

  installPhase = ''
    mkdir -p $out/include $out/lib
    cp lm.h $out/include
    cp levmar.h lm.h $out/include
    cp liblevmar.a $out/lib
  '';

@@ -34,7 +34,7 @@ stdenv.mkDerivation (finalAttrs: {
    description = "ANSI C implementations of Levenberg-Marquardt, usable also from C++";
    homepage = "https://www.ics.forth.gr/~lourakis/levmar/";
    license = lib.licenses.gpl2Plus;
    maintainers = [ ];
    maintainers = [ lib.maintainers.nim65s ];
    platforms = lib.platforms.all;
  };
})
+15 −5
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ stdenv.mkDerivation (finalAttrs: {
  ];

  cmakeFlags = [
    "-DCMAKE_INSTALL_INCLUDEDIR=include/lib3mf"
    "-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include/lib3mf"
    "-DUSE_INCLUDED_ZLIB=OFF"
    "-DUSE_INCLUDED_LIBZIP=OFF"
    "-DUSE_INCLUDED_GTEST=OFF"
@@ -95,9 +95,19 @@ stdenv.mkDerivation (finalAttrs: {

    # functions are no longer in openssl, remove them from test cleanup function
    substituteInPlace Tests/CPP_Bindings/Source/UnitTest_EncryptionUtils.cpp \
      --replace-warn "RAND_cleanup();" "" \
      --replace-warn "EVP_cleanup();" "" \
      --replace-warn "CRYPTO_cleanup_all_ex_data();" ""
      --replace-fail "RAND_cleanup();" "" \
      --replace-fail "EVP_cleanup();" "" \
      --replace-fail "CRYPTO_cleanup_all_ex_data();" ""

    # Fix CMake export
    # ref https://github.com/3MFConsortium/lib3mf/pull/434
    substituteInPlace cmake/lib3mfConfig.cmake \
      --replace-fail "$""{LIB3MF_ROOT_DIR}/include" "$""{LIB3MF_ROOT_DIR}/include/lib3mf" \
      --replace-fail "$""{LIB3MF_ROOT_DIR}/lib" "$out/lib"

    # Use absolute CMAKE_INSTALL_INCLUDEDIR
    substituteInPlace lib3mf.pc.in \
      --replace-fail "includedir=$""{prefix}/@CMAKE_INSTALL_INCLUDEDIR@" "includedir=@CMAKE_INSTALL_INCLUDEDIR@"
  '';

  doCheck = true;
@@ -109,7 +119,7 @@ stdenv.mkDerivation (finalAttrs: {
    description = "Reference implementation of the 3D Manufacturing Format file standard";
    homepage = "https://3mf.io/";
    license = licenses.bsd2;
    maintainers = [ ];
    maintainers = with maintainers; [ nim65s ];
    platforms = platforms.all;
  };
})
+1 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
  installPhase = ''
    mkdir -p $out/include
    cp -r include/igl $out/include
    rm -rf $out/include/igl/opengl
  '';

  meta = with lib; {
Loading