1{
2 lib,
3 stdenv,
4 fetchpatch,
5 fetchurl,
6 fetchzip,
7 perl,
8 ncurses,
9
10 # for tests
11 aspell,
12 glibc,
13 runCommand,
14
15 searchNixProfiles ? true,
16}:
17
18let
19
20 # Source for u-deva.cmap and u-deva.cset: use the Marathi
21 # dictionary like Debian does.
22 devaMapsSource = fetchzip {
23 name = "aspell-u-deva";
24 url = "https://ftp.gnu.org/gnu/aspell/dict/mr/aspell6-mr-0.10-0.tar.bz2";
25 sha256 = "1v8cdl8x2j1d4vbvsq1xrqys69bbccd6mi03fywrhkrrljviyri1";
26 };
27
28in
29
30stdenv.mkDerivation rec {
31 pname = "aspell";
32 version = "0.60.8.1";
33
34 src = fetchurl {
35 url = "mirror://gnu/aspell/aspell-${version}.tar.gz";
36 hash = "sha256-1toSs01C1Ff6YE5DWtSEp0su/80SD/QKzWuz+yiH0hs=";
37 };
38
39 patches = [
40 # fix gcc-15 / clang-19 build. can remove on next update
41 (fetchpatch {
42 name = "fix-gcc-15-build.patch";
43 url = "https://github.com/GNUAspell/aspell/commit/ee6cbb12ff36a1e6618d7388a78dd4e0a2b44041.patch";
44 hash = "sha256-rW1FcfARdtT4wX+zGd2x/1K8zRp9JZhdR/zRd8RwPZA=";
45 })
46 ]
47 ++ lib.optional searchNixProfiles ./data-dirs-from-nix-profiles.patch;
48
49 postPatch = ''
50 patch interfaces/cc/aspell.h < ${./clang.patch}
51 '';
52
53 nativeBuildInputs = [ perl ];
54 buildInputs = [
55 ncurses
56 perl
57 ];
58
59 doCheck = true;
60
61 preConfigure = ''
62 configureFlagsArray=(
63 --enable-pkglibdir=$out/lib/aspell
64 --enable-pkgdatadir=$out/lib/aspell
65 );
66 '';
67
68 # Include u-deva.cmap and u-deva.cset in the aspell package
69 # to avoid conflict between 'mr' and 'hi' dictionaries as they
70 # both include those files.
71 postInstall = ''
72 cp ${devaMapsSource}/u-deva.{cmap,cset} $out/lib/aspell/
73 '';
74
75 passthru.tests = {
76 uses-curses =
77 runCommand "aspell-curses"
78 {
79 buildInputs = [ glibc ];
80 }
81 ''
82 if ! ldd ${aspell}/bin/aspell | grep -q ${ncurses}
83 then
84 echo "Test failure: It does not look like aspell picked up the curses dependency."
85 exit 1
86 fi
87 touch $out
88 '';
89 };
90
91 meta = {
92 description = "Spell checker for many languages";
93 homepage = "http://aspell.net/";
94 license = lib.licenses.lgpl2Plus;
95 maintainers = [ ];
96 platforms = with lib.platforms; all;
97 };
98}