Unverified Commit 3773b498 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

Merge pull request #299049 from nim65s/meshlab

 meshlab: 2022.02 -> 2023.12 
parents fca59efa fc7d8b34
Loading
Loading
Loading
Loading
+32 −26
Original line number Diff line number Diff line
@@ -15,21 +15,27 @@
, qhull
, cmake
, cgal
, boost179
, boost
, mpfr
, xercesc
, tbb
, embree
, vcg
, libigl
, corto
, openctm
, structuresynth
}:

mkDerivation rec {
  pname = "meshlab";
  version = "2022.02";
  version = "2023.12";

  src = fetchFromGitHub {
    owner = "cnr-isti-vclab";
    repo = "meshlab";
    rev = "MeshLab-${version}";
    sha256 = "sha256-jcc3PfsiIeYyipteZgzd0NwZgFFgR/mMBiaInzhOcDY=";
    fetchSubmodules = true; # for vcglib
    sha256 = "sha256-AdUAWS741RQclYaSE3Tz1/I0YSinNAnfSaqef+Tib8Y=";
  };

  buildInputs = [
@@ -46,38 +52,38 @@ mkDerivation rec {
    levmar
    qhull
    cgal
    boost179
    boost
    mpfr
    xercesc
    tbb
    embree
    vcg
    libigl
    corto
    openctm
    structuresynth
  ];

  nativeBuildInputs = [ cmake ];

  preConfigure = ''
    substituteAll ${./meshlab.desktop} scripts/Linux/resources/meshlab.desktop
    cmakeDir=$PWD/src
    mkdir ../build
    cd ../build
    substituteAll ${./meshlab.desktop} resources/linux/meshlab.desktop
    substituteInPlace src/external/libigl.cmake \
      --replace-fail '$'{MESHLAB_EXTERNAL_DOWNLOAD_DIR}/libigl-2.4.0 ${libigl}
    substituteInPlace src/external/nexus.cmake \
      --replace-fail '$'{NEXUS_DIR}/src/corto ${corto.src}
    substituteInPlace src/external/levmar.cmake \
      --replace-fail '$'{LEVMAR_LINK} ${levmar.src} \
      --replace-warn "MD5 ''${LEVMAR_MD5}" ""
    substituteInPlace src/external/ssynth.cmake \
      --replace-fail '$'{SSYNTH_LINK} ${structuresynth.src} \
      --replace-warn "MD5 ''${SSYNTH_MD5}" ""
    substituteInPlace src/common_gui/CMakeLists.txt \
      --replace-warn "MESHLAB_LIB_INSTALL_DIR" "CMAKE_INSTALL_LIBDIR"
  '';

  cmakeFlags = [
    "-DALLOW_BUNDLED_EIGEN=OFF"
    "-DALLOW_BUNDLED_GLEW=OFF"
    "-DALLOW_BUNDLED_LIB3DS=OFF"
    "-DALLOW_BUNDLED_MUPARSER=OFF"
    "-DALLOW_BUNDLED_QHULL=OFF"
    # disable when available in nixpkgs
    "-DALLOW_BUNDLED_OPENCTM=ON"
    "-DALLOW_BUNDLED_SSYNTH=ON"
    "-DALLOW_BUNDLED_BOOST=OFF"
    # some plugins are disabled unless these are on
    "-DALLOW_BUNDLED_NEWUOA=ON"
    "-DALLOW_BUNDLED_LEVMAR=ON"
  ];

  CXXFLAGS = [
    # GCC 13: error: 'int16_t' has not been declared in 'std'
    "-include cstdint"
    "-DVCGDIR=${vcg.src}"
  ];

  postFixup = ''
+107 −0
Original line number Diff line number Diff line
{ stdenv
, lib
, fetchFromGitHub
, libGLU
, qtbase
, qtscript
, qtxmlpatterns
, lib3ds
, bzip2
, muparser
, eigen
, glew
, gmp
, levmar
, qhull
, cmake
, cgal
, boost
, mpfr
, xercesc
, tbb
, embree
, vcg
, libigl
, corto
, openctm
, structuresynth
, wrapQtAppsHook
, python3Packages
}:

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

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

  buildInputs = [
    libGLU
    qtbase
    qtscript
    qtxmlpatterns
    lib3ds
    bzip2
    muparser
    eigen
    glew
    gmp
    levmar
    qhull
    cgal
    boost
    mpfr
    xercesc
    tbb
    embree
    vcg
    libigl
    corto
    structuresynth
    openctm
  ];

  nativeBuildInputs = [
    cmake
    wrapQtAppsHook
    python3Packages.pybind11
  ];

  propagatedBuildInputs = [
    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}" ""
    export cmakeFlags="cmakeFlags
      -DCMAKE_INSTALL_PREFIX=$out/${python3Packages.python.sitePackages}/pymeshlab
    "
  '';

  cmakeFlags = [
    "-DVCGDIR=${vcg.src}"
  ];

  meta = {
    description = "The 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;
  };
})
+27 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  cmake,
}:

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

  src = fetchFromGitHub {
    owner = "cnr-isti-vclab";
    repo = "corto";
    rev = "d880519c490c88a39d12c31a914b6a687a7019c3";
    hash = "sha256-0OUijrf+0ZNv3oYko2r8Kp9zgtg8b9RPL7DXHf15Ryc=";
  };

  nativeBuildInputs = [ cmake ];

  meta = with lib; {
    description = "Mesh compression library, designed for rendering and speed";
    homepage = "https://github.com/cnr-isti-vclab/corto";
    license = licenses.mit;
    maintainers = with maintainers; [ nim65s ];
  };
}
+31 −0
Original line number Diff line number Diff line
{
  lib,
  stdenvNoCC,
  fetchFromGitHub,
}:

