nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 libsForQt5,
6 libGLU,
7 lib3ds,
8 bzip2,
9 muparser,
10 eigen,
11 glew,
12 gmp,
13 levmar,
14 qhull,
15 cmake,
16 cgal,
17 boost,
18 mpfr,
19 xercesc,
20 tbb,
21 embree,
22 vcg,
23 libigl,
24 corto,
25 openctm,
26 structuresynth,
27}:
28
29let
30 tinygltf-src = fetchFromGitHub {
31 owner = "syoyo";
32 repo = "tinygltf";
33 rev = "v2.6.3";
34 hash = "sha256-IyezvHzgLRyc3z8HdNsQMqDEhP+Ytw0stFNak3C8lTo=";
35 };
36in
37stdenv.mkDerivation rec {
38 pname = "meshlab";
39 version = "2023.12";
40
41 src = fetchFromGitHub {
42 owner = "cnr-isti-vclab";
43 repo = "meshlab";
44 rev = "MeshLab-${version}";
45 sha256 = "sha256-AdUAWS741RQclYaSE3Tz1/I0YSinNAnfSaqef+Tib8Y=";
46 };
47
48 buildInputs = [
49 libGLU
50 libsForQt5.qtbase
51 libsForQt5.qtscript
52 libsForQt5.qtxmlpatterns
53 lib3ds
54 bzip2
55 muparser
56 eigen
57 glew
58 gmp
59 levmar
60 qhull
61 cgal
62 boost
63 mpfr
64 xercesc
65 tbb
66 embree
67 vcg
68 libigl
69 corto
70 openctm
71 structuresynth
72 ];
73
74 nativeBuildInputs = [
75 cmake
76 libsForQt5.wrapQtAppsHook
77 ];
78
79 preConfigure = ''
80 substituteAll ${./meshlab.desktop} resources/linux/meshlab.desktop
81 substituteInPlace src/external/tinygltf.cmake \
82 --replace-fail '$'{MESHLAB_EXTERNAL_DOWNLOAD_DIR}/tinygltf-2.6.3 ${tinygltf-src}
83 substituteInPlace src/external/libigl.cmake \
84 --replace-fail '$'{MESHLAB_EXTERNAL_DOWNLOAD_DIR}/libigl-2.4.0 ${libigl}
85 substituteInPlace src/external/nexus.cmake \
86 --replace-fail '$'{NEXUS_DIR}/src/corto ${corto.src}
87 substituteInPlace src/external/levmar.cmake \
88 --replace-fail '$'{LEVMAR_LINK} ${levmar.src} \
89 --replace-warn "MD5 ''${LEVMAR_MD5}" ""
90 substituteInPlace src/external/ssynth.cmake \
91 --replace-fail '$'{SSYNTH_LINK} ${structuresynth.src} \
92 --replace-warn "MD5 ''${SSYNTH_MD5}" ""
93 substituteInPlace src/common_gui/CMakeLists.txt \
94 --replace-warn "MESHLAB_LIB_INSTALL_DIR" "CMAKE_INSTALL_LIBDIR"
95 '';
96
97 cmakeFlags = [
98 "-DVCGDIR=${vcg.src}"
99 ];
100
101 postFixup = ''
102 patchelf --add-needed $out/lib/meshlab/libmeshlab-common.so $out/bin/.meshlab-wrapped
103 '';
104
105 # display a black screen on wayland, so force XWayland for now.
106 # Might be fixed when upstream will be ready for Qt6.
107 qtWrapperArgs = [
108 "--set QT_QPA_PLATFORM xcb"
109 ];
110
111 meta = {
112 description = "System for processing and editing 3D triangular meshes";
113 mainProgram = "meshlab";
114 homepage = "https://www.meshlab.net/";
115 license = lib.licenses.gpl3Only;
116 maintainers = [ ];
117 platforms = with lib.platforms; linux;
118 };
119}