about summary refs log tree commit diff
path: root/pkgs/applications/graphics/meshlab/default.nix
blob: bd5dea8014d6cdcecdb7b2480d2b3944f06110dc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{ fetchFromGitHub, libGLU, llvmPackages, qtbase, qtscript, qtxmlpatterns }:

let
  meshlabRev = "d596d7c086c51fbdfb56050f9c30b55dd0286d4c";
  vcglibRev = "6c3c940e34327322507c703889f9f1cfa73ab183";
  # ^ this should be the latest commit in the vcglib devel branch at the time of the meshlab revision

  stdenv = llvmPackages.stdenv; # only building with clang seems to be tested upstream
in stdenv.mkDerivation {
  name = "meshlab-20180627-beta";

  srcs =
    [
      (fetchFromGitHub {
        owner = "cnr-isti-vclab";
        repo = "meshlab";
        rev = meshlabRev;
        sha256 = "0xi7wiyy0yi545l5qvccbqahlcsf70mhx829gf7bq29640si4rax";
        name = "meshlab-${meshlabRev}";
      })
      (fetchFromGitHub {
        owner = "cnr-isti-vclab";
        repo = "vcglib";
        rev = vcglibRev;
        sha256 = "0jfgjvf21y9ncmyr7caipy3ardhig7hh9z8miy885c99b925hhwd";
        name = "vcglib-${vcglibRev}";
      })
    ];

  sourceRoot = "meshlab-${meshlabRev}";

  hardeningDisable = [ "format" ];
  enableParallelBuilding = true;

  patches = [ ./fix-20180627-beta.patch ];

  buildPhase = ''
    # MeshLab has ../vcglib hardcoded everywhere, so move the source dir
    mv ../vcglib-${vcglibRev} ../vcglib

    cd src
    export NIX_LDFLAGS="-rpath $out/opt/meshlab $NIX_LDFLAGS"
    export QMAKESPEC="linux-clang"

    pushd external
    qmake -recursive external.pro
    buildPhase
    popd
    qmake -recursive meshlab_full.pro
    buildPhase
  '';

  installPhase = ''
    mkdir -p $out/opt/meshlab $out/bin
    cp -Rv distrib/* $out/opt/meshlab
    ln -s $out/opt/meshlab/meshlab $out/bin/meshlab
    ln -s $out/opt/meshlab/meshlabserver $out/bin/meshlabserver
  '';

  buildInputs = [ libGLU llvmPackages.openmp qtbase qtscript qtxmlpatterns ];

  meta = {
    description = "A system for processing and editing 3D triangular meshes.";
    homepage = http://www.meshlab.net/;
    license = stdenv.lib.licenses.gpl3;
    maintainers = with stdenv.lib.maintainers; [viric];
    platforms = with stdenv.lib.platforms; linux;
  };
}