fluffychat: 1.22.1 -> 1.23.0 (#364091)
[NixPkgs.git] / pkgs / by-name / sc / scowl / package.nix
blobcc129a42c8881c31b45fe7cf1d81547d84510b44
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   unzip,
6   zip,
7   libiconv,
8   perl,
9   aspell,
10   dos2unix,
11   singleWordlist ? null,
14 stdenv.mkDerivation rec {
15   pname = "scowl";
16   version = "2020.12.07";
18   src = fetchFromGitHub {
19     owner = "en-wl";
20     repo = "wordlist";
21     rev = "rel-${version}";
22     sha256 = "sha256-J61jhpnZcXMnoGlSuSCrKDZnnyp3Snjr+fUpTVKX64g=";
23   };
25   postPatch = ''
26     substituteInPlace scowl/src/Makefile \
27         --replace g++ c++
28   '';
30   nativeBuildInputs = [
31     unzip
32     zip
33     perl
34     aspell
35     dos2unix
36   ];
37   buildInputs = lib.optional (!stdenv.hostPlatform.isLinux) libiconv;
39   env.NIX_CFLAGS_COMPILE = "-Wno-narrowing";
41   preConfigure = ''
42     patchShebangs .
43     export PERL5LIB="$PERL5LIB''${PERL5LIB:+:}$PWD/varcon"
44   '';
46   postBuild = lib.optionalString (singleWordlist == null) ''
47     (
48     cd scowl/speller
49     make aspell
50     make hunspell
51     )
52   '';
54   enableParallelBuilding = false;
56   installPhase =
57     if singleWordlist == null then
58       ''
59         eval "$preInstall"
61         mkdir -p "$out/share/scowl"
62         mkdir -p "$out/lib" "$out/share/hunspell" "$out/share/myspell"
63         mkdir -p "$out/share/dict"
65         cp -r scowl/speller/aspell "$out/lib/aspell"
66         cp scowl/speller/*.{aff,dic} "$out/share/hunspell"
67         ln -s "$out/share/hunspell" "$out/share/myspell/dicts"
69         cp scowl/final/* "$out/share/scowl"
71         (
72           cd scowl
73           for region in american british british_s british_z canadian australian; do
74             case $region in
75               american)
76                 regcode=en-us;
77                 ;;
78               british)
79                 regcode=en-gb-ise;
80                 ;;
81               british_s)
82                 regcode=en-gb-ise;
83                 ;;
84               british_z)
85                 regcode=en-gb-ize;
86                 ;;
87               canadian)
88                 regcode=en-ca;
89                 ;;
90               australian)
91                 regcode=en-au;
92                 ;;
93             esac
94             regcode_var="$regcode"
95             if test "$region" = british; then
96               regcode_var="en-gb"
97             fi
99             echo $region $regcode $regcode_sz
100             for s in 10 20 30 35 40 50 55 60 70 80 90 95; do
101               ./mk-list $regcode $s > "$out/share/dict/w$region.$s"
102               ./mk-list --variants=1 $regcode_var $s > "$out/share/dict/w$region.variants.$s"
103               ./mk-list --variants=2 $regcode_var $s > "$out/share/dict/w$region.acceptable.$s"
104             done
105             ./mk-list $regcode 60 > "$out/share/dict/w$region.txt"
106             ./mk-list --variants=1 $regcode_var 60 > "$out/share/dict/w$region.variants.txt"
107             ./mk-list --variants=2 $regcode_var 80 > "$out/share/dict/w$region.scrabble.txt"
108           done
109           ./mk-list --variants=1 en-gb 60 > "$out/share/dict/words.variants.txt"
110           ./mk-list --variants=1 en-gb 80 > "$out/share/dict/words.scrabble.txt"
111           ./mk-list en-gb-ise 60 > "$out/share/dict/words.txt"
112         )
114         eval "$postInstall"
115       ''
116     else
117       ''
118         mkdir -p "$out/share/dict"
119         cd scowl
120         ./mk-list ${singleWordlist} > "$out/share/dict/words.txt"
121       '';
123   meta = {
124     description = "Spell checker oriented word lists";
125     license = lib.licenses.mit;
126     maintainers = [ lib.maintainers.raskin ];
127     platforms = lib.platforms.unix;
128     homepage = "http://wordlist.aspell.net/";
129   };