stdenvNoCC.mkDerivation (finalAttrs: {
  pname = "libigl";
  version = "2.5.0";

  src = fetchFromGitHub {
    owner = "libigl";
    repo = "libigl";
    rev = "v${finalAttrs.version}";
    hash = "sha256-OpjkQGRiuc7kNlwgCeM4dcotTb5J+6LUn4IOe9bFbW4=";
  };

  # We could also properly use CMake, but we would have to heavily patch it
  # to avoid configure-time downloads of many things.
  installPhase = ''
    mkdir -p $out/include
    cp -r include/igl $out/include
  '';

  meta = with lib; {
    description = "Simple C++ geometry processing library";
    homepage = "https://github.com/libigl/libigl";
    license = licenses.mpl20;
    maintainers = with maintainers; [ nim65s ];
  };
})
+59 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchurl,
  pkg-config,
  freeglut,
  gtk2,
  libGLU,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "openctm";
  version = "1.0.3";

  src = fetchurl {
    url = "https://downloads.sourceforge.net/project/openctm/OpenCTM-${finalAttrs.version}/OpenCTM-${finalAttrs.version}-src.tar.bz2";
    hash = "sha256-So0mCNlzZPfuxWt8Y3xWuTCK6YKGs+kNu3QTyQ6UPx0=";
  };

  outputs = [
    "bin"
    "dev"
    "man"
    "out"
  ];

  nativeBuildInputs = [ pkg-config ];

  buildInputs = [
    freeglut
    gtk2
    libGLU
  ];

  postPatch = ''
    substituteInPlace tools/tinyxml/Makefile.linux \
      --replace-warn "-Wno-format" "-Wno-format -Wno-format-security"
    substituteInPlace tools/Makefile.linux \
      --replace-warn "-lglut" "-lglut -lGL -lGLU"
  '';

  makeFlags = [
    "BINDIR=$(bin)/bin/"
    "INCDIR=$(dev)/include/"
    "LIBDIR=$(out)/lib/"
    "MAN1DIR=$(man)/share/man//man1"
  ];

  makefile = if stdenv.isDarwin then "Makefile.macosx" else "Makefile.linux";

  preInstall = "mkdir -p $bin/bin $dev/include $out/lib $man/share/man/man1";

  meta = with lib; {
    description = "File format, software library and a tool set for compression of 3D triangle meshes";
    homepage = "https://sourceforge.net/projects/openctm/";
    license = licenses.zlib;
    maintainers = with maintainers; [ nim65s ];
  };
})
Loading