1{ stdenv, fetchurl, qt4, libpng, lib3ds, freeglut, libXi, libqglviewer
2, swig, python }:
3
4stdenv.mkDerivation {
5 name = "freestyle-2.2.0";
6
7 src = fetchurl {
8 url = mirror://sourceforge/freestyle/freestyle.2.2.0-src.tar.bz2;
9 sha256 = "1h4880fijmfy0x6dbl9hfri071rpj3lnwfzkxi1qyqhy7zyxy7ga";
10 };
11
12 buildInputs = [ qt4 libpng lib3ds freeglut libXi libqglviewer swig ];
13
14 inherit python freeglut libqglviewer lib3ds; # if you want to use another adopt patch and Config.pri
15
16 buildPhase = ''
17 export PYTHON_VERSION=2.5
18 cd src/system && qmake -makefile PREFIX=\$out && cd ..
19 cd rendering && qmake -makefile PREFIX=\$out && cd ..
20 qmake -makefile PREFIX=\$out && make
21 cd swig && make -f Makefile
22 cd ../..
23
24 hide=$out/nix-support/hide
25 moddir=$out/share/freestyle
26 mkdir -p $out/bin $moddir $hide
27 cp -r style_modules $moddir
28 cp build/lib/*.so* $hide
29 cp build/Freestyle $hide
30 cp -r build/linux-g++/debug/lib/python $hide/pylib
31 cat > $out/bin/Freestyle << EOF
32 #!/bin/sh
33 echo use export PYTHONPATH to add your py files to the search path
34 echo the style modules can be loded from directory $moddir
35 echo starting Freestyle know - have fun
36 echo -e "\n\n\n\n"
37 export PYTHONPATH=$PYTHONPATH:$moddir/style_modules:$hide/pylib
38 LD_LIBRARY_PATH=$hide
39 $hide/Freestyle
40 EOF
41 chmod +x $out/bin/Freestyle
42 '';
43
44 patches = ./patch;
45
46 installPhase = ":";
47
48 meta = {
49 description = "Non-Photorealistic Line Drawing rendering from 3D scenes";
50 homepage = http://freestyle.sourceforge.net;
51 license = stdenv.lib.licenses.gpl2;
52 };
53}