summary refs log tree commit diff
path: root/pkgs/development/libraries
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2019-08-17 09:39:23 +0200
committerFrederik Rietdijk <fridh@fridh.nl>2019-08-17 09:39:23 +0200
commitfe9a3e3e63fa59c8014d454b0efd3231bdd19350 (patch)
tree3546e83902366b34599e8d5f6a698e37935a104d /pkgs/development/libraries
parented3cb39bfa7234e5bbf2b50ce6f658ef5fda686a (diff)
parentc68f58d95c0e34d91ff3e4f08464954fd0e9e466 (diff)
downloadnixpkgs-fe9a3e3e63fa59c8014d454b0efd3231bdd19350.tar
nixpkgs-fe9a3e3e63fa59c8014d454b0efd3231bdd19350.tar.gz
nixpkgs-fe9a3e3e63fa59c8014d454b0efd3231bdd19350.tar.bz2
nixpkgs-fe9a3e3e63fa59c8014d454b0efd3231bdd19350.tar.lz
nixpkgs-fe9a3e3e63fa59c8014d454b0efd3231bdd19350.tar.xz
nixpkgs-fe9a3e3e63fa59c8014d454b0efd3231bdd19350.tar.zst
nixpkgs-fe9a3e3e63fa59c8014d454b0efd3231bdd19350.zip
Merge staging-next into staging
Diffstat (limited to 'pkgs/development/libraries')
-rw-r--r--pkgs/development/libraries/crc32c/default.nix24
-rw-r--r--pkgs/development/libraries/cre2/default.nix6
-rw-r--r--pkgs/development/libraries/google-cloud-cpp/default.nix65
-rw-r--r--pkgs/development/libraries/hunspell/0001-Make-hunspell-look-in-XDG_DATA_DIRS-for-dictionaries.patch37
-rw-r--r--pkgs/development/libraries/hunspell/default.nix2
-rw-r--r--pkgs/development/libraries/hunspell/dictionaries.nix40
-rw-r--r--pkgs/development/libraries/libgphoto2/default.nix6
-rw-r--r--pkgs/development/libraries/qt-4.x/4.8/default.nix12
-rw-r--r--pkgs/development/libraries/qt-4.x/4.8/qt4-gcc6.patch33
-rw-r--r--pkgs/development/libraries/science/math/spooles/default.nix48
-rw-r--r--pkgs/development/libraries/science/math/spooles/spooles.patch188
11 files changed, 447 insertions, 14 deletions
diff --git a/pkgs/development/libraries/crc32c/default.nix b/pkgs/development/libraries/crc32c/default.nix
new file mode 100644
index 00000000000..916ec5b703b
--- /dev/null
+++ b/pkgs/development/libraries/crc32c/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, cmake, gflags }:
+stdenv.mkDerivation rec {
+  pname = "crc32c";
+  version = "1.1.0";
+
+  src = fetchFromGitHub {
+    owner = "google";
+    repo = "crc32c";
+    rev = version;
+    sha256 = "1sazkis9rzbrklfrvk7jn1mqywnq4yghmzg94mxd153h8b1sb149";
+    fetchSubmodules = true;
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ gflags ];
+  NIX_CFLAGS_COMPILE = stdenv.lib.optional stdenv.isAarch64 "-march=armv8-a+crc";
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/google/crc32c;
+    description = "CRC32C implementation with support for CPU-specific acceleration instructions";
+    license = with licenses; [ bsd3 ];
+    maintainers = with maintainers; [ andir ];
+  };
+}
diff --git a/pkgs/development/libraries/cre2/default.nix b/pkgs/development/libraries/cre2/default.nix
index a8c9233aebd..a4313fa94d3 100644
--- a/pkgs/development/libraries/cre2/default.nix
+++ b/pkgs/development/libraries/cre2/default.nix
@@ -4,12 +4,12 @@
 stdenv.mkDerivation rec {
   pname = "cre2";
   version = "0.3.0";
-    
+
   src = fetchFromGitHub {
     owner = "marcomaggi";
     repo = "cre2";
-    rev = version;
-    sha256 = "12yrdad87jjqrhbqm02hzsayan2402vf61a9x1b2iabv6d1c1bnj";
+    rev = "v${version}";
+    sha256 = "1h9jwn6z8kjf4agla85b5xf7gfkdwncp0mfd8zwk98jkm8y2qx9q";
   };
 
   nativeBuildInputs = [
diff --git a/pkgs/development/libraries/google-cloud-cpp/default.nix b/pkgs/development/libraries/google-cloud-cpp/default.nix
new file mode 100644
index 00000000000..7dd075e440e
--- /dev/null
+++ b/pkgs/development/libraries/google-cloud-cpp/default.nix
@@ -0,0 +1,65 @@
+{ stdenv, grpc, curl, cmake, pkgconfig, fetchFromGitHub, doxygen, protobuf, crc32c, c-ares, nlohmann_json, fetchurl }:
+let
+  googleapis_rev = "a8ee1416f4c588f2ab92da72e7c1f588c784d3e6";
+  googleapis = fetchurl {
+    name = "${googleapis_rev}.tar.gz";
+    url = "https://github.com/googleapis/googleapis/archive/${googleapis_rev}.tar.gz";
+    sha256 = "1kxi27r034p7jfldhvgpbn6rqqqddycnja47m6jyjxj4rcmrp2kb";
+  };
+in stdenv.mkDerivation rec {
+  pname = "google-cloud-cpp";
+  version = "0.11.0";
+
+  src = fetchFromGitHub {
+    owner = "googleapis";
+    repo = "google-cloud-cpp";
+    rev = "v${version}";
+    sha256 = "1w942gzyv01ym1cv2a417x92zxra9s2v3xz5crcv84j919f616f8";
+  };
+
+  buildInputs = [ curl grpc protobuf nlohmann_json crc32c c-ares c-ares.cmake-config ];
+  nativeBuildInputs = [ cmake pkgconfig doxygen ];
+
+  outputs = [ "out" "dev" ];
+
+  postPatch = ''
+    NLOHMANN_SHA256=$(sha256sum ${nlohmann_json}/include/nlohmann/json.hpp | cut -f1 -d' ')
+    sed -e 's,https://github.com/nlohmann/json/releases/download/.*,file://${nlohmann_json}/include/nlohmann/json.hpp"),' \
+        -e "s,JSON_SHA256 .*,JSON_SHA256 ''${NLOHMANN_SHA256}," \
+        -i cmake/DownloadNlohmannJson.cmake
+
+    sed -e 's,https://github.com/googleapis/googleapis/archive/${googleapis_rev}.tar.gz,file://${googleapis},' \
+        -i cmake/external/googleapis.cmake
+
+    # Fixup the library path. It would build a path like /build/external//nix/store/…-foo/lib/foo.so for each library instead of /build/external/lib64/foo.so
+    sed -e 's,''${CMAKE_INSTALL_LIBDIR},lib64,g' \
+        -e 's,;lib64,lib,g' \
+        -i cmake/ExternalProjectHelper.cmake
+  '';
+
+  preFixup = ''
+    mv --no-clobber $out/lib64/cmake/* $out/lib/cmake
+    mv --no-clobber $out/lib64/pkgconfig/* $out/lib/pkgconfig
+    rmdir $out/lib64/cmake $out/lib64/pkgconfig
+    find $out/lib64
+
+    for file in $out/lib/pkgconfig/*; do
+      sed -e 's,\''${prefix}//,/,g' -i $file
+    done
+  '';
+
+  cmakeFlags = [
+    "-DGOOGLE_CLOUD_CPP_BIGTABLE_ENABLE_INSTALL=no"
+    "-DGOOGLE_CLOUD_CPP_DEPENDENCY_PROVIDER=package"
+    "-DGOOGLE_CLOUD_CPP_GOOGLEAPIS_PROVIDER=external"
+    "-DBUILD_SHARED_LIBS:BOOL=ON"
+    "-DGOOGLE_CLOUD_CPP_INSTALL_RPATH=$(out)/lib"
+  ];
+
+  meta = with stdenv.lib; {
+    license = with licenses; [ asl20 ];
+    homepage = https://github.com/googleapis/google-cloud-cpp;
+    description = "C++ Idiomatic Clients for Google Cloud Platform services";
+    maintainers = with maintainers; [ andir ];
+  };
+}
diff --git a/pkgs/development/libraries/hunspell/0001-Make-hunspell-look-in-XDG_DATA_DIRS-for-dictionaries.patch b/pkgs/development/libraries/hunspell/0001-Make-hunspell-look-in-XDG_DATA_DIRS-for-dictionaries.patch
new file mode 100644
index 00000000000..4607f8b8ee0
--- /dev/null
+++ b/pkgs/development/libraries/hunspell/0001-Make-hunspell-look-in-XDG_DATA_DIRS-for-dictionaries.patch
@@ -0,0 +1,37 @@
+From 8c67f314de2684d77315eecd99ef091d441f17dd Mon Sep 17 00:00:00 2001
+From: Matthew Bauer <mjbauer95@gmail.com>
+Date: Wed, 24 Jul 2019 15:35:18 -0400
+Subject: [PATCH] Make hunspell look in XDG_DATA_DIRS for dictionaries
+
+Some dictionaries may exist but only show up under XDG_DATA_DIRS. For
+instance, $HOME/.local/share/hunspell could contain some dictionaries.
+
+This patch adds each directory in the hunspell subdir of each
+XDG_DATA_DIRS to the lookup path.
+
+Upstream pr is available at: https://github.com/hunspell/hunspell/pull/637
+---
+ src/tools/hunspell.cxx | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/src/tools/hunspell.cxx b/src/tools/hunspell.cxx
+index 690e34a..6cd127e 100644
+--- a/src/tools/hunspell.cxx
++++ b/src/tools/hunspell.cxx
+@@ -2044,6 +2044,13 @@ int main(int argc, char** argv) {
+     if (getenv("DICPATH")) {
+       path_std_str.append(getenv("DICPATH")).append(PATHSEP);
+     }
++    if (getenv("XDG_DATA_DIRS")) {
++      char* dir = strtok(getenv("XDG_DATA_DIRS"), ":");
++      while (dir != NULL) {
++        path_std_str.append(dir).append("/hunspell:");
++        dir = strtok(NULL, ":");
++      }
++    }
+     path_std_str.append(LIBDIR).append(PATHSEP);
+     if (HOME) {
+       const char * userooodir[] = USEROOODIR;
+-- 
+2.22.0
+
diff --git a/pkgs/development/libraries/hunspell/default.nix b/pkgs/development/libraries/hunspell/default.nix
index 00e8dc3d4db..a8dcea0059a 100644
--- a/pkgs/development/libraries/hunspell/default.nix
+++ b/pkgs/development/libraries/hunspell/default.nix
@@ -14,6 +14,8 @@ stdenv.mkDerivation rec {
   buildInputs = [ ncurses readline ];
   nativeBuildInputs = [ autoreconfHook ];
 
+  patches = [ ./0001-Make-hunspell-look-in-XDG_DATA_DIRS-for-dictionaries.patch ];
+
   postPatch = ''
     patchShebangs tests
   '';
diff --git a/pkgs/development/libraries/hunspell/dictionaries.nix b/pkgs/development/libraries/hunspell/dictionaries.nix
index b8de133f502..1c86830f258 100644
--- a/pkgs/development/libraries/hunspell/dictionaries.nix
+++ b/pkgs/development/libraries/hunspell/dictionaries.nix
@@ -286,10 +286,11 @@ let
       };
     };
 
-in {
+in rec {
 
   /* ENGLISH */
 
+  en_US = en-us;
   en-us = mkDictFromWordlist {
     shortName = "en-us";
     shortDescription = "English (United States)";
@@ -300,6 +301,7 @@ in {
     };
   };
 
+  en_CA = en-ca;
   en-ca = mkDictFromWordlist {
     shortName = "en-ca";
     shortDescription = "English (Canada)";
@@ -310,6 +312,7 @@ in {
     };
   };
 
+  en_GB-ise = en-gb-ise;
   en-gb-ise = mkDictFromWordlist {
     shortName = "en-gb-ise";
     shortDescription = "English (United Kingdom, 'ise' ending)";
@@ -320,6 +323,7 @@ in {
     };
   };
 
+  en_GB-ize = en-gb-ize;
   en-gb-ize = mkDictFromWordlist {
     shortName = "en-gb-ize";
     shortDescription = "English (United Kingdom, 'ize' ending)";
@@ -332,126 +336,147 @@ in {
 
   /* SPANISH */
 
+  es_ANY = es-any;
   es-any = mkDictFromRla {
     shortName = "es-any";
     shortDescription = "Spanish (any variant)";
     dictFileName = "es_ANY";
   };
 
+  es_AR = es-ar;
   es-ar = mkDictFromRla {
     shortName = "es-ar";
     shortDescription = "Spanish (Argentina)";
     dictFileName = "es_AR";
   };
 
+  es_BO = es-bo;
   es-bo = mkDictFromRla {
     shortName = "es-bo";
     shortDescription = "Spanish (Bolivia)";
     dictFileName = "es_BO";
   };
 
+  es_CL = es-cl;
   es-cl = mkDictFromRla {
     shortName = "es-cl";
     shortDescription = "Spanish (Chile)";
     dictFileName = "es_CL";
   };
 
+  es_CO = es-co;
   es-co = mkDictFromRla {
     shortName = "es-co";
     shortDescription = "Spanish (Colombia)";
     dictFileName = "es_CO";
   };
 
+  es_CR = es-cr;
   es-cr = mkDictFromRla {
     shortName = "es-cr";
     shortDescription = "Spanish (Costra Rica)";
     dictFileName = "es_CR";
   };
 
+  es_CU = es-cu;
   es-cu = mkDictFromRla {
     shortName = "es-cu";
     shortDescription = "Spanish (Cuba)";
     dictFileName = "es_CU";
   };
 
+  es_DO = es-do;
   es-do = mkDictFromRla {
     shortName = "es-do";
     shortDescription = "Spanish (Dominican Republic)";
     dictFileName = "es_DO";
   };
 
+  es_EC = es-ec;
   es-ec = mkDictFromRla {
     shortName = "es-ec";
     shortDescription = "Spanish (Ecuador)";
     dictFileName = "es_EC";
   };
 
+  es_ES = es-es;
   es-es = mkDictFromRla {
     shortName = "es-es";
     shortDescription = "Spanish (Spain)";
     dictFileName = "es_ES";
   };
 
+  es_GT = es-gt;
   es-gt = mkDictFromRla {
     shortName = "es-gt";
     shortDescription = "Spanish (Guatemala)";
     dictFileName = "es_GT";
   };
 
+  es_HN = es-hn;
   es-hn = mkDictFromRla {
     shortName = "es-hn";
     shortDescription = "Spanish (Honduras)";
     dictFileName = "es_HN";
   };
 
+  es_MX = es-mx;
   es-mx = mkDictFromRla {
     shortName = "es-mx";
     shortDescription = "Spanish (Mexico)";
     dictFileName = "es_MX";
   };
 
+  es_NI = es-ni;
   es-ni = mkDictFromRla {
     shortName = "es-ni";
     shortDescription = "Spanish (Nicaragua)";
     dictFileName = "es_NI";
   };
 
+  es_PA = es-pa;
   es-pa = mkDictFromRla {
     shortName = "es-pa";
     shortDescription = "Spanish (Panama)";
     dictFileName = "es_PA";
   };
 
+  es_PE = es-pe;
   es-pe = mkDictFromRla {
     shortName = "es-pe";
     shortDescription = "Spanish (Peru)";
     dictFileName = "es_PE";
   };
 
+  es_PR = es-pr;
   es-pr = mkDictFromRla {
     shortName = "es-pr";
     shortDescription = "Spanish (Puerto Rico)";
     dictFileName = "es_PR";
   };
 
+  es_PY = es-py;
   es-py = mkDictFromRla {
     shortName = "es-py";
     shortDescription = "Spanish (Paraguay)";
     dictFileName = "es_PY";
   };
 
+  es_SV = es-sv;
   es-sv = mkDictFromRla {
     shortName = "es-sv";
     shortDescription = "Spanish (El Salvador)";
     dictFileName = "es_SV";
   };
 
+  es_UY = es-uy;
   es-uy = mkDictFromRla {
     shortName = "es-uy";
     shortDescription = "Spanish (Uruguay)";
     dictFileName = "es_UY";
   };
 
+  es_VE = es-ve;
   es-ve = mkDictFromRla {
     shortName = "es-ve";
     shortDescription = "Spanish (Venezuela)";
@@ -505,6 +530,7 @@ in {
 
   /* ITALIAN */
 
+  it_IT = it-it;
   it-it =  mkDictFromLinguistico rec {
     shortName = "it-it";
     dictFileName = "it_IT";
@@ -517,6 +543,7 @@ in {
 
   /* BASQUE */
 
+  eu_ES = eu-es;
   eu-es = mkDictFromXuxen {
     shortName = "eu-es";
     dictFileName = "eu_ES";
@@ -549,6 +576,7 @@ in {
 
   /* HUNGARIAN */
 
+  hu_HU = hu-hu;
   hu-hu = mkDictFromLibreOffice {
     shortName = "hu-hu";
     dictFileName = "hu_HU";
@@ -557,7 +585,8 @@ in {
   };
 
   /* SWEDISH */
-  
+
+  sv_SE = sv-se;
   sv-se = mkDictFromDSSO rec {
     shortName = "sv-se";
     dictFileName = "sv_SE";
@@ -565,26 +594,30 @@ in {
   };
 
   # Finlandian Swedish (hello Linus Torvalds)
+  sv_FI = sv-fi;
   sv-fi = mkDictFromDSSO rec {
     shortName = "sv-fi";
     dictFileName = "sv_FI";
     shortDescription = "Swedish (Finland)";
   };
-  
+
   /* GERMAN */
 
+  de_DE = de-de;
   de-de = mkDictFromJ3e {
     shortName = "de-de";
     shortDescription = "German (Germany)";
     dictFileName = "de_DE";
   };
 
+  de_AT = de-at;
   de-at = mkDictFromJ3e {
     shortName = "de-at";
     shortDescription = "German (Austria)";
     dictFileName = "de_AT";
   };
 
+  de_CH = de-ch;
   de-ch = mkDictFromJ3e {
     shortName = "de-ch";
     shortDescription = "German (Switzerland)";
@@ -593,6 +626,7 @@ in {
 
   /* UKRAINIAN */
 
+  uk_UA = uk-ua;
   uk-ua = mkDict rec {
     name = "hunspell-dict-uk-ua-${version}";
     version = "4.2.5";
diff --git a/pkgs/development/libraries/libgphoto2/default.nix b/pkgs/development/libraries/libgphoto2/default.nix
index 8616a014675..cbedd97b2ee 100644
--- a/pkgs/development/libraries/libgphoto2/default.nix
+++ b/pkgs/development/libraries/libgphoto2/default.nix
@@ -7,7 +7,7 @@ stdenv.mkDerivation rec {
     owner = "gphoto";
     repo = "libgphoto2";
     rev = "${meta.tag}";
-    sha256 = "0pbfg89817qkb35mmajsw2iz6j9nhkkj67m419f8x8yxpqkaa0wb";
+    sha256 = "1sc2ycx11khf0qzp1cqxxx1qymv6bjfbkx3vvbwz6wnbyvsigxz2";
   };
 
   patches = [];
@@ -33,8 +33,8 @@ stdenv.mkDerivation rec {
       MTP, and other vendor specific protocols for controlling and transferring data
       from digital cameras.
     '';
-    version = "2.5.17";
-    tag = "libgphoto2-2_5_17-release";
+    version = "2.5.23";
+    tag = "libgphoto2-2_5_23-release";
     # XXX: the homepage claims LGPL, but several src files are lgpl21Plus
     license = stdenv.lib.licenses.lgpl21Plus;
     platforms = with stdenv.lib.platforms; unix;
diff --git a/pkgs/development/libraries/qt-4.x/4.8/default.nix b/pkgs/development/libraries/qt-4.x/4.8/default.nix
index de6457db98b..f833d130fbb 100644
--- a/pkgs/development/libraries/qt-4.x/4.8/default.nix
+++ b/pkgs/development/libraries/qt-4.x/4.8/default.nix
@@ -83,11 +83,13 @@ stdenv.mkDerivation rec {
           + "21b342d71c19e6d68b649947f913410fe6129ea4/debian/patches/kubuntu_39_fix_medium_font.diff";
         sha256 = "0bli44chn03c2y70w1n8l7ss4ya0b40jqqav8yxrykayi01yf95j";
       })
-      (fetchpatch {
-        name = "qt4-gcc6.patch";
-        url = "https://git.archlinux.org/svntogit/packages.git/plain/trunk/qt4-gcc6.patch?h=packages/qt4&id=ca773a144f5abb244ac4f2749eeee9333cac001f";
-        sha256 = "07lrva7bjh6i40p7b3ml26a2jlznri8bh7y7iyx5zmvb1gfxmj34";
-      })
+      # Patch is no longer available from here, so vendoring it for now.
+      #(fetchpatch {
+      #  name = "qt4-gcc6.patch";
+      #  url = "https://git.archlinux.org/svntogit/packages.git/plain/trunk/qt4-gcc6.patch?h=packages/qt4&id=ca773a144f5abb244ac4f2749eeee9333cac001f";
+      #  sha256 = "07lrva7bjh6i40p7b3ml26a2jlznri8bh7y7iyx5zmvb1gfxmj34";
+      #})
+      ./qt4-gcc6.patch
     ]
     ++ lib.optional gtkStyle (substituteAll ({
         src = ./dlopen-gtkstyle.diff;
diff --git a/pkgs/development/libraries/qt-4.x/4.8/qt4-gcc6.patch b/pkgs/development/libraries/qt-4.x/4.8/qt4-gcc6.patch
new file mode 100644
index 00000000000..000e345cf13
--- /dev/null
+++ b/pkgs/development/libraries/qt-4.x/4.8/qt4-gcc6.patch
@@ -0,0 +1,33 @@
+--- qt-everywhere-opensource-src-4.8.7/configure.gcc6	2016-04-15 07:04:19.430268222 -0500
++++ qt-everywhere-opensource-src-4.8.7/configure	2016-04-15 07:05:22.157568689 -0500
+@@ -7744,7 +7744,7 @@
+     *-g++*)
+ 	# Check gcc's version
+ 	case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
+-	    5*|4*|3.4*)
++	    8*|7*|6*|5*|4*|3.4*)
+ 		;;
+             3.3*)
+                 canBuildWebKit="no"
+@@ -8060,7 +8060,7 @@
+     3.*)
+         COMPILER_VERSION="3.*"
+         ;;
+-    5*|4.*)
++    8*|7*|6*|5*|4.*)
+         COMPILER_VERSION="4"
+         ;;
+     *)
+--- qt-everywhere-opensource-src-4.8.7/src/xmlpatterns/api/qcoloroutput_p.h.gcc6	2015-05-07 09:14:48.000000000 -0500
++++ qt-everywhere-opensource-src-4.8.7/src/xmlpatterns/api/qcoloroutput_p.h	2016-04-15 07:04:19.431268227 -0500
+@@ -70,8 +70,8 @@
+             ForegroundShift = 10,
+             BackgroundShift = 20,
+             SpecialShift    = 20,
+-            ForegroundMask  = ((1 << ForegroundShift) - 1) << ForegroundShift,
+-            BackgroundMask  = ((1 << BackgroundShift) - 1) << BackgroundShift
++            ForegroundMask  = 0x1f << ForegroundShift,
++            BackgroundMask  = 0x7 << BackgroundShift
+         };
+ 
+     public:
diff --git a/pkgs/development/libraries/science/math/spooles/default.nix b/pkgs/development/libraries/science/math/spooles/default.nix
new file mode 100644
index 00000000000..953f5a70b8a
--- /dev/null
+++ b/pkgs/development/libraries/science/math/spooles/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchurl, gfortran, perl }:
+
+stdenv.mkDerivation rec {
+  pname = "spooles";
+  version = "2.2";
+
+  src = fetchurl {
+    url = "http://www.netlib.org/linalg/spooles/spooles.${version}.tgz";
+    sha256 = "1pf5z3vvwd8smbpibyabprdvcmax0grzvx2y0liy98c7x6h5jid8";
+  };
+
+  sourceRoot = ".";
+
+  patches = [
+    ./spooles.patch
+  ];
+
+  buildPhase = ''
+    make lib
+  '';
+
+  installPhase = ''
+    mkdir -p $out/lib $out/include/spooles
+    cp libspooles.a libspooles.so.2.2 $out/lib/
+    ln -s libspooles.so.2.2 $out/lib/libspooles.so.2
+    ln -s libspooles.so.2 $out/lib/libspooles.so
+    for h in *.h; do
+      if [ $h != 'MPI.h' ]; then
+         cp $h $out/include/spooles
+         d=`basename $h .h`
+         if [ -d $d ]; then
+            mkdir $out/include/spooles/$d
+            cp $d/*.h $out/include/spooles/$d
+         fi
+      fi
+    done
+  '';
+
+  nativeBuildInputs = [ perl ];
+
+  meta = with stdenv.lib; {
+    homepage = "http://www.netlib.org/linalg/spooles/";
+    description = "Library for solving sparse real and complex linear systems of equations";
+    license = licenses.publicDomain;
+    maintainers = with maintainers; [ gebner ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/pkgs/development/libraries/science/math/spooles/spooles.patch b/pkgs/development/libraries/science/math/spooles/spooles.patch
new file mode 100644
index 00000000000..c0c93c9365c
--- /dev/null
+++ b/pkgs/development/libraries/science/math/spooles/spooles.patch
@@ -0,0 +1,188 @@
+diff --git a/I2Ohash/src/util.c b/I2Ohash/src/util.c
+index 72d082e..f32f667 100644
+--- a/I2Ohash/src/util.c
++++ b/I2Ohash/src/util.c
+@@ -39,9 +39,10 @@ fflush(stdout) ;
+ */
+ loc1 = (key1 + 1) % hashtable->nlist ;
+ loc2 = (key2 + 1) % hashtable->nlist ;
+-loc  = (loc1*loc2) % hashtable->nlist ;
++long int loc3  = (long int)loc1*(long int)loc2 % hashtable->nlist ;
++loc =(int) loc3;
+ #if MYDEBUG > 0
+-fprintf(stdout, "\n loc1 = %d, loc2 = %d, loc3 = %d", loc1, loc2, loc) ;
++fprintf(stdout, "\n loc1 = %d, loc2 = %d, loc3 = %ld, loc = %d", loc1, loc2, loc3, loc) ;
+ fflush(stdout) ;
+ #endif
+ /*
+@@ -158,9 +159,10 @@ fflush(stdout) ;
+ #endif
+ loc1 = (key1 + 1) % hashtable->nlist ;
+ loc2 = (key2 + 1) % hashtable->nlist ;
+-loc  = (loc1*loc2) % hashtable->nlist ;
++long int loc3  = (long int)loc1*(long int)loc2 % hashtable->nlist ;
++loc =(int) loc3;
+ #if MYDEBUG > 0
+-fprintf(stdout, "\n loc1 = %d, loc2 = %d, loc3 = %d", loc1, loc2, loc) ;
++fprintf(stdout, "\n loc1 = %d, loc2 = %d, loc3 = %ld, loc = %d", loc1, loc2, loc3, loc) ;
+ fflush(stdout) ;
+ #endif
+ /*
+diff --git a/MPI/makefile b/MPI/makefile
+index 0c09f86..d25e70a 100644
+--- a/MPI/makefile
++++ b/MPI/makefile
+@@ -2,7 +2,7 @@ all_drivers :
+ 	cd drivers ; make drivers
+ 
+ lib :
+-	cd src ; make spoolesMPI.a
++	cd src ; make makeLib
+ 
+ clean :
+ 	cd src ; make clean
+diff --git a/MPI/src/makefile b/MPI/src/makefile
+index f7650b7..71e4c49 100644
+--- a/MPI/src/makefile
++++ b/MPI/src/makefile
+@@ -42,3 +42,8 @@ $(OBJ).a : \
+ 
+ clean :
+ 	- rm -f *.a *.o
++
++makeLib :
++	perl ../../makeLib > makeG
++	make -f makeG
++	rm -f makeG
+diff --git a/MT/makefile b/MT/makefile
+index 9b86a32..d25e70a 100644
+--- a/MT/makefile
++++ b/MT/makefile
+@@ -2,7 +2,7 @@ all_drivers :
+ 	cd drivers ; make drivers
+ 
+ lib :
+-	cd src ; make spoolesMT.a
++	cd src ; make makeLib
+ 
+ clean :
+ 	cd src ; make clean
+diff --git a/Make.inc b/Make.inc
+index f99eb8f..2de8a25 100644
+--- a/Make.inc
++++ b/Make.inc
+@@ -12,7 +12,7 @@
+ # for solaris
+ #
+ # CC = gcc
+-  CC = /usr/lang-4.0/bin/cc
++#  CC = /usr/lang-4.0/bin/cc
+ #
+ # for sgi
+ #
+@@ -28,7 +28,7 @@
+ # 
+ # OPTLEVEL = 
+ # OPTLEVEL = -g -v
+-  OPTLEVEL = -O
++  OPTLEVEL = -O3
+ # OPTLEVEL = -xO5 -v
+ # OPTLEVEL = -O3
+ # OPTLEVEL = -O4
+@@ -43,7 +43,7 @@
+ #  set any load flags
+ #
+ #  LDFLAGS = -Wl,+parallel -Wl,+tm,spp2000 # for hp exemplar
+-   LDFLAGS =
++#   LDFLAGS =
+ #
+ #---------------------------------------------------------------------
+ #
+@@ -103,7 +103,7 @@
+ #  MPI install library
+ #
+ # MPI_INSTALL_DIR = 
+-  MPI_INSTALL_DIR = /usr/local/mpich-1.0.13
++#  MPI_INSTALL_DIR = /usr/lib/openmpi
+ #
+ #---------------------------------------------------------------------
+ #
+@@ -142,6 +142,6 @@
+ #  MPI include path
+ #
+ # MPI_INCLUDE_DIR = 
+-  MPI_INCLUDE_DIR = -I$(MPI_INSTALL_DIR)/include
++#  MPI_INCLUDE_DIR = -I/usr/include/mpi
+ #
+ #---------------------------------------------------------------------
+diff --git a/Utilities/src/iohb.c b/Utilities/src/iohb.c
+index ac38f7b..ac34034 100644
+--- a/Utilities/src/iohb.c
++++ b/Utilities/src/iohb.c
+@@ -1725,7 +1725,7 @@ static void upcase(char* S)
+ 
+ static void IOHBTerminate(char* message) 
+ {
+-   fprintf(stderr,message);
++   fputs(message, stderr);
+    exit(1);
+ }
+ 
+diff --git a/makeLib b/makeLib
+index 1780f39..7697b06 100755
+--- a/makeLib
++++ b/makeLib
+@@ -64,14 +64,19 @@ foreach $src ( @srcnames ) {
+    $srcname = " \\\n     " . $src ;
+    print $srcname ;
+ }
++print "\n\n.SUFFIXES: .c .o .lo .a .so" ;
+ print "\n\nOBJ_FILES = \$\{SRC:.c=.o\}" ;
++print "\n\nLOBJ_FILES = \$\{SRC:.c=.lo\}" ;
+ print "\n\n" ;
+ print <<'EOF' ;
+ .c.o :
+-	$(PURIFY) $(CC) -c $(CFLAGS) $*.c -o $(OBJ)_$*.o
++	$(PURIFY) $(CC) -c $(CFLAGS) $*.c -o $(OBJ)_$*.o $(MPI_INCLUDE_DIR)
+ 
+-../../spooles.a : ${OBJ_FILES}
+-	$(AR) $(ARFLAGS) ../../spooles.a $(OBJ)_*.o
++.c.lo :
++	$(PURIFY) $(CC) -c $(CFLAGS) $*.c -fPIC -DPIC -o $(OBJ)_$*.lo $(MPI_INCLUDE_DIR)
++
++../../libspooles.a : ${OBJ_FILES} ${LOBJ_FILES}
++	$(AR) $(ARFLAGS) ../../libspooles.a $(OBJ)_*.o
+ 	rm -f $(OBJ)_*.o
+-	$(RANLIB) ../../spooles.a
++	$(RANLIB) ../../libspooles.a
+ EOF
+diff --git a/makefile b/makefile
+index f014c7d..7c8042a 100755
+--- a/makefile
++++ b/makefile
+@@ -124,7 +124,9 @@ lib :
+ 	cd ZV               ; make lib
+ 	cd misc             ; make lib
+ #cd MPI              ; make lib
+-#cd MT               ; make lib
++	cd MT               ; make lib
++	gcc -shared */*/*.lo -Wl,-soname,libspooles.so.2.2 -o libspooles.so.2.2 -lpthread -lm
++	ln -s libspooles.so.2.2 libspooles.so
+ 
+ global :
+ 	cd A2/src             ; make -f makeGlobalLib
+diff --git a/timings.h b/timings.h
+index 23df189..685800b 100644
+--- a/timings.h
++++ b/timings.h
+@@ -2,9 +2,8 @@
+ #define _TIMINGS_
+ #include <sys/time.h>
+ static struct timeval  TV ;
+-static struct timezone TZ ;
+ #define MARKTIME(t) \
+-   gettimeofday(&TV, &TZ) ; \
++   gettimeofday(&TV, NULL) ; \
+    t = (TV.tv_sec + 0.000001*TV.tv_usec)
+ #endif
+