--- netgen-4.4.orig/Makefile
+++ netgen-4.4/Makefile
@@ -21,7 +21,7 @@
 # system libraries:
 #
 #
-tcltklib = -ltix8.1.8.4 -ltk8.4  -ltcl8.4
+tcltklib = -lTix8.4 -ltk8.4  -ltcl8.4
 # tcltklib = -ltix4.1.8.3 -ltk8.3 -ltcl8.3
 # tcltklib = -ltix8.2 -ltk8.3 -ltcl8.3
 # tcltklib = /usr/lib/libtix8.1.8.3.so -ltk8.3 -ltcl8.3
@@ -29,7 +29,7 @@
 # tcltklib = -ltix8.2 -ltk8.4 -ltcl8.4
 #
 #
-syslib = $(tcltklib) -lGL -lGLU -lX11  -lXi -lm  -ldl -lpthread $(SYSLIB2)
+syslib = $(tcltklib) -lGL -lGLU -lX11 -lm  -ldl -lpthread $(SYSLIB2)
 # (maybe you have to remove -ldl)
 #
 #
@@ -48,7 +48,10 @@
 OCCLIB_DIR=$(OCC_DIR)/ros/lin/lib
 
 # add libs in makefile.mach.$(MACHINE)
+ifdef WITH_OCC
 # occlib = -L$(OCCLIB_DIR) -lTKIGES -lTKBRep -lTKSTEP -lTKSTL
+occlib = -L$(OCCLIB_DIR) -lTKIGES -lTKBRep -lTKSTEP -lTKSTL -lTKTopAlgo -lTKG3d -lTKG2d -lTKXSBase -lTKOffset -lTKFillet -lTKGeomBase -lTKGeomAlgo -lTKShHealing -lTKBO -lTKPrim -lTKernel -lTKMath -lTKBool -lXxf86vm
+endif
 #
 include $(LIBSRC_DIR)/makefile.mach.$(MACHINE)
 #
@@ -117,7 +120,7 @@
 #
 .PHONY : clean
 clean:
-	-@rm *.o ngtcltk/*.o togl/*.o lib/$(MACHINE)/lib*.a lib/$(MACHINE)/*.o
+	-rm *.o ngtcltk/*.o togl/*.o lib/$(MACHINE)/lib*.a lib/$(MACHINE)/*.o ng
 #
 #
 .PHONY : cleanapp
--- netgen-4.4.orig/ng.tcl
+++ netgen-4.4/ng.tcl
@@ -7,7 +7,7 @@
 
 set progname "NETGEN"
 
-set ngdir ""
+set ngdir "/usr/share/netgen"
 if { [lsearch [array names env] NETGENDIR] != -1 } {
     set ngdir $env(NETGENDIR) 
 }
--- netgen-4.4.orig/ngsolve/basiclinalg/calcinverse.cpp
+++ netgen-4.4/ngsolve/basiclinalg/calcinverse.cpp
@@ -3,17 +3,17 @@
 namespace ngbla
 {
   using namespace ngbla;
-  
+
 
   template <int N, int N2, typename SCAL>
   inline double abs (Mat<N,N2,SCAL> & m)
   {
     double sum = 0;
     for (int i = 0; i < N; i++)
-      sum += abs(m(i,i));
+      sum += std::abs(m(i,i));
     return sum;
   }
-  
+
   inline double abs (double a)
   {
     return fabs(a);
@@ -29,7 +29,7 @@
   void CalcInverse (const FlatMatrix<T> m, FlatMatrix<T2> inv)
   {
     //	  Gauss - Jordan - algorithm
-  
+
     int n = m.Height();
 
     int r;
@@ -38,14 +38,14 @@
 
     ngstd::ARRAY<int> p(n);   // pivot-permutation
     Vector<T> hv(n);
-   
+
     inv = m;
 
     // Algorithm of Stoer, Einf. i. d. Num. Math, S 145
 
     for (int j = 0; j < n; j++)
       p[j] = j;
-    
+
     for (int j = 0; j < n; j++)
       {
 	// pivot search
@@ -59,7 +59,7 @@
 	      r = i;
 	      maxval = abs (inv(i, j));
 	    }
-      
+
 	if (maxval < 1e-20)
 	  {
 	    throw Exception ("Inverse matrix: Matrix singular");
@@ -72,7 +72,7 @@
 	      swap (inv(j,k), inv(r,k));
 	    swap (p[j], p[r]);
 	  }
-      
+
 
 	// transformation
 
@@ -88,7 +88,7 @@
 	for (int k = 0; k < n; k++)
 	  if (k != j)
 	    {
-	      
+
 	      /*
 	      for (i = 0; i < n; i++)
 		if (i != j)
@@ -109,13 +109,13 @@
 		  inv(n*i+k) -= h;
 		}
 
-	      T h = hr * inv(j,k);   
+	      T h = hr * inv(j,k);
 	      inv(j,k) = -h;
 	    }
       }
 
     // col exchange
-  
+
     for (int i = 0; i < n; i++)
       {
 	for (int k = 0; k < n; k++)
@@ -125,45 +125,45 @@
       }
   }
 
-  template void CalcInverse (const FlatMatrix<double> m, 
+  template void CalcInverse (const FlatMatrix<double> m,
 			     FlatMatrix<double> inv);
-  template void CalcInverse (const FlatMatrix<Mat<1,1,double> > m, 
+  template void CalcInverse (const FlatMatrix<Mat<1,1,double> > m,
 			     FlatMatrix<Mat<1,1,double> > inv);
 
-  template void CalcInverse (const FlatMatrix<Mat<2,2,double> > m, 
+  template void CalcInverse (const FlatMatrix<Mat<2,2,double> > m,
 			     FlatMatrix<Mat<2,2,double> > inv);
-  template void CalcInverse (const FlatMatrix<Mat<3,3,double> > m, 
+  template void CalcInverse (const FlatMatrix<Mat<3,3,double> > m,
 			     FlatMatrix<Mat<3,3,double> > inv);
-  template void CalcInverse (const FlatMatrix<Mat<4,4,double> > m, 
+  template void CalcInverse (const FlatMatrix<Mat<4,4,double> > m,
 			     FlatMatrix<Mat<4,4,double> > inv);
-  template void CalcInverse (const FlatMatrix<Mat<5,5,double> > m, 
+  template void CalcInverse (const FlatMatrix<Mat<5,5,double> > m,
 			     FlatMatrix<Mat<5,5,double> > inv);
-  template void CalcInverse (const FlatMatrix<Mat<6,6,double> > m, 
+  template void CalcInverse (const FlatMatrix<Mat<6,6,double> > m,
 			     FlatMatrix<Mat<6,6,double> > inv);
-  template void CalcInverse (const FlatMatrix<Mat<7,7,double> > m, 
+  template void CalcInverse (const FlatMatrix<Mat<7,7,double> > m,
 			     FlatMatrix<Mat<7,7,double> > inv);
-  template void CalcInverse (const FlatMatrix<Mat<8,8,double> > m, 
+  template void CalcInverse (const FlatMatrix<Mat<8,8,double> > m,
 			     FlatMatrix<Mat<8,8,double> > inv);
 
 
 
 
-  template void CalcInverse (const FlatMatrix<Complex> m, 
+  template void CalcInverse (const FlatMatrix<Complex> m,
 			     FlatMatrix<Complex> inv);
-  template void CalcInverse (const FlatMatrix<Mat<1,1,Complex> > m, 
+  template void CalcInverse (const FlatMatrix<Mat<1,1,Complex> > m,
 			     FlatMatrix<Mat<1,1,Complex> > inv);
-  template void CalcInverse (const FlatMatrix<Mat<2,2,Complex> > m, 
+  template void CalcInverse (const FlatMatrix<Mat<2,2,Complex> > m,
 			     FlatMatrix<Mat<2,2,Complex> > inv);
-  template void CalcInverse (const FlatMatrix<Mat<3,3,Complex> > m, 
+  template void CalcInverse (const FlatMatrix<Mat<3,3,Complex> > m,
 			     FlatMatrix<Mat<3,3,Complex> > inv);
-  template void CalcInverse (const FlatMatrix<Mat<4,4,Complex> > m, 
+  template void CalcInverse (const FlatMatrix<Mat<4,4,Complex> > m,
 			     FlatMatrix<Mat<4,4,Complex> > inv);
-  template void CalcInverse (const FlatMatrix<Mat<5,5,Complex> > m, 
+  template void CalcInverse (const FlatMatrix<Mat<5,5,Complex> > m,
 			     FlatMatrix<Mat<5,5,Complex> > inv);
-  template void CalcInverse (const FlatMatrix<Mat<6,6,Complex> > m, 
+  template void CalcInverse (const FlatMatrix<Mat<6,6,Complex> > m,
 			     FlatMatrix<Mat<6,6,Complex> > inv);
-  template void CalcInverse (const FlatMatrix<Mat<7,7,Complex> > m, 
+  template void CalcInverse (const FlatMatrix<Mat<7,7,Complex> > m,
 			     FlatMatrix<Mat<7,7,Complex> > inv);
-  template void CalcInverse (const FlatMatrix<Mat<8,8,Complex> > m, 
+  template void CalcInverse (const FlatMatrix<Mat<8,8,Complex> > m,
 			     FlatMatrix<Mat<8,8,Complex> > inv);
 }
--- netgen-4.4.orig/ngsolve/basiclinalg/expr3.hpp
+++ netgen-4.4/ngsolve/basiclinalg/expr3.hpp
@@ -26,20 +26,20 @@
   return vec(nr);
 }
 template <class T, int num>
-inline T Access (const Vec<num, T> & vec, int nr) 
+inline T Access (const Vec<num, T> & vec, int nr)
 {
   return vec(nr);
 }
 
 #else
 
-template <typename TVEC> 
+template <typename TVEC>
 inline typename TVEC::TELEM & Access (TVEC & vec, int nr)
 {
   return vec(nr);
 }
 
-template <typename TVEC> 
+template <typename TVEC>
 inline typename TVEC::TELEM Access (const TVEC & vec, int nr)
 {
   return vec(nr);
@@ -197,7 +197,7 @@
 public:
   enum { HEIGHT = mat_traits<TA>::HEIGHT };
   enum { WIDTH  = mat_traits<TB>::WIDTH };
-  typedef typename mat_prod_type<typename TA::TELEM, 
+  typedef typename mat_prod_type<typename TA::TELEM,
 				 typename TB::TELEM>::TMAT TELEM;
   typedef Mat<HEIGHT,WIDTH,TELEM> TMAT;
 };
@@ -216,7 +216,7 @@
 {
   enum { HEIGHT = mat_traits<TA>::HEIGHT };
   enum { WIDTH  = mat_traits<TA>::WIDTH };
-  typedef typename mat_sum_type<typename TA::TELEM, 
+  typedef typename mat_sum_type<typename TA::TELEM,
 				typename TB::TELEM>::TMAT TELEM;
   typedef Mat<HEIGHT,WIDTH,TELEM> TMAT;
 };
@@ -256,14 +256,14 @@
 
 
 /// Height of matrix
-template <class TM> 
+template <class TM>
 inline int Height (const TM & m)
 {
   return m.Height();
 }
 
 /// Width of matrix
-template <class TM> 
+template <class TM>
 inline int Width (const TM & m)
 {
   return m.Width();
@@ -290,7 +290,7 @@
   return x;
 }
 
-template<> 
+template<>
 inline double ReduceComplex<double> (Complex x)
 {
   throw Complex2RealException();
@@ -320,7 +320,7 @@
 public:
   MatrixNotFittingException (const string & where, int h1, int w1,
 			     int h2, int w2)
-    : Exception ("") 
+    : Exception ("")
   {
     stringstream str;
     str << where << " mat1 = " << h1 << " x " << w1 << ", mat2 = " << h2 << " x " << w2 << endl;
@@ -339,12 +339,12 @@
  */
 
 template <typename T>
