diff --git a/pkgs/development/libraries/lesstif-0.93/c-bad_integer_cast.patch b/pkgs/development/libraries/lesstif-0.93/c-bad_integer_cast.patch new file mode 100644 index 000000000000..620d702f0f03 --- /dev/null +++ b/pkgs/development/libraries/lesstif-0.93/c-bad_integer_cast.patch @@ -0,0 +1,13 @@ +--- lesstif2-0.94.4.orig/include/Motif-2.1/XmI/XpmI.h ++++ lesstif2-0.94.4/include/Motif-2.1/XmI/XpmI.h +@@ -217,8 +217,8 @@ + FUNC(xpmHashSlot, xpmHashAtom *, (xpmHashTable *table, char *s)); + FUNC(xpmHashIntern, int, (xpmHashTable *table, char *tag, void *data)); + +-#define HashAtomData(i) ((void *)i) +-#define HashColorIndex(slot) ((unsigned int)((*slot)->data)) ++#define HashAtomData(i) ((void *)(uintptr_t)i) ++#define HashColorIndex(slot) ((uintptr_t)((*slot)->data)) + #define USE_HASHTABLE (cpp > 2 && ncolors > 4) + + /* I/O utility */ diff --git a/pkgs/development/libraries/lesstif-0.93/c-render_table_crash.patch b/pkgs/development/libraries/lesstif-0.93/c-render_table_crash.patch new file mode 100644 index 000000000000..1699dbe19084 --- /dev/null +++ b/pkgs/development/libraries/lesstif-0.93/c-render_table_crash.patch @@ -0,0 +1,11 @@ +--- lesstif2-0.95.0.orig/lib/Xm-2.1/RenderTable.c ++++ lesstif2-0.95.0/lib/Xm-2.1/RenderTable.c +@@ -465,7 +465,7 @@ + DEBUGOUT(_LtDebug(__FILE__, w, "_XmRenderTableFinaliseTag(%s)\n", tag)); + #if 1 + /* Experimental start */ +- if (r->dpy == 0) ++ if (r->dpy == 0 && w) + r->dpy = XtDisplay(w); + /* Experimental end */ + #endif diff --git a/pkgs/development/libraries/lesstif-0.93/c-xim_chained_list_crash.patch b/pkgs/development/libraries/lesstif-0.93/c-xim_chained_list_crash.patch new file mode 100644 index 000000000000..10bdf8d0b973 --- /dev/null +++ b/pkgs/development/libraries/lesstif-0.93/c-xim_chained_list_crash.patch @@ -0,0 +1,24 @@ +diff -ru lesstif2-0.94.4-old/lib/Xm-2.1/XmIm.c lesstif2-0.94.4/lib/Xm-2.1/XmIm.c +--- lesstif2-0.94.4-old/lib/Xm-2.1/XmIm.c 2004-10-20 21:32:11.000000000 +0200 ++++ lesstif2-0.94.4/lib/Xm-2.1/XmIm.c 2007-03-28 14:39:27.000000000 +0200 +@@ -133,7 +133,10 @@ + p->next = q->next; + } + +- XtFree((char *)stuff); ++ /* if count!=0 then someone uses the stuff as orig_xim ++ so unlink it but not free it */ ++ if (!stuff->count) ++ XtFree((char *)stuff); + } + + /* +@@ -1060,6 +1063,8 @@ + XCloseIM(stuff->xim); + DEBUGOUT(_LtDebug(__FILE__, w, "XCloseIM(%p)\n", stuff->xim)); + stuff->orig_xim->xim = NULL; ++ /* stuff->orig_xim is now useless */ ++ XtFree(stuff->orig_xim); + } else { + DEBUGOUT(_LtDebug(__FILE__, w, "XmImCloseXIM(%p), count -> %d\n", + stuff->xim, stuff->orig_xim->count)); diff --git a/pkgs/development/libraries/lesstif-0.93/default.nix b/pkgs/development/libraries/lesstif-0.93/default.nix new file mode 100644 index 000000000000..3e452cf81c4a --- /dev/null +++ b/pkgs/development/libraries/lesstif-0.93/default.nix @@ -0,0 +1,24 @@ +args: with args ; + + +stdenv.mkDerivation { + name = "lesstif-0.93.94"; + src = fetchurl { + url = http://prdownloads.sourceforge.net/lesstif/lesstif-0.93.94.tar.bz2; + sha256 = "0v4l46ill6dhhswsw1hk6rqyng98d85nsr214vhd2k0mfajpig1y"; + }; + buildInputs = [x11]; + propagatedBuildInputs = [libXp libXau]; + + # This is an older release of lesstif which works with arb. + # + patches = [ + ./c-bad_integer_cast.patch + ./c-xim_chained_list_crash.patch + ./c-render_table_crash.patch + ./stdint.patch + ]; + meta = { + priority = "5"; + }; +} diff --git a/pkgs/development/libraries/lesstif-0.93/stdint.patch b/pkgs/development/libraries/lesstif-0.93/stdint.patch new file mode 100644 index 000000000000..8b202704abdb --- /dev/null +++ b/pkgs/development/libraries/lesstif-0.93/stdint.patch @@ -0,0 +1,11 @@ +diff -r 97ac365bfcd6 lesstif-0.93.94/lib/Xm-2.1/Xpm.c +--- lesstif-0.93.94/lib/Xm-2.1/Xpm.c Mon Oct 06 15:52:50 2008 +0200 ++++ lesstif-0.93.94/lib/Xm-2.1/Xpm.c Mon Oct 06 15:53:16 2008 +0200 +@@ -54,6 +54,7 @@ + #include + #endif + ++#include + #include /* Avoid re-definition of Pixel-type */ + + #include diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e5e4bab3ea49..2d14cd4fc601 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3008,6 +3008,11 @@ let inherit (xlibs) libXp libXau; }; + lesstif93 = import ../development/libraries/lesstif-0.93 { + inherit fetchurl stdenv x11; + inherit (xlibs) libXp libXau; + }; + lib3ds = import ../development/libraries/lib3ds { inherit fetchurl stdenv unzip; }; @@ -7346,10 +7351,10 @@ let ### SCIENCE/BIOLOGY arb = import ../applications/science/biology/arb { - inherit fetchurl stdenv readline libpng zlib x11 lesstif freeglut perl; + inherit fetchurl stdenv readline libpng zlib x11 lesstif93 freeglut perl; inherit (xlibs) libXpm libXaw libX11 libXext libXt; - # motif = lesstif; inherit mesa glew libtiff lynx rxp sablotron jdk xfig transfig gv gnuplot; + lesstif = lesstif93; }; biolib = import ../development/libraries/science/biology/biolib {