summary refs log tree commit diff
path: root/pkgs/development/libraries/aspell
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2007-10-23 16:33:11 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2007-10-23 16:33:11 +0000
commit66799416158a7c9a2a296995bc1bce095b2df47b (patch)
treee2e91925d4176a777a3d1a029c84d96b2cd9b14c /pkgs/development/libraries/aspell
parent183d29946f04b2e82ff9885076522d0240d9008d (diff)
downloadnixpkgs-66799416158a7c9a2a296995bc1bce095b2df47b.tar
nixpkgs-66799416158a7c9a2a296995bc1bce095b2df47b.tar.gz
nixpkgs-66799416158a7c9a2a296995bc1bce095b2df47b.tar.bz2
nixpkgs-66799416158a7c9a2a296995bc1bce095b2df47b.tar.lz
nixpkgs-66799416158a7c9a2a296995bc1bce095b2df47b.tar.xz
nixpkgs-66799416158a7c9a2a296995bc1bce095b2df47b.tar.zst
nixpkgs-66799416158a7c9a2a296995bc1bce095b2df47b.zip
* aspell: hacked up a little patch to allow additional dictionary
  directories to be specified through the environment variable
  ASPELL_EXTRA_DICT_DIRS.  This way dictionaries don't have to be
  installed into aspell's prefix.  Instead you can just set
  ASPELL_EXTRA_DICT_DIRS to $HOME/.nix-profile/lib/aspell and install
  dictionaries separately with nix-env (e.g. "nix-env -i
  aspell-dict-nl").
  
* Added a bunch of Aspell dictionaries.  Additional dictionaries can
  be added easily in development/libraries/aspell/dictionaries.nix.

svn path=/nixpkgs/trunk/; revision=9512
Diffstat (limited to 'pkgs/development/libraries/aspell')
-rw-r--r--pkgs/development/libraries/aspell/builder.sh16
-rw-r--r--pkgs/development/libraries/aspell/default.nix26
-rw-r--r--pkgs/development/libraries/aspell/dict-path.patch30
-rw-r--r--pkgs/development/libraries/aspell/dictionaries.nix91
4 files changed, 137 insertions, 26 deletions
diff --git a/pkgs/development/libraries/aspell/builder.sh b/pkgs/development/libraries/aspell/builder.sh
deleted file mode 100644
index af1c5406675..00000000000
--- a/pkgs/development/libraries/aspell/builder.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-source $stdenv/setup
-genericBuild
-
-# dictionaries search for aspell and prezip-bin
-export PATH=$out/bin:$PATH
-mkdir dict-tmp
-cd dict-tmp
-for d in $dictionaries; do
-  tar jxvf $d
-  cd aspell6-*
-  ./configure
-  make
-  make install
-  rm -rf aspell6-*
-  cd ..
-done
diff --git a/pkgs/development/libraries/aspell/default.nix b/pkgs/development/libraries/aspell/default.nix
index d259efcc8c0..fdee6107716 100644
--- a/pkgs/development/libraries/aspell/default.nix
+++ b/pkgs/development/libraries/aspell/default.nix
@@ -1,19 +1,25 @@
-{stdenv, fetchurl, perl, which}:
+{stdenv, fetchurl, perl}:
 
 stdenv.mkDerivation {
   name = "aspell-0.60.5";
+  
   src = fetchurl {
     url = ftp://ftp.gnu.org/gnu/aspell/aspell-0.60.5.tar.gz;
     md5 = "17fd8acac6293336bcef44391b71e337";
   };
-  builder = ./builder.sh;
+  
+  buildInputs = [perl];
 
-  buildInputs = [perl which];
-  dictionaries =
-    let en = fetchurl {
-          url = ftp://ftp.gnu.org/gnu/aspell/dict/en/aspell6-en-6.0-0.tar.bz2;
-          md5 = "16449e0a266e1ecc526b2f3cd39d4bc2";
-        };
-    in
-      [ en ];
+  patches = [
+    # A patch that allows additional dictionary directories to be set
+    # specified through the environment variable
+    # ASPELL_EXTRA_DICT_DIRS (comma-separated).
+    ./dict-path.patch
+  ];
+
+  meta = {
+    description = "A spell checker for many languages";
+    homepage = http://aspell.net/;
+    license = "LGPL";
+  };
 }
diff --git a/pkgs/development/libraries/aspell/dict-path.patch b/pkgs/development/libraries/aspell/dict-path.patch
new file mode 100644
index 00000000000..c044c3d0eba
--- /dev/null
+++ b/pkgs/development/libraries/aspell/dict-path.patch
@@ -0,0 +1,30 @@
+diff -rc aspell-0.60.5-orig/common/info.cpp aspell-0.60.5/common/info.cpp
+*** aspell-0.60.5-orig/common/info.cpp	2004-11-10 07:18:45.000000000 +0100
+--- aspell-0.60.5/common/info.cpp	2007-10-23 17:30:47.000000000 +0200
+***************
+*** 209,214 ****
+--- 209,215 ----
+  					   unsigned int name_size,
+  					   IStream & in)
+    {
++     char * extra_dict_dirs = getenv("ASPELL_EXTRA_DICT_DIRS");
+      ModuleInfoNode * * prev = &head_;
+      ModuleInfoNode * to_add = new ModuleInfoNode();
+      to_add->c_struct.name = 0;
+***************
+*** 246,251 ****
+--- 247,260 ----
+  	goto RETURN_ERROR;
+        }
+      }
++ 
++     // Add dictionaries from directories in
++     // $ASPELL_EXTRA_DICT_DIRS. Maybe this isn't the right place to do
++     // this, but it works.
++     if (extra_dict_dirs) {
++       to_add->c_struct.dict_dirs = &(to_add->dict_dirs);
++       itemize(extra_dict_dirs, to_add->dict_dirs);
++     }
+    
+      while (*prev != 0 && 
+  	   (*prev)->c_struct.order_num < to_add->c_struct.order_num)
diff --git a/pkgs/development/libraries/aspell/dictionaries.nix b/pkgs/development/libraries/aspell/dictionaries.nix
new file mode 100644
index 00000000000..7be7b580656
--- /dev/null
+++ b/pkgs/development/libraries/aspell/dictionaries.nix
@@ -0,0 +1,91 @@
+{stdenv, fetchurl, aspell, which}:
+
+let
+
+  /* Function to compile an Aspell dictionary.  Fortunately, they all
+     build in the exact same way. */
+  buildDict =
+    {shortName, fullName, src}:
+
+    stdenv.mkDerivation {
+      name = "aspell-dict-${shortName}";
+
+      inherit src;
+
+      buildInputs = [aspell which];
+
+      dontAddPrefix = true;
+
+      preBuild = "makeFlagsArray=(dictdir=$out/lib/aspell datadir=$out/lib/aspell)";
+
+      meta = {
+        description = "Aspell dictionary for ${fullName}";
+      };
+    };
+
+in {
+
+  de = buildDict {
+    shortName = "de-20030222-1";
+    fullName = "German";
+    src = fetchurl {
+      url = mirror://gnu/aspell/dict/de/aspell6-de-20030222-1.tar.bz2;
+      sha256 = "01p92qj66cqb346gk7hjfynaap5sbcn85xz07kjfdq623ghr8v5s";
+    };
+  };
+    
+  en = buildDict {
+    shortName = "en-6.0-0";
+    fullName = "English";
+    src = fetchurl {
+      url = mirror://gnu/aspell/dict/en/aspell6-en-6.0-0.tar.bz2;
+      sha256 = "1628rrx1yq9jmnd86sr24vih101smb818vf10vx97f6j263niw14";
+    };
+  };
+    
+  es = buildDict {
+    shortName = "es-0.50-2";
+    fullName = "Spanish";
+    src = fetchurl {
+      url = mirror://gnu/aspell/dict/es/aspell-es-0.50-2.tar.bz2;
+      sha256 = "0i96xswcng35n5zhgpiswmi5sdpx63kl8bg7fl1zp5j1shr2l3jw";
+    };
+  };
+    
+  fr = buildDict {
+    shortName = "fr-0.50-3";
+    fullName = "French";
+    src = fetchurl {
+      url = mirror://gnu/aspell/dict/fr/aspell-fr-0.50-3.tar.bz2;
+      sha256 = "14ffy9mn5jqqpp437kannc3559bfdrpk7r36ljkzjalxa53i0hpr";
+    };
+  };
+    
+  la = buildDict {
+    shortName = "la-20020503-0";
+    fullName = "Latin";
+    src = fetchurl {
+      url = mirror://gnu/aspell/dict/la/aspell6-la-20020503-0.tar.bz2;
+      sha256 = "1199inwi16dznzl087v4skn66fl7h555hi2palx6s1f3s54b11nl";
+    };
+  };
+    
+  nl = buildDict {
+    shortName = "nl-0.50-2";
+    fullName = "Dutch";
+    src = fetchurl {
+      url = mirror://gnu/aspell/dict/nl/aspell-nl-0.50-2.tar.bz2;
+      sha256 = "0ffb87yjsh211hllpc4b9khqqrblial4pzi1h9r3v465z1yhn3j4";
+    };
+  };
+    
+  ru = buildDict {
+    shortName = "ru-0.99f7-1";
+    fullName = "Russian";
+    src = fetchurl {
+      url = mirror://gnu/aspell/dict/ru/aspell6-ru-0.99f7-1.tar.bz2;
+      sha256 = "0ip6nq43hcr7vvzbv4lwwmlwgfa60hrhsldh9xy3zg2prv6bcaaw";
+    };
+  };
+    
+}