Merge pull request #299049 from nim65s/meshlab

meshlab: 2022.02 -> 2023.12
This commit is contained in:
Sandro 2024-04-20 19:23:46 +02:00 committed by GitHub
commit 3773b498fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 335 additions and 39 deletions

View File

@ -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 = ''

View File

@ -0,0 +1,107 @@
{ 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;
};
})

View File

@ -0,0 +1,27 @@
{
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 ];
};
}

View File

@ -0,0 +1,31 @@
{
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 ];
};
})

View File

@ -0,0 +1,59 @@
{
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 ];
};
})

View File

@ -1,32 +1,24 @@
{ stdenv, lib, fetchFromGitHub, fetchpatch, cmake, pkg-config, ispc, tbb, glfw,
{ stdenv, lib, fetchFromGitHub, cmake, pkg-config, ispc, tbb, glfw,
openimageio, libjpeg, libpng, libpthreadstubs, libX11, glib }:
stdenv.mkDerivation rec {
pname = "embree";
version = "3.13.5";
version = "4.3.1";
src = fetchFromGitHub {
owner = "embree";
repo = "embree";
rev = "v${version}";
sha256 = "sha256-tfM4SGOFVBG0pQK9B/iN2xDaW3yjefnTtsoUad75m80=";
sha256 = "sha256-gQPlk0bDn04s2pncF22m/OpIbzF3NXKkRCZbmxfXEY4=";
};
patches = [
(fetchpatch {
name = "fixed-compilation-issues-for-arm-aarch64-processor-under-linux.patch";
url = "https://github.com/embree/embree/commit/82ca6b5ccb7abe0403a658a0e079926478f04cb1.patch";
hash = "sha256-l9S4PBk+yQUypQ22l05daD0ruouZKE4VHkGvzKxkH4o=";
})
];
postPatch = ''
# Fix duplicate /nix/store/.../nix/store/.../ paths
sed -i "s|SET(EMBREE_ROOT_DIR .*)|set(EMBREE_ROOT_DIR $out)|" \
common/cmake/embree-config.cmake
sed -i "s|$""{EMBREE_ROOT_DIR}/||" common/cmake/embree-config.cmake
substituteInPlace common/math/math.h --replace 'defined(__MACOSX__) && !defined(__INTEL_COMPILER)' 0
substituteInPlace common/math/math.h --replace 'defined(__WIN32__) || defined(__FreeBSD__)' 'defined(__WIN32__) || defined(__FreeBSD__) || defined(__MACOSX__)'
substituteInPlace common/math/emath.h --replace 'defined(__MACOSX__) && !defined(__INTEL_COMPILER)' 0
substituteInPlace common/math/emath.h --replace 'defined(__WIN32__) || defined(__FreeBSD__)' 'defined(__WIN32__) || defined(__FreeBSD__) || defined(__MACOSX__)'
'';
cmakeFlags = [

View File

@ -0,0 +1,61 @@
{
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
cmake,
qtbase,
wrapQtAppsHook,
libGL,
libGLU,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "structuresynth";
version = "1.5.1";
src = fetchFromGitHub {
owner = "alemuntoni";
repo = "structuresynth";
rev = finalAttrs.version;
hash = "sha256-uFz4WPwA586B/5p+DUJ/W8KzbHLBhLIwP6mySZJ1vPY=";
};
patches = [
# This PR in 2 commits allow packaging of this project as standalone.
# It was merged upstream, so those 2 patches can be removed on next release.
(fetchpatch {
name = "shared-lib.patch";
url = "https://github.com/alemuntoni/StructureSynth/pull/1/commits/fdb87c55a03c6a0faa4335de5d29f0fb547b6102.patch";
hash = "sha256-/66x8HGyNhGwoxsbV+QIRFYQNuFSHYXNYkJzAn4jyJI=";
})
(fetchpatch {
name = "install-project.patch";
url = "https://github.com/alemuntoni/StructureSynth/pull/1/commits/f96a90f6a4c60e9e0316edd20ea77674a2b764a7.patch";
hash = "sha256-cSZAL1N2/Gd0x+9UkTUQxqVlb2m2MM8AA1Zzlo6S35w=";
})
];
outputs = [
"dev"
"out"
];
buildInputs = [
libGL
libGLU
qtbase
];
nativeBuildInputs = [
cmake
wrapQtAppsHook
];
meta = with lib; {
description = "Generate 3D structures by specifying a design grammar";
homepage = "https://github.com/alemuntoni/StructureSynth";
license = licenses.lgpl21;
maintainers = with maintainers; [ nim65s ];
};
})

View File

@ -9,6 +9,7 @@
draco,
embree,
fetchFromGitHub,
fetchpatch,
flex,
git,
graphviz-nox,
@ -63,6 +64,14 @@ buildPythonPackage rec {
format = "other";
patches = [
(fetchpatch {
name = "port-to-embree-4.patch";
url = "https://github.com/PixarAnimationStudios/OpenUSD/pull/2266/commits/4b6c23d459c602fdac5e0ebc9b7722cbd5475e86.patch";
hash = "sha256-yjqdGAVqfEsOX1W/tG6c+GgQLYya5U9xgUe/sNIuDbw=";
})
];
cmakeFlags = [
"-DPXR_BUILD_ALEMBIC_PLUGIN=ON"
"-DPXR_BUILD_DRACO_PLUGIN=ON"

View File

@ -24706,6 +24706,8 @@ with pkgs;
streamlink = callPackage ../applications/video/streamlink { };
streamlink-twitch-gui-bin = callPackage ../applications/video/streamlink-twitch-gui/bin.nix { };
structuresynth = libsForQt5.callPackage ../development/libraries/structuresynth { };
sub-batch = callPackage ../applications/video/sub-batch { };
subdl = callPackage ../applications/video/subdl { };

View File

@ -9673,6 +9673,8 @@ self: super: with self; {
pypemicro = callPackage ../development/python-modules/pypemicro { };
pymeshlab = toPythonModule (pkgs.libsForQt5.callPackage ../applications/graphics/pymeshlab { });
pyprecice = callPackage ../development/python-modules/pyprecice { };
pyprobables = callPackage ../development/python-modules/pyprobables { };