summary refs log tree commit diff
path: root/pkgs/misc/freestyle/default.nix
blob: ad165760f7af4a650b061de6810c57af935c59cb (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
args:
args.stdenv.mkDerivation {
  name = "freestyle-2.2.0";

  src = args.fetchurl {
    url = mirror://sourceforge/freestyle/freestyle.2.2.0-src.tar.bz2;
    sha256 = "1h4880fijmfy0x6dbl9hfri071rpj3lnwfzkxi1qyqhy7zyxy7ga";
 };

  buildInputs =(with args; [qt4 libpng lib3ds freeglut libXi libQGLViewer swig]);
  inherit (args) python freeglut libQGLViewer lib3ds; # if you want to use another adopt patch and Config.pri 

  buildPhase = ''
    export PYTHON_VERSION=2.5
    cd src/system && qmake -makefile PREFIX=\$out && cd ..
    cd rendering && qmake -makefile PREFIX=\$out && cd ..
    qmake -makefile PREFIX=\$out && make
    cd swig && make -f Makefile
    cd ../..

    hide=$out/nix-support/hide
    moddir=$out/share/freestyle
    mkdir -p $out/bin $moddir $hide
    cp -r style_modules $moddir
    cp build/lib/*.so* $hide
    cp build/Freestyle $hide
    cp -r build/linux-g++/debug/lib/python $hide/pylib
    cat > $out/bin/Freestyle << EOF
      #!/bin/sh
      echo use export PYTHONPATH to add your py files to the search path
      echo the style modules can be loded from directory $moddir
      echo starting Freestyle know - have fun
      echo -e "\n\n\n\n"
      export PYTHONPATH=$PYTHONPATH:$moddir/style_modules:$hide/pylib
      LD_LIBRARY_PATH=$hide
      $hide/Freestyle
    EOF
    chmod +x $out/bin/Freestyle
    '';

  patches = ./patch;

  installPhase = ":";

  meta = { 
      description = "Non-Photorealistic Line Drawing rendering from 3D scenes";
      homepage = http://freestyle.sourceforge.net;
      license = "GPL2";
  };
}