summary refs log tree commit diff
path: root/pkgs/misc/freestyle
diff options
context:
space:
mode:
authorMarc Weber <marco-oweber@gmx.de>2008-06-08 03:56:32 +0000
committerMarc Weber <marco-oweber@gmx.de>2008-06-08 03:56:32 +0000
commit60a651413aa5f0ac741e71afffd94edb8916c67a (patch)
treea088e9a7261364aacfaec4a95ec4a0b59943faa7 /pkgs/misc/freestyle
parentff704a010208b6f0c2282ba7f5885a7c5cd2aca3 (diff)
downloadnixpkgs-60a651413aa5f0ac741e71afffd94edb8916c67a.tar
nixpkgs-60a651413aa5f0ac741e71afffd94edb8916c67a.tar.gz
nixpkgs-60a651413aa5f0ac741e71afffd94edb8916c67a.tar.bz2
nixpkgs-60a651413aa5f0ac741e71afffd94edb8916c67a.tar.lz
nixpkgs-60a651413aa5f0ac741e71afffd94edb8916c67a.tar.xz
nixpkgs-60a651413aa5f0ac741e71afffd94edb8916c67a.tar.zst
nixpkgs-60a651413aa5f0ac741e71afffd94edb8916c67a.zip
added freestyle (non photorealistic renderer) and dependencies libQGLViewer, lib3ds
svn path=/nixpkgs/trunk/; revision=12009
Diffstat (limited to 'pkgs/misc/freestyle')
-rw-r--r--pkgs/misc/freestyle/default.nix50
-rw-r--r--pkgs/misc/freestyle/patch182
2 files changed, 232 insertions, 0 deletions
diff --git a/pkgs/misc/freestyle/default.nix b/pkgs/misc/freestyle/default.nix
new file mode 100644
index 00000000000..ad165760f7a
--- /dev/null
+++ b/pkgs/misc/freestyle/default.nix
@@ -0,0 +1,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";
+  };
+}
diff --git a/pkgs/misc/freestyle/patch b/pkgs/misc/freestyle/patch
new file mode 100644
index 00000000000..733f50dbf10
--- /dev/null
+++ b/pkgs/misc/freestyle/patch
@@ -0,0 +1,182 @@
+diff -U3 -r a/src/Config.pri b/src/Config.pri
+--- a/src/Config.pri	2008-06-06 22:08:06.000000000 +0200
++++ b/src/Config.pri	2008-06-08 03:50:16.000000000 +0200
+@@ -80,11 +80,11 @@
+ win32:QMAKE_CXXFLAGS     *= /GR /GX
+ win32:QMAKE_CFLAGS       *= /GR /GX
+ irix-n32:QMAKE_CFLAGS    *= -LANG:std
+-irix-n32:QMAKE_CXXFLAGS  *= -LANG:std
+-linux-g++:QMAKE_CFLAGS   *= -Wno-deprecated
+-linux-g++:QMAKE_CXXFLAGS *= -Wno-deprecated
+-cygwin-g++:QMAKE_CFLAGS   *= -Wno-deprecated
+-cygwin-g++:QMAKE_CXXFLAGS *= -Wno-deprecated -mno-win32
++QMAKE_CXXFLAGS  *= -LANG:std
++QMAKE_CFLAGS   *= -Wno-deprecated -fPIC
++QMAKE_CXXFLAGS *= -Wno-deprecated -fPIC
++QMAKE_CFLAGS   *= -Wno-deprecated -fPIC
++QMAKE_CXXFLAGS *= -Wno-deprecated -fPIC
+ mac:QMAKE_CFLAGS         *= -Wno-deprecated
+ mac:QMAKE_CXXFLAGS       *= -Wno-deprecated
+ 
+diff -U3 -r a/src/geometry/Grid.h b/src/geometry/Grid.h
+--- a/src/geometry/Grid.h	2008-06-06 22:08:06.000000000 +0200
++++ b/src/geometry/Grid.h	2008-06-06 22:05:52.000000000 +0200
+@@ -321,7 +321,7 @@
+           for (OccludersSet::iterator it = occluders.begin();
+               it != occluders.end();
+               it++) {
+-                  if ((unsigned)(*it)->userdata2 != _timestamp) {
++                  if ((unsigned long)(*it)->userdata2 != _timestamp) {
+                       (*it)->userdata2 = (void*)_timestamp;
+                       visitor.examineOccluder(*it);
+                   }
+diff -U3 -r a/src/libconfig.pri b/src/libconfig.pri
+--- a/src/libconfig.pri	2008-06-06 22:08:06.000000000 +0200
++++ b/src/libconfig.pri	2008-06-07 22:23:44.000000000 +0200
+@@ -1,110 +1,32 @@
+ # This file should be viewed as a -*- mode: Makefile -*-
+ 
+-contains( CONFIG, 3ds1.20 ) {
+   message ("Using 3ds 1.2.0 module")
+-  linux-g++:INCLUDEPATH  *= $(HOME)/INCLUDE/LINUX
+-  linux-g++:LIBS         *= -L$(HOME)/LIB/LINUX -l3ds
+-  cygwin-g++:INCLUDEPATH  *= /usr/lib/lib3ds-1.2.0
+-  cygwin-g++:LIBS         *= -L/usr/lib/lib3ds-1.2.0/lib3ds -l3ds
+-  mac:INCLUDEPATH *= /usr/local/include
+-  mac:LIBS         *= -l3ds
+-  mac:QMAKE_LIBDIR *= /usr/local/lib
+-  win32:    INCLUDEPATH  *= C:\include\lib3ds\1.2.0
+-  win32:    QMAKE_LIBDIR *= C:\lib\lib3ds\1.2.0
+-  win32:debug:    LIBS         *= lib3ds-120sd.lib
+-  win32:release:    LIBS         *= lib3ds-120s.lib
+-}
+-
+-contains( CONFIG, 3ds1.30 ) {
+-  message ("Using 3ds 1.3.0 module")
+-  linux-g++:INCLUDEPATH  *= $(HOME)/INCLUDE/LINUX
+-  linux-g++:LIBS         *= -L$(HOME)/LIB/LINUX -l3ds
+-  cygwin-g++:INCLUDEPATH  *= /usr/lib/lib3ds-1.3.0
+-  cygwin-g++:LIBS         *= -L/usr/lib/lib3ds-1.3.0/lib3ds -l3ds
+-  mac:INCLUDEPATH *= /usr/local/include
+-  mac:LIBS         *= -l3ds
+-  mac:QMAKE_LIBDIR *= /usr/local/lib
+-  win32:    INCLUDEPATH  *= C:\include\lib3ds\1.3.0
+-  win32:    QMAKE_LIBDIR *= C:\lib\lib3ds\1.3.0
+-  win32:debug:    LIBS         *= lib3ds-1_3d.lib
+-  win32:release:    LIBS         *= lib3ds-1_3.lib
+-}
++  INCLUDEPATH  *= $(lib3ds)/include
++  LIBS         *= -L$(lib3ds)/lib -l3ds
+ 
+ contains( CONFIG, qglviewer ) {
+   message ("Using QGLViewer module")
+   CONFIG *= qt thread opengl glut
+-  linux-g++:INCLUDEPATH *= $(HOME)/INCLUDE
+-  linux-g++:LIBS        *= -L$(HOME)/LIB/LINUX -lQGLViewer
+-  cygwin-g++:LIBS        *= -lQGLViewer
+-  win32:    INCLUDEPATH  *= $(HOME)\INCLUDE
+-  win32:    QMAKE_LIBDIR *= $(HOME)\LIB
+-  win32:    LIBS        *= QGLViewer.lib
++  INCLUDEPATH *= $(mesa)/include
++  LIBS        *= -L$(mesa)/lib -lQGLViewer
++  LIBS        *= -lQGLViewer
+ }
+ 
+-contains( CONFIG, python2.3) {
+-  message ("Using python 2.3 module")
+-  linux-g++:INCLUDEPATH *= /usr/include/python2.3
+-  linux-g++:LIBS	*= -lpthread -lm -lutil	
+-  linux-g++:LIBS        *= -L/usr/local/lib/ -lpython2.3 -L$(HOME)/LIB/LINUX 
+-  win32:    INCLUDEPATH *= C:\python23\include
+-  win32:    QMAKE_LIBDIR *= C:\python23\libs
+-  win32:    LIBS        *= python23.lib
+-}
+-
+-contains( CONFIG, python2.4) {
+-  message ("Using python 2.4 module")
+-  linux-g++:INCLUDEPATH *= /usr/include/python2.4
+-  linux-g++:LIBS	*= -lpthread -lm -lutil	
+-  linux-g++:LIBS        *= -L/usr/local/lib/ -lpython2.4 -L$(HOME)/LIB/LINUX
+-  cygwin-g++:INCLUDEPATH *= /usr/include/python2.4
+-  cygwin-g++:LIBS	*= -lpthread -lm -lutil	
+-  cygwin-g++:LIBS        *= -L/usr/lib/python2.4/config -lpython2.4 
+-  win32:    INCLUDEPATH *= C:\python24\include
+-  win32:    QMAKE_LIBDIR *= C:\python24\libs
+-  win32:    LIBS        *= python24.lib
+-}
+-
+-contains( CONFIG, python2.5) {
+-  message ("Using python 2.5 module")
+-  linux-g++:INCLUDEPATH *= /usr/include/python2.5
+-  linux-g++:LIBS	*= -lpthread -lm -lutil	
+-  linux-g++:LIBS        *= -L/usr/local/lib/ -lpython2.5 -L$(HOME)/LIB/LINUX
+-  mac:	    INCLUDEPATH *= /usr/include/python2.5
+-  mac:      LIBS        *= -L/usr/lib/python2.5/config -lpython2.5
+-  cygwin-g++:INCLUDEPATH *= /usr/include/python2.5
+-  cygwin-g++:LIBS	*= -lpthread -lm -lutil	
+-  cygwin-g++:LIBS        *= -L/usr/lib/python2.5/config -lpython2.5 
+-  win32:    INCLUDEPATH *= C:\python25\include
+-  win32:    QMAKE_LIBDIR *= C:\python25\libs
+-  win32:    LIBS        *= python25.lib
+-}
++message ("Using python ${PYTHON_VERSION} module")
++INCLUDEPATH *= ${python}/include/python${PYTHON_VERSION}
++LIBS	*= -lpthread -lm -lutil	
++LIBS        *= -L${python}/lib -lpython${PYTHON_VERSION} -L$(HOME)/LIB/LINUX
+ 
+ 
+ contains( CONFIG, glut) {
+   message ("Using glut module")
+-  linux-g++:LIBS *= -lglut -lXi
+-  cygwin-g++:LIBS *= -lglut -lXi
+-  mac: LIBS *= -framework Glut
+-  win32:INCLUDEPATH *= C:\include
+-  win32: QMAKE_LIBDIR *= C:\lib\glut
+-  win32: LIBS *= glut32.lib
++  INCLUDEPATH *= ${freeglut}/include
++  LIBS *= -lglut -lXi -L{freeglut}/lib
+ }
+ 
+ contains( CONFIG, qglviewer2 ) {
+-  message ("Using QGLViewer module")
++  MESSAGE ("Using QGLViewer module")
+   CONFIG *= qt thread opengl glut
+-  linux-g++:INCLUDEPATH *= $(HOME)/INCLUDE
+-  linux-g++:LIBS        *= -L$(HOME)/LIB/LINUX -lQGLViewer
+-  mac: LIBS *= -lQGLViewer
+-  cygwin-g++:LIBS        *= -lQGLViewer2
+-  win32:    INCLUDEPATH  *= C:\include\QGLViewer\2.2.5
+-  win32{
+-    release{
+-      QMAKE_LIBDIR *= C:\lib\QGLViewer\release
+-    }
+-    debug{
+-      QMAKE_LIBDIR *= C:\lib\QGLViewer\debug
+-    }
+-  }
+-  win32:    LIBS        *= QGLViewer2.lib
++  INCLUDEPATH *= $(libQGLViewer)/include
++  LIBS        *= -L$(libQGLViewer)/lib -lQGLViewer
+ }
+diff -U3 -r a/src/swig/Makefile b/src/swig/Makefile
+--- a/src/swig/Makefile	2008-06-06 22:08:06.000000000 +0200
++++ b/src/swig/Makefile	2008-06-08 01:17:31.000000000 +0200
+@@ -19,14 +19,15 @@
+ LIBDIR    = ../../build/${PLATEFORM}/${BUILD}/lib/python
+ IPATH     = -I../geometry -I../image -I../scene_graph -I../stroke \
+             -I../system -I../view_map -I../winged_edge \
+-            -I/usr/include/python${PYTHON_VERSION_MAJ}.${PYTHON_VERSION_MIN}
++            -I${python}/include/python${PYTHON_VERSION}
+ # options to compile with static python : -lpthread -lm -lutil -shared -Xlinker -x -export-dynamic
+ #OPTI      = -lpthread -lm -lutil -shared -Xlinker -x -export-dynamic #-O3 -funroll-loops -fomit-frame-pointer -ffast-math -march=i686
+ DBUG      = #-ggdb #-pg
+ WARN	  = -w #-W -Wall #-pedantic -ansi
+ 
+-CFLAGS    = ${OPTI} ${DBUG} ${WARN} ${IPATH}
+-LDFLAGS   = ${OPTI} ${DBUG} ${WARN} ${LPATH}
++CFLAGS    = ${OPTI} ${DBUG} ${WARN} ${IPATH} -fPIC
++LDFLAGS   = ${OPTI} ${DBUG} ${WARN} ${LPATH} -L${python}/lib
++
+ 
+ SWIG_SRC  = Freestyle.i
+ PY_SRC    = ${SWIG_SRC:.i=.py}