about summary refs log tree commit diff stats
path: root/pkgs/enchant-configurable/default.nix
blob: 0afe168979969b5aedcab95e15e5d497855b7f8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
{ stdenv
, lib
, fetchurl
, aspell
, groff
, pkg-config
, glib
, hunspell
, hspell
, nuspell
, unittest-cpp

, withHspell ? true
, withAspell ? true
, withHunspell ? true
, withNuspell ? true
, withAppleSpell ? stdenv.isDarwin

, Cocoa
}:

assert withAppleSpell -> stdenv.isDarwin;

stdenv.mkDerivation rec {
  pname = "enchant";
  version = "2.6.9";

  outputs = [ "out" "dev" ];

  src = fetchurl {
    url = "https://github.com/AbiWord/${pname}/releases/download/v${version}/${pname}-${version}.tar.gz";
    hash = "sha256-2aWhDcmzikOzoPoix27W67fgnrU1r/YpVK/NvUDv/2s=";
  };

  strictDeps = true;

  nativeBuildInputs = [
    groff
    pkg-config
  ];

  buildInputs = [
    glib
  ] ++ lib.optionals withHunspell [
    hunspell
  ] ++ lib.optionals withNuspell [
    nuspell
  ] ++ lib.optionals withAppleSpell [
    Cocoa
  ];

  checkInputs = [
    unittest-cpp
  ];

  # libtool puts these to .la files
  propagatedBuildInputs = lib.optionals withHspell [
    hspell
  ] ++ lib.optionals withAspell [
    aspell
  ];

  enableParallelBuilding = true;

  doCheck = true;

  configureFlags = [
    "--enable-relocatable" # needed for tests
    (lib.withFeature withAspell "aspell")
    (lib.withFeature withHspell "hspell")
    (lib.withFeature withHunspell "hunspell")
    (lib.withFeature withNuspell "nuspell")
    (lib.withFeature withAppleSpell "applespell")
  ];

  meta = with lib; {
    description = "Generic spell checking library";
    homepage = "https://abiword.github.io/enchant/";
    license = licenses.lgpl21Plus; # with extra provision for non-free checkers
    platforms = platforms.unix;
  };
}