From 60a651413aa5f0ac741e71afffd94edb8916c67a Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Sun, 8 Jun 2008 03:56:32 +0000 Subject: [PATCH] added freestyle (non photorealistic renderer) and dependencies libQGLViewer, lib3ds svn path=/nixpkgs/trunk/; revision=12009 --- pkgs/development/libraries/lib3ds/default.nix | 18 ++ .../libraries/libqglviewer/default.nix | 23 +++ pkgs/misc/freestyle/default.nix | 50 +++++ pkgs/misc/freestyle/patch | 182 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 19 +- 5 files changed, 291 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/libraries/lib3ds/default.nix create mode 100644 pkgs/development/libraries/libqglviewer/default.nix create mode 100644 pkgs/misc/freestyle/default.nix create mode 100644 pkgs/misc/freestyle/patch diff --git a/pkgs/development/libraries/lib3ds/default.nix b/pkgs/development/libraries/lib3ds/default.nix new file mode 100644 index 000000000000..ec7f4adf0316 --- /dev/null +++ b/pkgs/development/libraries/lib3ds/default.nix @@ -0,0 +1,18 @@ +args: +args.stdenv.mkDerivation { + name = "lib3ds"; + + src = args.fetchurl { + url = mirror://sourceforge/lib3ds/lib3ds-1.3.0.zip; + sha256 = "1qr9arfdkjf7q11xhvxwzmhxqz3nhcjkyb8zzfjpz9jm54q0rc7m"; + }; + + buildInputs =(with args; [unzip]); + + meta = { + description = "library for managing 3D-Studio Release 3 and 4 \".3DS\" files"; + homepage = http://lib3ds.sourceforge.net/; + license = "LGPL"; + }; +} + diff --git a/pkgs/development/libraries/libqglviewer/default.nix b/pkgs/development/libraries/libqglviewer/default.nix new file mode 100644 index 000000000000..6b9d70fb6be2 --- /dev/null +++ b/pkgs/development/libraries/libqglviewer/default.nix @@ -0,0 +1,23 @@ +args: +args.stdenv.mkDerivation { + name = "libQGLviewer"; + + src = args.fetchurl { + url = http://artis.imag.fr/Members/Gilles.Debunne/QGLViewer/src/libQGLViewer-2.2.6-3.tar.gz; + sha256 = "05vjl7af87dhzrdigm941by9c137g8wyca46h3pvhnmr4pgb0ic9"; + }; + + buildInputs =(with args; [qt4]); + + buildPhase = " + cd QGLViewer + qmake PREFIX=\$out + make + "; + + meta = { + description = "trackball-based 3D viewer qt widget including many useful features"; + homepage = http://artis.imag.fr/Members/Gilles.Debunne/QGLViewer/installUnix.html; + license = "GPL2"; + }; +} diff --git a/pkgs/misc/freestyle/default.nix b/pkgs/misc/freestyle/default.nix new file mode 100644 index 000000000000..ad165760f7af --- /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 000000000000..733f50dbf10e --- /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} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0876ece56eca..cffe12b5e173 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2757,6 +2757,10 @@ let pkgs = rec { inherit (xlibs) libXp libXau; }; + lib3ds = import ../development/libraries/lib3ds { + inherit fetchurl stdenv unzip; + }; + libaal = import ../development/libraries/libaal { inherit fetchurl stdenv; }; @@ -2867,6 +2871,11 @@ let pkgs = rec { inherit fetchurl stdenv pkgconfig libusb libtool libexif libjpeg gettext; }; + libQGLViewer = import ../development/libraries/libqglviewer { + inherit fetchurl stdenv; + inherit qt4; + }; + libsamplerate = import ../development/libraries/libsamplerate { inherit fetchurl stdenv mkDerivationByConfiguration pkgconfig lib; }; @@ -6867,7 +6876,15 @@ let pkgs = rec { dpkg = import ../tools/package-management/dpkg { inherit fetchurl stdenv perl zlib bzip2; }; - + + freestyle = import ../misc/freestyle { + inherit fetchurl freeglut qt4 libpng lib3ds libQGLViewer swig; + inherit (xlibs) libXi; + #stdenv = overrideGCC stdenv gcc41; + inherit stdenv; + python = python25; + }; + generator = import ../misc/emulators/generator { inherit fetchurl stdenv SDL nasm zlib bzip2 libjpeg; inherit (gtkLibs1x) gtk;