-class Expr 
+class Expr
 {
 public:
   Expr () { ; }
 
-  typedef T TConv;  
+  typedef T TConv;
   T & Spec() { return static_cast<T&> (*this); }
   const T & Spec() const { return static_cast<const T&> (*this); }
 
@@ -436,7 +436,7 @@
 #ifdef CHECK_RANGE
     if (Height() != v.Height() || Width() != v.Width())
       {
-	throw MatrixNotFittingException ("operator=", 
+	throw MatrixNotFittingException ("operator=",
 					 Height(), Width(),
 					 v.Height(), v.Width());
       }
@@ -477,7 +477,7 @@
   {
 #ifdef CHECK_RANGE
     if (Height() != v.Height() || Width() != v.Width())
-      throw MatrixNotFittingException ("operator+=", 
+      throw MatrixNotFittingException ("operator+=",
 				       Height(), Width(),
 				       v.Height(), v.Width());
 #endif
@@ -510,7 +510,7 @@
   {
 #ifdef CHECK_RANGE
     if (Height() != v.Height() || Width() != v.Width())
-      throw MatrixNotFittingException ("operator+=", 
+      throw MatrixNotFittingException ("operator+=",
 				       Height(), Width(),
 				       v.Height(), v.Width());
 #endif
@@ -536,7 +536,7 @@
       for (int i = 0; i < hw; i++)
 	Spec()(i) += scal;
     }
-  
+
 
   template<typename TB>
   T & operator-= (const Expr<TB> & v)
@@ -544,7 +544,7 @@
 
 #ifdef CHECK_RANGE
     if (Height() != v.Height() || Width() != v.Width())
-      throw MatrixNotFittingException ("operator-=", 
+      throw MatrixNotFittingException ("operator-=",
 				       Height(), Width(),
 				       v.Height(), v.Width());
 #endif
@@ -600,7 +600,7 @@
  */
 
 
-template <class TA, class TB> 
+template <class TA, class TB>
 class SumExpr : public Expr<SumExpr<TA,TB> >
 {
   const TA a;
@@ -610,7 +610,7 @@
 				typename TB::TELEM>::TMAT TELEM;
   typedef typename mat_traits<TELEM>::TSCAL TSCAL;
 
-  SumExpr (const TA & aa, const TB & ab) : a(aa), b(ab) 
+  SumExpr (const TA & aa, const TB & ab) : a(aa), b(ab)
   {
     ;
     //    cout << "SUM, TA = " << typeid(TA).name() << endl
@@ -643,7 +643,7 @@
    Matrix-expr minus Matrix-expr
  */
 
-template <class TA, class TB> 
+template <class TA, class TB>
 class SubExpr : public Expr<SubExpr<TA,TB> >
 {
   const TA a;
@@ -667,7 +667,7 @@
 inline SubExpr<typename TA::TConv, typename TB::TConv>
 operator- (const Expr<TA> & a, const Expr<TB> & b)
 {
-  return SubExpr<typename TA::TConv, typename TB::TConv> 
+  return SubExpr<typename TA::TConv, typename TB::TConv>
     (static_cast <const TA&> (a), static_cast <const TB&> (b));
 }
 
@@ -719,7 +719,7 @@
 /**
    Scalar times Matrix-expr
  */
-template <class TA, class TS> 
+template <class TA, class TS>
 class ScaleExpr : public Expr<ScaleExpr<TA,TS> >
 {
   TA a;
@@ -743,14 +743,14 @@
 };
 
 template <typename TA>
-inline ScaleExpr<typename TA::TConv, double> 
+inline ScaleExpr<typename TA::TConv, double>
 operator* (double b, const Expr<TA> & a)
 {
   return ScaleExpr<typename TA::TConv, double> (static_cast<const TA&> (a), b );
 }
 
 template <typename TA>
-inline ScaleExpr<TA, Complex> 
+inline ScaleExpr<TA, Complex>
 operator* (Complex b, const Expr<TA> & a)
 {
   return ScaleExpr<TA, Complex> (static_cast<const TA&> (a), b);
@@ -768,7 +768,7 @@
   const TA a;
   const TB b;
 public:
-  typedef typename mat_prod_type<typename TA::TELEM, 
+  typedef typename mat_prod_type<typename TA::TELEM,
 				 typename TB::TELEM>::TMAT TELEM;
   typedef typename mat_traits<TELEM>::TSCAL TSCAL;
 
@@ -776,7 +776,7 @@
 
   TELEM operator() (int i) const { return TELEM(TSCAL(0)); }
   TELEM operator() (int i, int j) const
-  { 
+  {
     int wa = a.Width();
     TELEM sum;
     if (wa >= 1)
@@ -787,7 +787,7 @@
       }
     else
       sum = TSCAL(0);
-    
+
     return sum;
   }
 
@@ -801,7 +801,7 @@
 inline MultExpr<typename TA::TConv, typename TB::TConv>
 operator* (const Expr<TA> & a, const Expr<TB> & b)
 {
-  return MultExpr<typename TA::TConv, typename TB::TConv> 
+  return MultExpr<typename TA::TConv, typename TB::TConv>
     (static_cast <const TA&> (a), static_cast <const TB&> (b));
 }
 
@@ -830,7 +830,7 @@
 };
 
 
-/// Transpose 
+/// Transpose
 template <typename TA>
 inline TransExpr<typename TA::TConv>
 Trans (const Expr<TA> & a)
@@ -851,6 +851,16 @@
 /**
    Inner product
  */
+inline double InnerProduct ( const double& a, const double& b )
+{
+  return a * b;
+}
+
+inline Complex InnerProduct ( const Complex& a, const Complex b)
+{
+  return a * b;
+}
+
 template <class TA, class TB>
 inline typename TA::TSCAL
 InnerProduct (const MatExpr<TA> & a, const MatExpr<TB> & b)
@@ -862,15 +872,6 @@
   return sum;
 }
 
-inline double InnerProduct (double a, double b)
-{
-  return a * b;
-}
-
-inline Complex InnerProduct (Complex a, Complex b)
-{
-  return a * b;
-}
 
 
 /* **************************** Trace **************************** */
@@ -889,6 +890,16 @@
 /* **************************** L2Norm **************************** */
 
 /// Euklidean norm squared
+inline double L2Norm2 (const double& v)
+{
+  return v*v;
+}
+
+inline double L2Norm2 (Complex v)
+{
+  return v.real()*v.real()+v.imag()*v.imag();
+}
+
 template <class TA>
 inline double L2Norm2 (const MatExpr<TA> & v)
 {
@@ -899,17 +910,6 @@
   return sum;
 }
 
-
-inline double L2Norm2 (double v)
-{
-  return v*v;
-}
-
-inline double L2Norm2 (Complex v)
-{
-  return v.real()*v.real()+v.imag()*v.imag();
-}
-
 template <class TA>
 inline double L2Norm (const MatExpr<TA> & v)
 {
@@ -988,11 +988,11 @@
 	inv(0,0) =  det * (m(4) * m(8) - m(5) * m(7));
 	inv(0,1) = -det * (m(1) * m(8) - m(2) * m(7));
 	inv(0,2) =  det * (m(1) * m(5) - m(2) * m(4));
-	
+
 	inv(1,0) = -det * (m(3) * m(8) - m(5) * m(6));
 	inv(1,1) =  det * (m(0) * m(8) - m(2) * m(6));
 	inv(1,2) = -det * (m(0) * m(5) - m(2) * m(3));
-	
+
 	inv(2,0) =  det * (m(3) * m(7) - m(4) * m(6));
 	inv(2,1) = -det * (m(0) * m(7) - m(1) * m(6));
 	inv(2,2) =  det * (m(0) * m(4) - m(1) * m(3));
@@ -1035,19 +1035,19 @@
   const T & sm = m.Spec();
   switch (sm.Height())
     {
-    case 1: 
+    case 1:
       {
-	return sm(0,0); 
+	return sm(0,0);
 	break;
       }
     case 2:
       {
-	return ( sm(0,0)*sm(1,1) - sm(0,1)*sm(1,0) ); 
+	return ( sm(0,0)*sm(1,1) - sm(0,1)*sm(1,0) );
 	break;
       }
     case 3:
       {
-	return 
+	return
 	  sm(0) * sm(4) * sm(8)
 	  + sm(1) * sm(5) * sm(6)
 	  + sm(2) * sm(3) * sm(7)
--- netgen-4.4.orig/ngsolve/comp/fespace.cpp
+++ netgen-4.4/ngsolve/comp/fespace.cpp
@@ -10,6 +10,8 @@
 
 #include <comp.hpp>
 #include <multigrid.hpp>
+#include <cstdlib>
+
 using namespace ngmg;
 
 namespace ngcomp
--- netgen-4.4.orig/ngsolve/comp/postproc.cpp
+++ netgen-4.4/ngsolve/comp/postproc.cpp
@@ -9,6 +9,7 @@
 */
 
 #include <comp.hpp>
+#include <fem.hpp>
 
 namespace ngcomp
 {
@@ -274,8 +275,8 @@
 	if (dimflux > 1)
 	  {
 	    FlatMatrix<SCAL> elmat(dnumsflux.Size(), lh);
-	    dynamic_cast<const BlockBilinearFormIntegrator&> (fluxbli)
-	      . Block() . AssembleElementMatrix (felflux, eltrans, elmat, lh);
+	    BlockBilinearFormIntegrator const& fluxbli_ref = dynamic_cast<const BlockBilinearFormIntegrator&> (fluxbli);
+	    fluxbli_ref . Block() . AssembleElementMatrix (felflux, eltrans, elmat, lh);
 	    CholeskyFactors<SCAL> invelmat(elmat);
 
 	    FlatVector<SCAL> hv1(dnumsflux.Size(), lh);
--- netgen-4.4.orig/ngsolve/linalg/order.cpp
+++ netgen-4.4/ngsolve/linalg/order.cpp
@@ -54,7 +54,7 @@
     return ball.Alloc();
   }
 
-  void CliqueEl :: operator delete (void * p, size_t)
+  void CliqueEl :: operator delete (void * p)
   {
     ball.Free (p);
   }
--- netgen-4.4.orig/ngsolve/linalg/order.hpp
+++ netgen-4.4/ngsolve/linalg/order.hpp
@@ -118,7 +118,7 @@
   ///
   void * operator new(size_t);
   ///
-  void operator delete (void *, size_t);
+  void operator delete (void *);
 };
   
 
--- netgen-4.4.orig/ngsolve/solve/shapetester.cpp
+++ netgen-4.4/ngsolve/solve/shapetester.cpp
@@ -1,6 +1,7 @@
 
 #include <solve.hpp>
 // #include <nginterface.h>
+#include <cstdlib>
 
 
 namespace ngsolve
--- netgen-4.4.orig/ngtcltk/ngappinit.cpp
+++ netgen-4.4/ngtcltk/ngappinit.cpp
@@ -77,7 +77,7 @@
   if (getenv ("NETGENDIR") && strlen (getenv ("NETGENDIR")))
     ngdir = getenv ("NETGENDIR");
   else
-    ngdir = ".";
+    ngdir = "/usr/share/netgen";
   
   verbose = parameters.GetDefineFlag ("V");
 
--- netgen-4.4.orig/ngtcltk/nghelp.tcl
+++ netgen-4.4/ngtcltk/nghelp.tcl
@@ -1,6 +1,6 @@
 proc print_commandline_help { } {
     
-    puts "Usage: ng { options }"
+    puts "Usage: netgen { options }"
 
     puts "-geofile=filename    Input geometry file (alternative:  ng filename)"
     puts "-meshfile=filename   Output mesh file"
--- netgen-4.4.orig/togl/togl.cpp
+++ netgen-4.4/togl/togl.cpp
@@ -140,12 +140,14 @@
 #  include "tkInt8.4p4.h"
 #elif TK_MAJOR_VERSION==8 && TK_MINOR_VERSION==4 && TK_RELEASE_SERIAL==6
 #  include "tkInt8.4p6.h"
+#elif TK_MAJOR_VERSION==8 && TK_MINOR_VERSION==4
+#  include "tk-private/generic/tkInt.h"
 #else
-   Sorry, you will have to edit togl.c to include the right tkInt.h file
+#error   Sorry, you will have to edit togl.c to include the right tkInt.h file
 #endif
 #elif defined(WIN32)
 #if TK_MAJOR_VERSION<8
-   Sorry Windows version requires Tcl/Tk ver 8.0 or higher.
+#error   Sorry Windows version requires Tcl/Tk ver 8.0 or higher.
 #endif
 #include "tkInt.h"
 #include "tkWinInt.h"
@@ -903,8 +905,8 @@
 #if defined(__sgi) && defined(STEREO)
       stereoMakeCurrent( Tk_Display(togl->TkWin),
                          togl->OverlayWindow,
-                         togl->OverlayCtx );	
-#endif /*__sgi STEREO */	
+                         togl->OverlayCtx );
+#endif /*__sgi STEREO */
 #endif /* WIN32 */
       togl->OverlayDisplayProc(togl);
    }
@@ -1846,7 +1848,7 @@
  *      The widget is destroyed.
  *
  *----------------------------------------------------------------------
- */ 
+ */
 static void ToglCmdDeletedProc( ClientData clientData )
 {
    struct Togl *togl = (struct Togl *)clientData;
@@ -1998,7 +2000,7 @@
 #else
 	    Tk_DeleteTimerHandler(togl->timerHandler);
 #endif
-	    
+
 	 }
 	 if (togl->UpdatePending) {
 #if (TCL_MAJOR_VERSION * 100 + TCL_MINOR_VERSION) >= 705
@@ -3093,7 +3095,7 @@
       stereo.currentStereoBuffer = STEREO_BUFFER_LEFT;
       break;
     case GL_RIGHT:
-    case GL_FRONT_RIGHT: 
+    case GL_FRONT_RIGHT:
       stereo.currentStereoBuffer = STEREO_BUFFER_RIGHT;
       mode = GL_FRONT;
       break;
@@ -3164,7 +3166,7 @@
 static void
 stereoMakeCurrent(Display *dpy, Window win, GLXContext ctx)
 {
-  
+
   if (stereo.useSGIStereo) {
     if (dpy && (dpy != stereo.currentDisplay)) {
       int event, error;
@@ -3210,7 +3212,7 @@
                GLfloat near, GLfloat far, GLfloat eyeDist, GLfloat eyeOffset)
 {
   GLfloat eyeShift = (eyeDist - near) * (eyeOffset / eyeDist);
-  
+
   glFrustum(left+eyeShift, right+eyeShift, bottom, top, near, far);
   glTranslatef(-eyeShift, 0.0, 0.0);
 }
--- netgen-4.4.orig/togl/license.terms
+++ netgen-4.4/togl/license.terms
@@ -0,0 +1,39 @@
+This software is copyrighted by the Regents of the University of
+California, Sun Microsystems, Inc., Scriptics Corporation,
+and other parties.  The following terms apply to all files associated
+with the software unless explicitly disclaimed in individual files.
+
+The authors hereby grant permission to use, copy, modify, distribute,
+and license this software and its documentation for any purpose, provided
+that existing copyright notices are retained in all copies and that this
+notice is included verbatim in any distributions. No written agreement,
+license, or royalty fee is required for any of the authorized uses.
+Modifications to this software may be copyrighted by their authors
+and need not follow the licensing terms described here, provided that
+the new terms are clearly indicated on the first page of each file where
+they apply.
+
+IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
+FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
+DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE
+IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
+NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
+MODIFICATIONS.
+
+GOVERNMENT USE: If you are acquiring this software on behalf of the
+U.S. government, the Government shall have only "Restricted Rights"
+in the software and related documentation as defined in the Federal 
+Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2).  If you
+are acquiring the software on behalf of the Department of Defense, the
+software shall be classified as "Commercial Computer Software" and the
+Government shall have only "Restricted Rights" as defined in Clause
+252.227-7013 (c) (1) of DFARs.  Notwithstanding the foregoing, the
+authors grant the U.S. Government and others acting in its behalf
+permission to use and distribute the software in accordance with the
+terms specified in this license. 
--- netgen-4.4.orig/togl/LICENSE.togl
+++ netgen-4.4/togl/LICENSE.togl
@@ -0,0 +1,27 @@
+This software is copyrighted by Brian Paul (brian@mesa3d.org)
+and Benjamin Bederson (bederson@cs.umd.edu).  The following
+terms apply to all files associated with the software unless explicitly
+disclaimed in individual files.
+
+The authors hereby grant permission to use, copy, modify, distribute,
+and license this software and its documentation for any purpose, provided
+that existing copyright notices are retained in all copies and that this
+notice is included verbatim in any distributions. No written agreement,
+license, or royalty fee is required for any of the authorized uses.
+Modifications to this software may be copyrighted by their authors
+and need not follow the licensing terms described here, provided that
+the new terms are clearly indicated on the first page of each file where
+they apply.
+
+IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
+FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
+DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE
+IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
+NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
+MODIFICATIONS.
--- netgen-4.4.orig/libsrc/makefile.mach.LINUX
+++ netgen-4.4/libsrc/makefile.mach.LINUX
@@ -16,12 +16,20 @@
 #
 CFLAGS2 =
 
-CPLUSPLUSFLAGS2 = -O2 -I/usr/include/GL3.5 -DLINUX -DOPENGL \
-	-ftemplate-depth-99 -finline-limit=20000 \
+CPLUSPLUSFLAGS2 = -O2 -I/usr/include/GL -I/usr/include/tcl8.4 -I/usr/include/tk8.4 -I/usr/X11R6/include  \
+        -DLINUX -DOPENGL \
+	-finline-limit=20000 \
 	-funroll-loops  -DNGSOLVE
 
 LINKFLAGS2 =   -L/usr/openwin/lib -L/usr/X11R6/lib -L/usr/lib/GL3.5 -lstdc++ 
 
+ifdef WITH_OCC
+OCC_DIR=/opt/OpenCASCADE5.2
+OCCINC_DIR=$(OCC_DIR)/ros/inc
+OCCLIB_DIR=$(OCC_DIR)/ros/lin/lib
+CPLUSPLUSFLAGS2 += -DOCCGEOMETRY -DOCC52 -DUSE_STL_STREAM -I$(OCCINC_DIR)
+LINKFLAGS2 += -L$(OCCLIB_DIR) -lTKIGES -lTKBRep -lTKSTEP -lTKSTL -lTKTopAlgo -lTKG3d -lTKG2d -lTKXSBase -lTKOffset -lTKFillet -lTKGeomBase -lTKGeomAlgo -lTKShHealing -lTKBO -lTKPrim -lTKernel -lTKMath -lTKBool
+endif
 
 goalngs=goalngs
 
--- netgen-4.4.orig/libsrc/linalg/densemat.hpp
+++ netgen-4.4/libsrc/linalg/densemat.hpp
@@ -7,13 +7,16 @@
 /* Date:   01. Oct. 94                                                    */
 /**************************************************************************/
 
-/** 
+/**
     Data type dense matrix
 */
 
 
 #include <assert.h>
 
+class DenseMatrix;
+void CalcInverse (const DenseMatrix & m1, DenseMatrix & m2);
+
 class DenseMatrix
 {
 protected:
@@ -60,7 +63,7 @@
     double sum;
     const double * mp, * sp;
     double * dp;
-    
+
 #ifdef DEBUG
     if (prod.Size() != height)
       {
@@ -68,17 +71,17 @@
 	assert (1);
 	// prod.SetSize (height);
       }
-    
 
-    if (!height) 
+
+    if (!height)
       {
 	cout << "DenseMatrix::Mult height = 0" << endl;
       }
-    if (!width) 
+    if (!width)
       {
 	cout << "DenseMatrix::Mult width = 0" << endl;
       }
-    
+
     if (width != v.Size())
       {
 	(*myerr) << "\nMatrix and Vector don't fit" << endl;
@@ -89,14 +92,14 @@
       }
     else
 #endif
-      {      
+      {
 	mp = data;
 	dp = &prod.Elem(1);
 	for (int i = 1; i <= height; i++)
 	  {
 	    sum = 0;
 	    sp = &v.Get(1);
-	    
+
 	    for (INDEX j = 1; j <= width; j++)
 	      {
 		//        sum += Get(i,j) * v.Get(j);
@@ -104,7 +107,7 @@
 		mp++;
 		sp++;
 	      }
-	    
+
 	    *dp = sum;
 	    dp++;
 	  }
@@ -123,7 +126,7 @@
   ///
   friend DenseMatrix operator+ (const DenseMatrix & m1, const DenseMatrix & m2);
 
-  /// 
+  ///
   friend void Transpose (const DenseMatrix & m1, DenseMatrix & m2);
   ///
   friend void Mult (const DenseMatrix & m1, const DenseMatrix & m2, DenseMatrix & m3);
@@ -167,7 +170,7 @@
 
 public:
   ///
-  MatrixFixWidth () 
+  MatrixFixWidth ()
   { height = 0; data = 0; }
   ///
   MatrixFixWidth (int h)
@@ -182,7 +185,7 @@
       {
 	delete data;
 	height = h;
-	data = new double[WIDTH*height]; 
+	data = new double[WIDTH*height];
       }
   }
 
@@ -196,7 +199,7 @@
   MatrixFixWidth & operator= (double v)
   {
     for (int i = 0; i < height*WIDTH; i++)
-      data[i] = v; 
+      data[i] = v;
     return *this;
   }
 
@@ -207,13 +210,13 @@
     const double * mp, * sp;
     double * dp;
 
-    /*    
+    /*
     if (prod.Size() != height)
       {
 	cerr << "MatrixFixWidth::Mult: wrong vector size " << endl;
 	assert (1);
       }
-    */    
+    */
 
     mp = data;
     dp = &prod[0];
@@ -221,14 +224,14 @@
       {
 	sum = 0;
 	sp = &v[0];
-	
+
 	for (int j = 0; j < WIDTH; j++)
 	  {
 	    sum += *mp * *sp;
 	    mp++;
 	    sp++;
 	  }
-	    
+
 	*dp = sum;
 	dp++;
       }
--- netgen-4.4.orig/libsrc/meshing/meshtype.hpp
+++ netgen-4.4/libsrc/meshing/meshtype.hpp
@@ -955,13 +955,14 @@
 
 
 
-
+  class Mesh;
 /**
    Identification of periodic surfaces, close surfaces, etc. 
  */
 class Identifications
 {
 private:
+
   Mesh & mesh;
 
   /// identify points (thin layers, periodic b.c.)  
--- netgen-4.4.orig/libsrc/visualization/stlmeshing.cpp
+++ netgen-4.4/libsrc/visualization/stlmeshing.cpp
@@ -1062,9 +1062,9 @@
 }
 
 
+VisualSceneSTLMeshing vsstlmeshing;
 
 
-VisualSceneSTLMeshing vsstlmeshing;
 
 #endif
 
--- netgen-4.4.orig/libsrc/visualization/mvdraw.hpp
+++ netgen-4.4/libsrc/visualization/mvdraw.hpp
@@ -250,6 +250,7 @@
   int seltria;
 };
 
+extern VisualSceneSTLMeshing vsstlmeshing;
 
 
 
--- netgen-4.4.orig/debian/docs
+++ netgen-4.4/debian/docs
@@ -0,0 +1 @@
+README.INSTALL
--- netgen-4.4.orig/debian/changelog
+++ netgen-4.4/debian/changelog
@@ -0,0 +1,131 @@
+netgen (4.4-12.1) unstable; urgency=low
+
+  * NMU, but won't be uploaded (closes: #475323).
+  * Copied tcl_interp and vssolution from ngtcltk/ngpkg.cpp to
+    libsrc/interface/nglib.cpp, and AddVisualizationScene from
+    ngtcltk/ngpkg.cpp to libsrc/visualization/vssolution.cpp
+
+ -- Adam C. Powell, IV <hazelsct@debian.org>  Thu, 10 Apr 2008 16:54:28 -0400
+
+netgen (4.4-12) unstable; urgency=low
+
+  * attempt to fix hppa build
+  * Bug fix: "netgen: FTBFS: include/../ngstd/array.hpp:294: error:
+    &#39;memcpy&#39; was not declared in this scope", thanks to Lucas
+    Nussbaum (Closes: #474828).
+
+ -- Christophe Prud'homme <prudhomm@debian.org>  Wed, 09 Apr 2008 08:28:05 +0200
+
+netgen (4.4-11) unstable; urgency=low
+
+  [ Christophe Prud'homme ]
+  * debian/rules: export LINK
+  * fixed build on ia64 and possibly other archs
+  * debian/patches/netgen-shlibs.patch: cleanup up LINKFLAGS2
+
+ -- Christophe Prud'homme <prudhomm@debian.org>  Mon, 07 Apr 2008 13:28:49 +0200
+
+netgen (4.4-10) unstable; urgency=low
+
+  [ Daniel Leidert ]
+  * debian/control: Added Homepage field. Vcs fields transition. Fixed Vcs-Svn
+    field.
+  * debian/netgen-doc.doc-base: Fixed encoding of the file.
+    (Abstract): Improved description.
+    (Section): Fixed for doc-base 0.8.10.
+  * debian/rules (clean): Fixed to build twice in a row.
+  * debian/patches/stdlib.patch: Adjusted to compile with GCC 4.3 (closes:
+    #454830).
+  * debian/patches/netgen-shlibs.patch: Adjusted. Add linkages to resolve
+    symbols for the libraries. Otherwise the library package dependencies will
+    not be correct.
+  * debian/patches/clean.patch: Removed. Not sufficient. Better be done in
+    debian/rules.
+
+  [ Christophe Prud'homme ]
+  * debian/rules: export CC/CPLUSPLUS
+  * Upload
+
+ -- Christophe Prud'homme <prudhomm@debian.org>  Mon, 07 Apr 2008 10:53:48 +0200
+
+netgen (4.4-9) unstable; urgency=low
+
+  * Bug fix: "netgen: clean target is insufficient", thanks to brian
+    m. carlson (Closes: #455536).
+  * Bug fix: "FTBFS with GCC 4.3: missing #includes", thanks to Martin
+    Michlmayr (Closes: #454830).
+  * Bug fix: "netgen: Interface lib is missing nglib.cpp", thanks to Adam
+    C. Powell (Closes: #461929).
+  * Bug fix: "netgen: Please add shared libs", thanks to Adam
+    C. Powell (Closes: #462105).
+  * debian/control: Fixed Depends for libnetgen
+  * debian/control: Updated Standards-Version
+
+ -- Christophe Prud'homme <prudhomm@debian.org>  Fri, 08 Feb 2008 09:27:04 +0100
+
+netgen (4.4-8) unstable; urgency=low
+
+  [ Christophe Prud'homme ]
+  * Bug fix: "FTBFS with GCC 4.3: missing #includes", thanks to Martin
+    Michlmayr (Closes: #417451).
+
+  [ Rafael Laboissiere ]
+  * debian/control: Added XS-Vcs-Svn and XS-Vcs-Browser fields to the Source
+    section
+
+ -- Christophe Prud'homme <prudhomm@debian.org>  Tue, 17 Jul 2007 06:32:28 +0200
+
+netgen (4.4-7) unstable; urgency=low
+
+  * Added g++ to Build-Depends, it might help build on arm
+  * Updated Standards-Version to 3.7.2 (no change)
+
+ -- Christophe Prud'homme <prudhomm@debian.org>  Sun, 30 Jul 2006 17:09:06 +0200
+
+netgen (4.4-6) unstable; urgency=low
+
+  * Bug fix: "netgen: FTBFS: cannot find -lXi", thanks to Daniel Schepler
+    (Closes: #370176).
+  * Make it compile with g++ 4.1
+
+ -- Christophe Prud'homme <prudhomm@debian.org>  Fri,  9 Jun 2006 08:00:29 +0200
+
+netgen (4.4-5) unstable; urgency=low
+
+  * Fixed netgen override disparity
+  * Fixed tix dependency
+  * Changed Maintainer to pkg-scicomp Alioth project and added myself to
+    the list of Uploaders
+
+ -- Christophe Prud'homme <prudhomm@debian.org>  Sun,  9 Apr 2006 17:43:36 +0200
+
+netgen (4.4-4) unstable; urgency=low
+
+  * Bug fix: "netgen: does not run or missing dependency", thanks to
+    Laurent Bonnaud (Closes: #359949).
+  * Bug fix: "FTBFS with G++ 4.1: misc errors", thanks to Martin Michlmayr
+    (Closes: #361336).
+
+ -- Christophe Prud'homme <prudhomm@debian.org>  Sat,  8 Apr 2006 10:57:12 +0200
+
+netgen (4.4-3) unstable; urgency=low
+
+  * Fixed build-depends: added libxmu-dev
+
+ -- Christophe Prud'homme <prudhomm@debian.org>  Sat, 25 Mar 2006 13:49:40 +0100
+
+netgen (4.4-2) unstable; urgency=low
+
+  * Fixed build-depends
+
+ -- Christophe Prud'homme <prudhomm@debian.org>  Fri, 17 Mar 2006 19:33:04 +0100
+
+netgen (4.4-1) unstable; urgency=low
+
+  * Initial release Closes: #343082
+  * applied patch by D. Barbier <barbier@linuxfr.org> to disable occ
+  * Note to archive maintainer: I have added license.terms (tk license)
+    and LICENSE.togl (close to tk license) to the archive and all
+    copyright holders are listed in debian/copyright
+
+ -- Christophe Prud'homme <prudhomm@debian.org>  Sat, 18 Feb 2006 11:25:26 +0100
--- netgen-4.4.orig/debian/netgen-doc.doc-base
+++ netgen-4.4/debian/netgen-doc.doc-base
@@ -0,0 +1,12 @@
+Document: netgen
+Title: Debian netgen Manual
+Author: Joachim Schöberl
+Abstract: NETGEN is an automatic mesh generation tool
+ for two and three dimensions. This manual describes the
+ NETGEN basics, operations, the GUI and the programming
+ interface.
+Section: Science/Mathematics
+
+Format: pdf
+Files: /usr/share/doc/netgen-doc/ng4.pdf
+
--- netgen-4.4.orig/debian/rules
+++ netgen-4.4/debian/rules
@@ -0,0 +1,70 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses cdbs.  Originaly written by Robert Millan.
+# This file is public domain.
+
+# where sources are
+DEB_SRCDIR = $(CURDIR)/
+# in which directory to build
+DEB_BUILDDIR = $(DEB_SRCDIR)/
+# in which directory to install the sofware
+DEB_DESTDIR = $(CURDIR)/debian/tmp
+
+#DEB_TAR_SRCDIR                  := netgen-4.3.1
+DEB_AUTO_CLEANUP_RCS            := yes
+
+export MACHINE=LINUX
+
+
+DEB_MAKE_CLEAN_TARGET    := clean
+DEB_MAKE_BUILD_TARGET    := netgen
+DEB_MAKE_INSTALL_TARGET  := #install DESTDIR=$(CURDIR)/debian/tmp/
+# no check for this software
+DEB_MAKE_CHECK_TARGET :=
+
+DEB_DH_COMPRESS_ARGS := -X pdf
+
+include /usr/share/cdbs/1/class/makefile.mk
+include /usr/share/cdbs/1/rules/debhelper.mk
+#include /usr/share/cdbs/1/rules/tarball.mk
+#include /usr/share/cdbs/1/rules/simple-patchsys.mk
+include /usr/share/cdbs/1/rules/patchsys-quilt.mk
+
+INSTALL_PROG=install -D
+INSTALL_DATA=install -m 644 -D
+
+export CC=gcc
+export CPLUSPLUS=g++
+export LINK=g++
+
+clean::
+	find . \( -name "*.o" -o -name "*.lo" \) -delete
+	rm -rf lib/
+
+build/netgen::
+	$(INSTALL_PROG) ng $(CURDIR)/debian/netgen/usr/bin/netgen
+	(cd debian && docbook-to-man netgen.sgml > netgen.1)
+
+
+build/libnetgen-dev::
+	for i in libsrc/*; \
+	do \
+	if test -d $$i; then \
+        name=`basename $$i`; \
+	for j in $$i/*.h*; do \
+	  filename=`basename $$j`; \
+	  if test $$name != "include"; then \
+	   $(INSTALL_DATA) $$j $(CURDIR)/debian/libnetgen-dev/usr/include/netgen/$$name/$$filename ;\
+          else \
+           $(INSTALL_DATA) $$j $(CURDIR)/debian/libnetgen-dev/usr/include/netgen/$$filename ;\
+          fi \
+	done \
+	fi \
+	done
+	for i in `find ngsolve -name "*.hpp"`; \
+	do \
+         filename=`basename $$i`; \
+	 $(INSTALL_DATA) $$i $(CURDIR)/debian/libnetgen-dev/usr/include/netgen/ngsolve/$$filename ;\
+	done
+
+cleanbuilddir/netgen::
+	-rm -f debian/netgen.1
--- netgen-4.4.orig/debian/copyright
+++ netgen-4.4/debian/copyright
@@ -0,0 +1,111 @@
+# -*- coding: utf-8 -*-
+This package was debianized by Christophe Prud'homme <prudhomm@debian.org> on
+Wed,  4 Jan 2006 13:15:20 +0100.
+
+It was downloaded from http://www.hpfem.jku.at/netgen/
+
+Copyright Holder:
+
+- Netgen
+Joachim Schöberl <js@jku.at>
+
+- togl/togl*
+Togl is copyrighted by Brian Paul (brian_paul@mesa3d.org) and Benjamin
+Bederson (bederson@cs.umd.edu).
+
+- togl/tk*.h
+the tk files in togl/ are copyrighted by the Regents of the University of
+California, Sun Microsystems, Inc., Scriptics Corporation,
+and other parties.
+
+License:
+
+    This package is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This package is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this package; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+On Debian systems, the complete text of the GNU Lesser General
+Public License can be found in `/usr/share/common-licenses/LGPL'.
+
+Togl license:
+
+This software is copyrighted by Brian Paul (brian@mesa3d.org)
+and Benjamin Bederson (bederson@cs.umd.edu).  The following
+terms apply to all files associated with the software unless explicitly
+disclaimed in individual files.
+
+The authors hereby grant permission to use, copy, modify, distribute,
+and license this software and its documentation for any purpose, provided
+that existing copyright notices are retained in all copies and that this
+notice is included verbatim in any distributions. No written agreement,
+license, or royalty fee is required for any of the authorized uses.
+Modifications to this software may be copyrighted by their authors
+and need not follow the licensing terms described here, provided that
+the new terms are clearly indicated on the first page of each file where
+they apply.
+
+IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
+FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
+DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE
+IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
+NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
+MODIFICATIONS.
+
+
+Tk*.h license:
+
+This software is copyrighted by the Regents of the University of
+California, Sun Microsystems, Inc., Scriptics Corporation,
+and other parties.  The following terms apply to all files associated
+with the software unless explicitly disclaimed in individual files.
+
+The authors hereby grant permission to use, copy, modify, distribute,
+and license this software and its documentation for any purpose, provided
+that existing copyright notices are retained in all copies and that this
+notice is included verbatim in any distributions. No written agreement,
+license, or royalty fee is required for any of the authorized uses.
+Modifications to this software may be copyrighted by their authors
+and need not follow the licensing terms described here, provided that
+the new terms are clearly indicated on the first page of each file where
+they apply.
+
+IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
+FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
+DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE
+IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
+NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
+MODIFICATIONS.
+
+GOVERNMENT USE: If you are acquiring this software on behalf of the
+U.S. government, the Government shall have only "Restricted Rights"
+in the software and related documentation as defined in the Federal
+Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2).  If you
+are acquiring the software on behalf of the Department of Defense, the
+software shall be classified as "Commercial Computer Software" and the
+Government shall have only "Restricted Rights" as defined in Clause
+252.227-7013 (c) (1) of DFARs.  Notwithstanding the foregoing, the
+authors grant the U.S. Government and others acting in its behalf
+permission to use and distribute the software in accordance with the
+terms specified in this license.
--- netgen-4.4.orig/debian/README.Debian
+++ netgen-4.4/debian/README.Debian
@@ -0,0 +1,15 @@
+netgen for Debian
+-----------------
+
+netgen provides 
+
+ - netgen :  the gui to generate mesh
+ - netgen-doc :  the doc for the netgen gui and some tutorial files
+ - libnetgen-dev : the static libraries and headers 
+
+Regarding the development files, they are organized as follows
+for each <dir>
+ - /usr/lib/libnetgen_<dir>.a (static libraries)
+ - /usr/include/netgen/<dir>.h* (header files for corresponding <dir> library)
+
+ -- Christophe Prud'homme <prudhomm@debian.org>, Wed Jan  4 15:05:23 2006
--- netgen-4.4.orig/debian/netgen-doc.install
+++ netgen-4.4/debian/netgen-doc.install
@@ -0,0 +1 @@
+doc/ng4.pdf /usr/share/doc/netgen-doc
--- netgen-4.4.orig/debian/netgen.sgml
+++ netgen-4.4/debian/netgen.sgml
@@ -0,0 +1,197 @@
+<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
+
+<!-- Process this file with docbook-to-man to generate an nroff manual
+     page: `docbook-to-man manpage.sgml > manpage.1'.  You may view
+     the manual page with: `docbook-to-man manpage.sgml | nroff -man |
+     less'.  A typical entry in a Makefile or Makefile.am is:
+
+manpage.1: manpage.sgml
+	docbook-to-man $< > $@
+
+    
+	The docbook-to-man binary is found in the docbook-to-man package.
+	Please remember that if you create the nroff version in one of the
+	debian/rules file targets (such as build), you will need to include
+	docbook-to-man in your Build-Depends control field.
+
+  -->
+
+  <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+  <!ENTITY dhfirstname "<firstname>Christophe</firstname>">
+  <!ENTITY dhsurname   "<surname>Prud'homme</surname>">
+  <!-- Please adjust the date whenever revising the manpage. -->
+  <!ENTITY dhdate      "<date>January  4, 2006</date>">
+  <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
+       allowed: see man(7), man(1). -->
+  <!ENTITY dhsection   "<manvolnum>1</manvolnum>">
+  <!ENTITY dhemail     "<email>prudhomm@debian.org</email>">
+  <!ENTITY dhusername  "Christophe Prud'homme">
+  <!ENTITY dhucpackage "<refentrytitle>NETGEN</refentrytitle>">
+  <!ENTITY dhpackage   "netgen">
+
+  <!ENTITY debian      "<productname>Debian</productname>">
+  <!ENTITY gnu         "<acronym>GNU</acronym>">
+  <!ENTITY gpl         "&gnu; <acronym>GPL</acronym>">
+]>
+
+<refentry>
+  <refentryinfo>
+    <address>
+      &dhemail;
+    </address>
+    <author>
+      &dhfirstname;
+      &dhsurname;
+    </author>
+    <copyright>
+      <year>2003</year>
+      <holder>&dhusername;</prudhomm></holder>
+    </copyright>
+    &dhdate;
+  </refentryinfo>
+  <refmeta>
+    &dhucpackage;
+
+    &dhsection;
+  </refmeta>
+  <refnamediv>
+    <refname>&dhpackage;</refname>
+
+    <refpurpose>Automatic 3d tetrahedral mesh generator</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <cmdsynopsis>
+      <command>&dhpackage;</command>
+
+      <arg>OPTIONS...</arg>
+      <arg>file.geo</arg>
+
+    </cmdsynopsis>
+  </refsynopsisdiv>
+  <refsect1>
+    <title>DESCRIPTION</title>
+
+    <para>This manual page documents briefly the
+      <command>&dhpackage;</command> and <command>bar</command>
+      commands.</para>
+
+    <para>This manual page was written for the &debian; distribution
+      because the original program does not have a manual page.</para>
+
+    <para><command>&dhpackage;</command> is an automatic mesh
+   generation tool for two and three dimensions.  Netgen generates
+   triangular or quadrilateral meshes in 2D, and tetrahedral meshes in
+   3D.</para>
+
+    <para>The input for 2D is described by spline curves, and the
+   input for 3D problems is either defined by constructive solid
+   geometries, or by the standard STL file format.  Netgen contains
+   modules for mesh optimization and hierarchical mesh refinement.
+   Curved elements are supported of arbitrary order.</para>
+
+    <para>Homepage: http://www.hpfem.jku.at/netgen/</para>
+
+  </refsect1>
+
+  <refsect1>
+    <title>OPTIONS</title>
+
+    <variablelist>
+      <varlistentry>
+	<term><option>-geofile=filename</option>
+	</term>
+	<listitem>
+	  <para>Input geometry file (alternative:  netgen filename)</para>
+	</listitem>
+      </varlistentry>
+      
+      <varlistentry>
+	<term><option>-meshfile=filename</option>
+	</term>
+	<listitem>
+	  <para>Output mesh file</para>
+	</listitem>
+      </varlistentry>
+      
+      <varlistentry>
+	<term><option>-verycoarse</option>
+	  <option>-coarse</option>
+	  <option>-moderate</option>
+	  <option>-fine</option>
+	  <option>-veryfine</option>
+	</term>
+	<listitem>
+	  <para>Automatic mesh-size selection</para>
+	</listitem>
+      </varlistentry>
+      
+      <varlistentry>
+	    <term><option>--meshfiletype=type</option>
+	    </term>
+	    <listitem>
+	      <para>Filetype of output file, default is netgen file</para>
+	    </listitem>
+      </varlistentry>
+
+      </varlistentry>
+	  <varlistentry>
+	    <term><option>--batchmode</option>
+	    </term>
+	    <listitem>
+	      <para>Run in batchmode</para>
+	    </listitem>
+      </varlistentry>
+
+
+      <varlistentry>
+        <term><option>-V</option>
+        </term>
+        <listitem>
+	      <para>Print additional information</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+  </refsect1>
+
+
+  <refsect1>
+    <title>SEE ALSO</title>
+
+    <para>gmsh (1)</para>
+
+  </refsect1>
+  <refsect1>
+    <title>AUTHOR</title>
+
+    <para>This manual page was written by &dhusername; &dhemail; for
+      the &debian; system (but may be used by others).  Permission is
+      granted to copy, distribute and/or modify this document under
+      the terms of the &gnu; General Public License, Version 2 any 
+	  later version published by the Free Software Foundation.</prudhomm>
+    </para>
+	<para>
+	  On Debian systems, the complete text of the GNU General Public
+	  License can be found in /usr/share/common-licenses/GPL.
+	</para>
+
+  </refsect1>
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:2
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:nil
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+-->
+
+
--- netgen-4.4.orig/debian/compat
+++ netgen-4.4/debian/compat
@@ -0,0 +1 @@
+4
--- netgen-4.4.orig/debian/control
+++ netgen-4.4/debian/control
@@ -0,0 +1,61 @@
+Source: netgen
+Section: math
+Priority: optional
+Maintainer: Debian Scientific Computing Team <pkg-scicomp-devel@lists.alioth.debian.org>
+Uploaders: Christophe Prud'homme <prudhomm@debian.org>
+Build-Depends: quilt, cdbs, debhelper (>= 4.1.0), g++ (>= 4.0), tcl8.4-dev,
+ tk8.4-dev, tix-dev, docbook-to-man, libxmu-dev, xlibmesa-gl-dev, libglu1-xorg-dev
+Standards-Version: 3.7.3
+Vcs-Svn: svn://svn.debian.org/svn/pkg-scicomp/netgen/trunk/
+Vcs-Browser: http://svn.debian.org/wsvn/pkg-scicomp/netgen/
+Homepage: http://www.hpfem.jku.at/netgen/
+
+Package: netgen
+Architecture: any
+Depends: tix, tix-dev, ${shlibs:Depends}, ${misc:Depends}
+Description: Automatic 3d tetrahedral mesh generator
+ NETGEN is an automatic 3d tetrahedral mesh generator. It accepts
+ input from constructive solid geometry (CSG) or boundary
+ representation (BRep) from STL file format.  NETGEN contains modules
+ for mesh optimization and hierarchical mesh refinement.
+
+Package: netgen-doc
+Section: doc
+Architecture: all
+Suggests: netgen
+Description: Automatic 3d tetrahedral mesh generator documentation
+ NETGEN is an automatic 3d tetrahedral mesh generator. It accepts
+ input from constructive solid geometry (CSG) or boundary
+ representation (BRep) from STL file format.  NETGEN contains modules
+ for mesh optimization and hierarchical mesh refinement.
+ .
+ This package contains the user manual (in PDF format) and example
+ files.
+
+Package: libnetgen-dev
+Section: libdevel
+Architecture: any
+Depends: libnetgen4.4, ${shlibs:Depends}, ${misc:Depends}
+Description: Automatic 3d tetrahedral mesh generator development files
+ NETGEN is an automatic 3d tetrahedral mesh generator. It accepts
+ input from constructive solid geometry (CSG) or boundary
+ representation (BRep) from STL file format. The connection to a
+ geometry kernel allows the handling of IGES and STEP files. NETGEN
+ contains modules for mesh optimization and hierarchical mesh
+ refinement.
+ .
+ This package contains the static libraries and header files.
+
+Package: libnetgen4.4
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Automatic 3d tetrahedral mesh generator development files
+ NETGEN is an automatic 3d tetrahedral mesh generator. It accepts
+ input from constructive solid geometry (CSG) or boundary
+ representation (BRep) from STL file format. The connection to a
+ geometry kernel allows the handling of IGES and STEP files. NETGEN
+ contains modules for mesh optimization and hierarchical mesh
+ refinement.
+ .
+ This package contains the shared libraries.
--- netgen-4.4.orig/debian/libnetgen4.4.install
+++ netgen-4.4/debian/libnetgen4.4.install
@@ -0,0 +1 @@
+lib/LINUX/*.so.* /usr/lib/
--- netgen-4.4.orig/debian/libnetgen-dev.install
+++ netgen-4.4/debian/libnetgen-dev.install
@@ -0,0 +1,2 @@
+lib/LINUX/*.a /usr/lib
+lib/LINUX/*.so /usr/lib
--- netgen-4.4.orig/debian/netgen.install
+++ netgen-4.4/debian/netgen.install
@@ -0,0 +1,6 @@
+debian/netgen.1 /usr/share/man/man1
+ng.tcl /usr/share/netgen
+startup.tcl /usr/share/netgen
+ngtcltk/*.tcl /usr/share/netgen/ngtcltk
+ngsolve/*.tcl /usr/share/netgen/ngsolve
+demoapp/*.tcl /usr/share/netgen/demoapp
--- netgen-4.4.orig/debian/dirs
+++ netgen-4.4/debian/dirs
@@ -0,0 +1 @@
+usr/bin
--- netgen-4.4.orig/debian/netgen-doc.examples
+++ netgen-4.4/debian/netgen-doc.examples
@@ -0,0 +1 @@
+tutorials/* 
--- netgen-4.4.orig/debian/patches/series
+++ netgen-4.4/debian/patches/series
@@ -0,0 +1,4 @@
+netgen-nglib.patch
+netgen-shlibs.patch
+stdlib.patch
+netgen-missing-symbols.patch
--- netgen-4.4.orig/debian/patches/netgen-missing-symbols.patch
+++ netgen-4.4/debian/patches/netgen-missing-symbols.patch
@@ -0,0 +1,43 @@
+--- netgen-4.4/libsrc/interface/nglib.cpp~	2004-07-02 21:20:09.000000000 +0000
++++ netgen-4.4/libsrc/interface/nglib.cpp	2008-04-10 17:40:26.000000000 +0000
+@@ -24,10 +24,18 @@
+ 
+ // #include <FlexLexer.h>
+ 
++#include <tcl.h>
++#include <incvis.hpp>
++
+ namespace netgen {
+   extern void MeshFromSpline2D (SplineGeometry2d & geometry,
+ 				Mesh *& mesh, 
+ 				MeshingParameters & mp);
++#include "../visualization/mvdraw.hpp"
++#include "../visualization/soldata.hpp"
++#include "../visualization/vssolution.hpp"
++  Tcl_Interp * tcl_interp;
++  VisualSceneSolution vssolution;
+ }
+ 
+ 
+--- netgen-4.4/libsrc/visualization/vssolution.cpp~	2004-11-10 13:22:09.000000000 +0000
++++ netgen-4.4/libsrc/visualization/vssolution.cpp	2008-04-10 17:41:56.000000000 +0000
+@@ -16,6 +16,19 @@
+   extern AutoPtr<Mesh> mesh;
+ 
+ 
++  SYMBOLTABLE<VisualScene*> & GetVisualizationScenes ()
++  {
++    static SYMBOLTABLE<VisualScene*> vss;
++    return vss;
++  }
++
++  void AddVisualizationScene (const string & name,
++			      VisualScene * vs)
++  {
++    GetVisualizationScenes().Set (name.c_str(), vs);
++  }
++
++
+   VisualSceneSolution :: SolData :: SolData ()
+     : name (0), data (0), solclass(0)
+   { ; }
--- netgen-4.4.orig/debian/patches/netgen-nglib.patch
+++ netgen-4.4/debian/patches/netgen-nglib.patch
@@ -0,0 +1,8 @@
+--- netgen-4.4/libsrc/interface/Makefile~	2004-07-06 13:10:58.000000000 +0000
++++ netgen-4.4/libsrc/interface/Makefile	2008-01-21 01:52:32.000000000 +0000
+@@ -1,4 +1,4 @@
+-src = nginterface.cpp writeuser.cpp writediffpack.cpp writeabaqus.cpp writefluent.cpp writepermas.cpp writetochnog.cpp writetecplot.cpp wuchemnitz.cpp writetochnog.cpp writefeap.cpp writeelmer.cpp  writegmsh.cpp readuser.cpp importsolution.cpp 
++src = nglib.cpp nginterface.cpp writeuser.cpp writediffpack.cpp writeabaqus.cpp writefluent.cpp writepermas.cpp writetochnog.cpp writetecplot.cpp wuchemnitz.cpp writetochnog.cpp writefeap.cpp writeelmer.cpp  writegmsh.cpp readuser.cpp importsolution.cpp 
+ #
+ lib = nginterface
+ libpath = libsrc/interface
--- netgen-4.4.orig/debian/patches/netgen-shlibs.patch
+++ netgen-4.4/debian/patches/netgen-shlibs.patch
@@ -0,0 +1,300 @@
+Index: netgen/libsrc/makefile.inc
+===================================================================
+--- netgen.orig/libsrc/makefile.inc	2008-04-07 13:26:00.000000000 +0200
++++ netgen/libsrc/makefile.inc	2008-04-09 08:28:53.000000000 +0200
+@@ -18,23 +18,34 @@
+ #
+ ARFLAGS = r
+ #
++LIBA=lib$(lib).so
+ LIBB=$(LIB_DIR)/lib$(lib).a
+ #
+ .PRECIOUS: .cpp .c
+-.SUFFIXES: .cpp .c .o 
++.SUFFIXES: .cpp .c .o .lo
+ #
+ .cpp.o:
+ 	$(CPLUSPLUS) $(CPLUSPLUSFLAGS1) $(CPLUSPLUSFLAGS2) $(CPLUSPLUSFLAGSLIBRARY) $<
+ .c.o:
+ 	$(CPLUSPLUS) $(CPLUSPLUSFLAGS1) $(CPLUSPLUSFLAGS2) $(CPLUSPLUSFLAGSLIBRARY) $<
++.cpp.lo:
++	$(CPLUSPLUS) $(CPLUSPLUSFLAGS1) $(CPLUSPLUSFLAGS2) $(CPLUSPLUSFLAGSLIBRARY) -fPIC -DPIC $< -o $@
++
++all: $(LIBA) $(LIBB)
++	
+ #
+ #
++$(LIBA):: $(LIB_DIR) 
+ $(LIBB):: $(LIB_DIR) 
+ #
+ # make lib from sources:
+ #
+-$(LIBB):: $(src) 
+-	$(CPLUSPLUS) $(CPLUSPLUSFLAGS1) $(CPLUSPLUSFLAGS2) $(CPLUSPLUSFLAGSLIBRARY)  $?
++$(LIBA):: $(src:%.cpp=%.lo)
++	$(CPLUSPLUS) -shared -ltcl8.4 -lpthread -lGL -lstdc++ -lm -o $(LIB_DIR)/$@.4.4 *.lo -Wl,-soname,$@.4.4
++	ln -sf $@.4.4 $(LIB_DIR)/$@.4
++	ln -sf $@.4.4 $(LIB_DIR)/$@
++
++$(LIBB):: $(src:%.cpp=%.o)
+ 	@$(AR) $(ARFLAGS) $@ *.o
+ 	-@$(RM) *.o
+ 	-@$(RANLIB) $@
+Index: netgen/libsrc/linalg/Makefile
+===================================================================
+--- netgen.orig/libsrc/linalg/Makefile	2008-04-07 13:26:00.000000000 +0200
++++ netgen/libsrc/linalg/Makefile	2008-04-09 08:28:53.000000000 +0200
+@@ -3,7 +3,7 @@
+ #
+ src = basemat.cpp densemat.cpp vector.cpp sparsmat.cpp polynomial.cpp
+ #
+-lib = la
++lib = netgen_linalg
+ libpath = libsrc/linalg
+ #
+ #
+Index: netgen/libsrc/general/Makefile
+===================================================================
+--- netgen.orig/libsrc/general/Makefile	2008-04-07 13:26:00.000000000 +0200
++++ netgen/libsrc/general/Makefile	2008-04-09 08:28:53.000000000 +0200
+@@ -5,7 +5,7 @@
+ 	spbita2d.cpp seti.cpp optmem.cpp sort.cpp mystring.cpp parthreads.cpp \
+ 	moveablemem.cpp dynamicmem.cpp ngexception.cpp
+ #	
+-lib = gen
++lib = netgen_general
+ libpath = libsrc/general
+ #
+ include ../makefile.inc
+Index: netgen/libsrc/gprim/Makefile
+===================================================================
+--- netgen.orig/libsrc/gprim/Makefile	2008-04-07 13:26:00.000000000 +0200
++++ netgen/libsrc/gprim/Makefile	2008-04-09 08:28:53.000000000 +0200
+@@ -6,7 +6,7 @@
+ 
+ # reftrans.cpp rot3d.cpp
+ #
+-lib = gprim
++lib = netgen_gprim
+ libpath = libsrc/gprim
+ #
+ #
+Index: netgen/libsrc/csg/Makefile
+===================================================================
+--- netgen.orig/libsrc/csg/Makefile	2008-04-07 13:26:00.000000000 +0200
++++ netgen/libsrc/csg/Makefile	2008-04-09 08:28:53.000000000 +0200
+@@ -10,7 +10,7 @@
+ #
+ #  lex.yy.cpp geometry.cpp
+ # 
+-lib = csg
++lib = netgen_csg
+ libpath = libsrc/csg
+ #
+ #
+Index: netgen/libsrc/geom2d/Makefile
+===================================================================
+--- netgen.orig/libsrc/geom2d/Makefile	2008-04-07 13:26:00.000000000 +0200
++++ netgen/libsrc/geom2d/Makefile	2008-04-09 08:28:53.000000000 +0200
+@@ -3,7 +3,7 @@
+ #
+ src =  spline2d.cpp geom2dmesh.cpp splinegeometry2.cpp genmesh2d.cpp
+ #
+-lib = geom2d
++lib = netgen_geom2d
+ libpath = libsrc/geom2d
+ #
+ #
+Index: netgen/libsrc/stlgeom/Makefile
+===================================================================
+--- netgen.orig/libsrc/stlgeom/Makefile	2008-04-07 13:26:00.000000000 +0200
++++ netgen/libsrc/stlgeom/Makefile	2008-04-09 08:28:53.000000000 +0200
+@@ -3,7 +3,7 @@
+ #
+ src = stlgeom.cpp stltopology.cpp stlgeomchart.cpp stlgeommesh.cpp meshstlsurface.cpp stlline.cpp stltool.cpp
+ #
+-lib = stlgeom
++lib = netgen_stlgeom
+ libpath = libsrc/stlgeom 
+ #
+ #
+Index: netgen/libsrc/occ/Makefile
+===================================================================
+--- netgen.orig/libsrc/occ/Makefile	2008-04-07 13:26:00.000000000 +0200
++++ netgen/libsrc/occ/Makefile	2008-04-09 08:28:53.000000000 +0200
+@@ -3,7 +3,7 @@
+ #
+ src =  occgeom.cpp occmeshsurf.cpp occgenmesh.cpp
+ 
+-lib = occ
++lib = netgen_occ
+ libpath = libsrc/occ
+ #
+ #
+Index: netgen/libsrc/meshing/Makefile
+===================================================================
+--- netgen.orig/libsrc/meshing/Makefile	2008-04-07 13:26:00.000000000 +0200
++++ netgen/libsrc/meshing/Makefile	2008-04-09 08:28:53.000000000 +0200
+@@ -9,7 +9,7 @@
+ 	boundarylayer.cpp specials.cpp msghandler.cpp \
+ 	pyramidrls.cpp pyramid2rls.cpp prism2rls.cpp curvedelems.cpp curvedelems2.cpp
+ #
+-lib = mesh
++lib = netgen_meshing
+ libpath = libsrc/meshing
+ #
+ include ../makefile.inc
+Index: netgen/libsrc/opti/Makefile
+===================================================================
+--- netgen.orig/libsrc/opti/Makefile	2008-04-07 13:26:00.000000000 +0200
++++ netgen/libsrc/opti/Makefile	2008-04-09 08:28:53.000000000 +0200
+@@ -3,7 +3,7 @@
+ #
+ src = bfgs.cpp linsearch.cpp linopt.cpp 
+ #
+-lib = opti
++lib = netgen_opti
+ libpath = libsrc/opti
+ #
+ #
+Index: netgen/libsrc/visualization/Makefile
+===================================================================
+--- netgen.orig/libsrc/visualization/Makefile	2008-04-07 13:26:00.000000000 +0200
++++ netgen/libsrc/visualization/Makefile	2008-04-09 08:28:53.000000000 +0200
+@@ -3,7 +3,7 @@
+ #
+ src = stlmeshing.cpp mvdraw.cpp vscsg.cpp vsmesh.cpp vsocc.cpp vssolution.cpp meshdoc.cpp
+ #
+-lib = vis
++lib = netgen_visualization
+ libpath = libsrc/visualization
+ #
+ #
+Index: netgen/libsrc/interface/Makefile
+===================================================================
+--- netgen.orig/libsrc/interface/Makefile	2008-04-09 08:28:51.000000000 +0200
++++ netgen/libsrc/interface/Makefile	2008-04-09 08:28:53.000000000 +0200
+@@ -1,6 +1,6 @@
+ src = nglib.cpp nginterface.cpp writeuser.cpp writediffpack.cpp writeabaqus.cpp writefluent.cpp writepermas.cpp writetochnog.cpp writetecplot.cpp wuchemnitz.cpp writetochnog.cpp writefeap.cpp writeelmer.cpp  writegmsh.cpp readuser.cpp importsolution.cpp 
+ #
+-lib = nginterface
++lib = netgen_interface
+ libpath = libsrc/interface
+ #
+ include ../makefile.inc
+Index: netgen/ngsolve/Makefile
+===================================================================
+--- netgen.orig/ngsolve/Makefile	2008-04-07 13:26:00.000000000 +0200
++++ netgen/ngsolve/Makefile	2008-04-09 08:28:53.000000000 +0200
+@@ -64,8 +64,10 @@
+ #
+ #
+ #
+-lib = ../lib/$(MACHINE)/libngsolve.a
+-lib2 = ../lib/$(MACHINE)/libngsolvebasic.a
++lib = ../lib/$(MACHINE)/libnetgen_solve.a
++slib = libnetgen_solve.so
++lib2 = ../lib/$(MACHINE)/libnetgen_solvebasic.a
++slib2 = libnetgen_solvebasic.so
+ libold = ../lib/$(MACHINE)/libngsolve_oldla.a
+ #
+ #
+@@ -74,7 +76,7 @@
+ #
+ #
+ # .PRECIOUS: .cpp .hh 
+-# .SUFFIXES: .cpp .o 
++.SUFFIXES: .cpp .o .lo
+ #
+ # .cpp.o:
+ #	$(CPLUSPLUS) -c $<
+@@ -84,22 +86,35 @@
+ #
+ # make lib from sources:
+ # 
+-goal:	$(lib) $(lib2)
++goal:	$(lib) $(lib2) ../lib/$(MACHINE)/$(slib) ../lib/$(MACHINE)/$(slib2)
+ #
+ pebblesinc = -I../../pebbles_old/libsrc/setup -I../../pebbles_old/libsrc/solver -I../../pebbles_old/libsrc/prepro -I../../pebbles_old/libsrc/parallel -I../../pebbles_old/libsrc
+ # 
++.cpp.lo:
++	$(CPLUSPLUS) -c -I. -I../libsrc -I../libsrc/include -I../libsrc/interface -Iinclude $(pebblesinc) $(CPLUSPLUSFLAGS2) -DNETGEN_ELTRANS -fPIC -DPIC $< -o $@
++
+ $(lib):: $(src)
+ 	$(CPLUSPLUS) -c -I. -I../libsrc -I../libsrc/include -I../libsrc/interface -Iinclude $(pebblesinc) $(CPLUSPLUSFLAGS2) -DNETGEN_ELTRANS $? 
+ 	$(AR) $(ARFLAGS) $@ *.o
+ 	mv *.o ../lib/$(MACHINE)
+ 	-$(RM) *.o
+ 	-@$(RANLIB) $@
+-#
++
++../lib/$(MACHINE)/$(slib):: $(src:%.cpp=%.lo)
++	$(CPLUSPLUS) -shared -ltcl8.4 -lpthread -lm -lstdc++ -o ../lib/$(MACHINE)/$(slib).4.4 $^ -Wl,-soname,$(slib).4.4
++	ln -sf $(slib).4.4 $@.4
++	ln -sf $(slib).4.4 $@
++
+ $(lib2):: $(src2) 
+ 	$(CPLUSPLUS) -c -I. -I../libsrc/interface -Iinclude $(CPLUSPLUSFLAGS2) $?
+ 	$(AR) $(ARFLAGS) $@ *.o
+ 	-$(RM) *.o
+ 	-@$(RANLIB) $@
++
++../lib/$(MACHINE)/$(slib2):: $(src2:%.cpp=%.lo)
++	$(CPLUSPLUS) -shared -lm -lstdc++ -o ../lib/$(MACHINE)/$(slib2).4.4 $^ -Wl,-soname,$(slib2).4.4
++	ln -sf $(slib2).4.4 $@.4
++	ln -sf $(slib2).4.4 $@
+ #
+ #
+ #
+Index: netgen/Makefile
+===================================================================
+--- netgen.orig/Makefile	2008-04-07 13:26:00.000000000 +0200
++++ netgen/Makefile	2008-04-09 08:28:53.000000000 +0200
+@@ -14,8 +14,8 @@
+ #
+ #
+ #
+-mylib =  -lnginterface -lvis -lcsg -lstlgeom -lgeom2d -lmesh -lgprim -lopti \
+-	 -lla -lgen  -locc
++mylib =  -lnetgen_interface -lnetgen_visualization -lnetgen_csg -lnetgen_stlgeom -lnetgen_geom2d -lnetgen_meshing -lnetgen_gprim -lnetgen_opti \
++	 -lnetgen_linalg -lnetgen_general  -lnetgen_occ
+ #
+ #
+ # system libraries:
+Index: netgen/libsrc/makefile.mach.LINUX
+===================================================================
+--- netgen.orig/libsrc/makefile.mach.LINUX	2008-04-07 13:26:00.000000000 +0200
++++ netgen/libsrc/makefile.mach.LINUX	2008-04-09 08:29:33.000000000 +0200
+@@ -4,10 +4,7 @@
+ #
+ # CC=/opt/gcc-dev/bin/gcc 
+ # CC=/usr/local/bin/gcc
+-CC=gcc
+-CPLUSPLUS=$(CC)
+ AR=ar
+-LINK=$(CC)
+ MAKE=make
+ RM=rm
+ RANLIB=ranlib
+@@ -16,12 +13,9 @@
+ #
+ CFLAGS2 =
+ 
+-CPLUSPLUSFLAGS2 = -O2 -I/usr/include/GL -I/usr/include/tcl8.4 -I/usr/include/tk8.4 -I/usr/X11R6/include  \
+-        -DLINUX -DOPENGL \
+-	-finline-limit=20000 \
+-	-funroll-loops  -DNGSOLVE
++CPLUSPLUSFLAGS2 = -O2 -I/usr/include/GL -I/usr/include/tcl8.4 -I/usr/include/tk8.4 -I/usr/X11R6/include  -DLINUX -DOPENGL -DNGSOLVE
+ 
+-LINKFLAGS2 =   -L/usr/openwin/lib -L/usr/X11R6/lib -L/usr/lib/GL3.5 -lstdc++ 
++LINKFLAGS2 =  
+ 
+ ifdef WITH_OCC
+ OCC_DIR=/opt/OpenCASCADE5.2
+@@ -36,4 +30,4 @@
+ # lapack =  -llapack  -lblas -lgmp -lg2c
+ 
+ 
+-appngs =  lib/$(MACHINE)/*.o -lngsolvebasic
+\ No newline at end of file
++appngs =  lib/$(MACHINE)/*.o -lnetgen_solvebasic
--- netgen-4.4.orig/debian/patches/stdlib.patch
+++ netgen-4.4/debian/patches/stdlib.patch
@@ -0,0 +1,95 @@
+Index: netgen/libsrc/include/mystdlib.h
+===================================================================
+--- netgen.orig/libsrc/include/mystdlib.h	2008-04-07 10:33:54.000000000 +0200
++++ netgen/libsrc/include/mystdlib.h	2008-04-07 10:38:23.000000000 +0200
+@@ -6,6 +6,7 @@
+ #include <iomanip>
+ #include <fstream>
+ #include <sstream>
++#include <cstring>
+ 
+ #ifdef OLDCINCLUDE
+ 
+Index: netgen/ngsolve/ngstd/array.hpp
+===================================================================
+--- netgen.orig/ngsolve/ngstd/array.hpp	2008-04-07 10:33:54.000000000 +0200
++++ netgen/ngsolve/ngstd/array.hpp	2008-04-07 10:39:49.000000000 +0200
+@@ -7,6 +7,7 @@
+ /* Date:   01. Jun. 95                                                    */
+ /**************************************************************************/
+ 
++#include <string.h>
+ 
+ /**
+    Exception thrown by array range check.
+@@ -291,7 +292,7 @@
+ 	T * p = new T[nsize];
+ 	
+ 	int mins = (nsize < this->size) ? nsize : this->size; 
+-	memcpy (p, this->data, mins * sizeof(T));
++	std::memcpy (p, this->data, mins * sizeof(T));
+ 
+ 	if (ownmem)
+ 	  delete [] this->data;
+Index: netgen/ngsolve/linalg/basevector.cpp
+===================================================================
+--- netgen.orig/ngsolve/linalg/basevector.cpp	2008-04-07 10:33:55.000000000 +0200
++++ netgen/ngsolve/linalg/basevector.cpp	2008-04-07 10:39:13.000000000 +0200
+@@ -9,6 +9,7 @@
+ */
+ 
+ #include <la.hpp>
++#include <cstdlib>
+ namespace ngla
+ {
+   using namespace ngla;
+@@ -146,7 +147,7 @@
+   {
+     FlatVector<double> fv = FVDouble();
+     for (int i = 0; i < fv.Size(); i++)
+-      fv(i) = double (rand()) / RAND_MAX;
++      fv(i) = double (std::rand()) / RAND_MAX;
+   }
+   
+   
+Index: netgen/ngsolve/ngstd/flags.cpp
+===================================================================
+--- netgen.orig/ngsolve/ngstd/flags.cpp	2008-04-07 10:33:55.000000000 +0200
++++ netgen/ngsolve/ngstd/flags.cpp	2008-04-07 10:38:23.000000000 +0200
+@@ -5,7 +5,8 @@
+ /**************************************************************************/
+ 
+ #include <ngstd.hpp>
+-
++#include <string.h>
++#include <stdlib.h>
+ namespace ngstd
+ {
+   using namespace ngstd;
+Index: netgen/ngsolve/linalg/blockjacobi.cpp
+===================================================================
+--- netgen.orig/ngsolve/linalg/blockjacobi.cpp	2006-04-07 09:27:13.000000000 +0200
++++ netgen/ngsolve/linalg/blockjacobi.cpp	2008-04-07 10:38:23.000000000 +0200
+@@ -7,7 +7,7 @@
+ 
+ 
+ #include <la.hpp>
+-
++#include <stdlib.h>
+ namespace ngla
+ {
+   using namespace ngla;
+Index: netgen/ngsolve/ngstd/ngstd.hpp
+===================================================================
+--- netgen.orig/ngsolve/ngstd/ngstd.hpp	2008-04-07 10:38:37.000000000 +0200
++++ netgen/ngsolve/ngstd/ngstd.hpp	2008-04-07 10:38:54.000000000 +0200
+@@ -1,6 +1,9 @@
+ #ifndef FILE_NGSTD
+ #define FILE_NGSTD
+ 
++#include <cstring>
++#include <cstdlib>
++
+ /*********************************************************************/
+ /* File:   ngstd.hpp                                                 */
+ /* Author: Joachim Schoeberl                                         */
