lol
1/* hunspell dictionaries */
2
3{ stdenv, fetchurl, fetchFromGitHub, unzip, coreutils, bash, which, zip, ispell, perl, hunspell }:
4
5
6let
7 mkDict =
8 { name, readmeFile, dictFileName, ... }@args:
9 stdenv.mkDerivation (rec {
10 inherit name;
11 installPhase = ''
12 # hunspell dicts
13 install -dm755 "$out/share/hunspell"
14 install -m644 ${dictFileName}.dic "$out/share/hunspell/"
15 install -m644 ${dictFileName}.aff "$out/share/hunspell/"
16 # myspell dicts symlinks
17 install -dm755 "$out/share/myspell/dicts"
18 ln -sv "$out/share/hunspell/${dictFileName}.dic" "$out/share/myspell/dicts/"
19 ln -sv "$out/share/hunspell/${dictFileName}.aff" "$out/share/myspell/dicts/"
20 # docs
21 install -dm755 "$out/share/doc"
22 install -m644 ${readmeFile} $out/share/doc/${name}.txt
23 '';
24 } // args);
25
26 mkDictFromRla =
27 { shortName, shortDescription, dictFileName }:
28 mkDict rec {
29 inherit dictFileName;
30 version = "2.2";
31 name = "hunspell-dict-${shortName}-rla-${version}";
32 readmeFile = "README.txt";
33 src = fetchFromGitHub {
34 owner = "sbosio";
35 repo = "rla-es";
36 rev = "v${version}";
37 sha256 = "0n9ms092k7vg7xpd3ksadxydbrizkb7js7dfxr08nbnnb9fgy0i8";
38 };
39 meta = with stdenv.lib; {
40 description = "Hunspell dictionary for ${shortDescription} from rla";
41 homepage = https://github.com/sbosio/rla-es;
42 license = with licenses; [ gpl3 lgpl3 mpl11 ];
43 maintainers = with maintainers; [ renzo ];
44 platforms = platforms.all;
45 };
46 phases = "unpackPhase patchPhase buildPhase installPhase";
47 buildInputs = [ bash coreutils unzip which zip ];
48 patchPhase = ''
49 substituteInPlace ortograf/herramientas/make_dict.sh \
50 --replace /bin/bash bash \
51 --replace /dev/stderr stderr.log
52
53 substituteInPlace ortograf/herramientas/remover_comentarios.sh \
54 --replace /bin/bash bash \
55 '';
56 buildPhase = ''
57 cd ortograf/herramientas
58 bash -x ./make_dict.sh -l ${dictFileName} -2
59 unzip ${dictFileName}.zip \
60 ${dictFileName}.dic ${dictFileName}.aff ${readmeFile}
61 '';
62 };
63
64 mkDictFromDicollecte =
65 { shortName, shortDescription, longDescription, dictFileName }:
66 mkDict rec {
67 inherit dictFileName;
68 version = "5.3";
69 name = "hunspell-dict-${shortName}-dicollecte-${version}";
70 readmeFile = "README_dict_fr.txt";
71 src = fetchurl {
72 url = "http://www.dicollecte.org/download/fr/hunspell-french-dictionaries-v${version}.zip";
73 sha256 = "0ca7084jm7zb1ikwzh1frvpb97jn27i7a5d48288h2qlfp068ik0";
74 };
75 meta = with stdenv.lib; {
76 inherit longDescription;
77 description = "Hunspell dictionary for ${shortDescription} from Dicollecte";
78 homepage = https://www.dicollecte.org/home.php?prj=fr;
79 license = licenses.mpl20;
80 maintainers = with maintainers; [ renzo ];
81 platforms = platforms.all;
82 };
83 buildInputs = [ unzip ];
84 phases = "unpackPhase installPhase";
85 sourceRoot = ".";
86 unpackCmd = ''
87 unzip $src ${dictFileName}.dic ${dictFileName}.aff ${readmeFile}
88 '';
89 };
90
91 mkDictFromWordlist =
92 { shortName, shortDescription, dictFileName, src }:
93 mkDict rec {
94 inherit src dictFileName;
95 version = "2014.11.17";
96 name = "hunspell-dict-${shortName}-wordlist-${version}";
97 readmeFile = "README_" + dictFileName + ".txt";
98 meta = with stdenv.lib; {
99 description = "Hunspell dictionary for ${shortDescription} from Wordlist";
100 homepage = http://wordlist.aspell.net/;
101 license = licenses.bsd3;
102 maintainers = with maintainers; [ renzo ];
103 platforms = platforms.all;
104 };
105 buildInputs = [ unzip ];
106 phases = "unpackPhase installPhase";
107 sourceRoot = ".";
108 unpackCmd = ''
109 unzip $src ${dictFileName}.dic ${dictFileName}.aff ${readmeFile}
110 '';
111 };
112
113 mkDictFromLinguistico =
114 { shortName, shortDescription, dictFileName, src }:
115 mkDict rec {
116 inherit src dictFileName;
117 version = "2.4";
118 name = "hunspell-dict-${shortName}-linguistico-${version}";
119 readmeFile = dictFileName + "_README.txt";
120 meta = with stdenv.lib; {
121 homepage = https://sourceforge.net/projects/linguistico/;
122 license = licenses.gpl3;
123 maintainers = with maintainers; [ renzo ];
124 platforms = platforms.all;
125 };
126 buildInputs = [ unzip ];
127 phases = "unpackPhase patchPhase installPhase";
128 sourceRoot = ".";
129 prePatch = ''
130 # Fix dic file empty lines (FS#22275)
131 sed '/^\/$/d' -i ${dictFileName}.dic
132 '';
133 unpackCmd = ''
134 unzip $src ${dictFileName}.dic ${dictFileName}.aff ${readmeFile}
135 '';
136 };
137
138 mkDictFromXuxen =
139 { shortName, srcs, shortDescription, longDescription, dictFileName }:
140 stdenv.mkDerivation rec {
141 name = "hunspell-dict-${shortName}-xuxen-${version}";
142 version = "5-2015.11.10";
143
144 inherit srcs;
145
146 phases = ["unpackPhase" "installPhase"];
147 sourceRoot = ".";
148 # Copy files stripping until first dash (path and hash)
149 unpackCmd = "cp $curSrc \${curSrc##*-}";
150 installPhase = ''
151 # hunspell dicts
152 install -dm755 "$out/share/hunspell"
153 install -m644 ${dictFileName}.dic "$out/share/hunspell/"
154 install -m644 ${dictFileName}.aff "$out/share/hunspell/"
155 # myspell dicts symlinks
156 install -dm755 "$out/share/myspell/dicts"
157 ln -sv "$out/share/hunspell/${dictFileName}.dic" "$out/share/myspell/dicts/"
158 ln -sv "$out/share/hunspell/${dictFileName}.aff" "$out/share/myspell/dicts/"
159 '';
160
161 meta = with stdenv.lib; {
162 homepage = http://xuxen.eus/;
163 description = shortDescription;
164 longDescription = longDescription;
165 license = licenses.gpl2;
166 maintainers = with maintainers; [ zalakain ];
167 platforms = platforms.all;
168 };
169 };
170
171 mkDictFromJ3e =
172 { shortName, shortDescription, dictFileName }:
173 stdenv.mkDerivation rec {
174 name = "hunspell-dict-${shortName}-j3e-${version}";
175 version = "20161207";
176
177 src = fetchurl {
178 url = "https://j3e.de/ispell/igerman98/dict/igerman98-${version}.tar.bz2";
179 sha256 = "1a3055hp2bc4q4nlg3gmg0147p3a1zlfnc65xiv2v9pyql1nya8p";
180 };
181
182 buildInputs = [ ispell perl hunspell ];
183
184 phases = ["unpackPhase" "installPhase"];
185 installPhase = ''
186 patchShebangs bin
187 make hunspell/${dictFileName}.aff hunspell/${dictFileName}.dic
188 # hunspell dicts
189 install -dm755 "$out/share/hunspell"
190 install -m644 hunspell/${dictFileName}.dic "$out/share/hunspell/"
191 install -m644 hunspell/${dictFileName}.aff "$out/share/hunspell/"
192 # myspell dicts symlinks
193 install -dm755 "$out/share/myspell/dicts"
194 ln -sv "$out/share/hunspell/${dictFileName}.dic" "$out/share/myspell/dicts/"
195 ln -sv "$out/share/hunspell/${dictFileName}.aff" "$out/share/myspell/dicts/"
196 '';
197
198 meta = with stdenv.lib; {
199 homepage = https://www.j3e.de/ispell/igerman98/index_en.html;
200 description = shortDescription;
201 license = with licenses; [ gpl2 gpl3 ];
202 maintainers = with maintainers; [ timor ];
203 platforms = platforms.all;
204 };
205 };
206
207in {
208
209 /* ENGLISH */
210
211 en-us = mkDictFromWordlist {
212 shortName = "en-us";
213 shortDescription = "English (United States)";
214 dictFileName = "en_US";
215 src = fetchurl {
216 url = mirror://sourceforge/wordlist/speller/2014.11.17/hunspell-en_US-2014.11.17.zip;
217 sha256 = "4ce88a1af457ce0e256110277a150e5da798213f611929438db059c1c81e20f2";
218 };
219 };
220
221 en-ca = mkDictFromWordlist {
222 shortName = "en-ca";
223 shortDescription = "English (Canada)";
224 dictFileName = "en_CA";
225 src = fetchurl {
226 url = mirror://sourceforge/wordlist/speller/2014.11.17/hunspell-en_CA-2014.11.17.zip;
227 sha256 = "59950448440657a6fc3ede15720c1b86c0b66c4ec734bf1bd9157f6a1786673b";
228 };
229 };
230
231 en-gb-ise = mkDictFromWordlist {
232 shortName = "en-gb-ise";
233 shortDescription = "English (United Kingdom, 'ise' ending)";
234 dictFileName = "en_GB-ise";
235 src = fetchurl {
236 url = mirror://sourceforge/wordlist/speller/2014.11.17/hunspell-en_GB-ise-2014.11.17.zip;
237 sha256 = "97f3b25102fcadd626ae4af3cdd97f017ce39264494f98b1f36ad7d96b9d5a94";
238 };
239 };
240
241 en-gb-ize = mkDictFromWordlist {
242 shortName = "en-gb-ize";
243 shortDescription = "English (United Kingdom, 'ize' ending)";
244 dictFileName = "en_GB-ize";
245 src = fetchurl {
246 url = mirror://sourceforge/wordlist/speller/2014.11.17/hunspell-en_GB-ize-2014.11.17.zip;
247 sha256 = "84270673ed7c014445f3ba02f9efdb0ac44cea9ee0bfec76e3e10feae55c4e1c";
248 };
249 };
250
251 /* SPANISH */
252
253 es-any = mkDictFromRla {
254 shortName = "es-any";
255 shortDescription = "Spanish (any variant)";
256 dictFileName = "es_ANY";
257 };
258
259 es-ar = mkDictFromRla {
260 shortName = "es-ar";
261 shortDescription = "Spanish (Argentina)";
262 dictFileName = "es_AR";
263 };
264
265 es-bo = mkDictFromRla {
266 shortName = "es-bo";
267 shortDescription = "Spanish (Bolivia)";
268 dictFileName = "es_BO";
269 };
270
271 es-cl = mkDictFromRla {
272 shortName = "es-cl";
273 shortDescription = "Spanish (Chile)";
274 dictFileName = "es_CL";
275 };
276
277 es-co = mkDictFromRla {
278 shortName = "es-co";
279 shortDescription = "Spanish (Colombia)";
280 dictFileName = "es_CO";
281 };
282
283 es-cr = mkDictFromRla {
284 shortName = "es-cr";
285 shortDescription = "Spanish (Costra Rica)";
286 dictFileName = "es_CR";
287 };
288
289 es-cu = mkDictFromRla {
290 shortName = "es-cu";
291 shortDescription = "Spanish (Cuba)";
292 dictFileName = "es_CU";
293 };
294
295 es-do = mkDictFromRla {
296 shortName = "es-do";
297 shortDescription = "Spanish (Dominican Republic)";
298 dictFileName = "es_DO";
299 };
300
301 es-ec = mkDictFromRla {
302 shortName = "es-ec";
303 shortDescription = "Spanish (Ecuador)";
304 dictFileName = "es_EC";
305 };
306
307 es-es = mkDictFromRla {
308 shortName = "es-es";
309 shortDescription = "Spanish (Spain)";
310 dictFileName = "es_ES";
311 };
312
313 es-gt = mkDictFromRla {
314 shortName = "es-gt";
315 shortDescription = "Spanish (Guatemala)";
316 dictFileName = "es_GT";
317 };
318
319 es-hn = mkDictFromRla {
320 shortName = "es-hn";
321 shortDescription = "Spanish (Honduras)";
322 dictFileName = "es_HN";
323 };
324
325 es-mx = mkDictFromRla {
326 shortName = "es-mx";
327 shortDescription = "Spanish (Mexico)";
328 dictFileName = "es_MX";
329 };
330
331 es-ni = mkDictFromRla {
332 shortName = "es-ni";
333 shortDescription = "Spanish (Nicaragua)";
334 dictFileName = "es_NI";
335 };
336
337 es-pa = mkDictFromRla {
338 shortName = "es-pa";
339 shortDescription = "Spanish (Panama)";
340 dictFileName = "es_PA";
341 };
342
343 es-pe = mkDictFromRla {
344 shortName = "es-pe";
345 shortDescription = "Spanish (Peru)";
346 dictFileName = "es_PE";
347 };
348
349 es-pr = mkDictFromRla {
350 shortName = "es-pr";
351 shortDescription = "Spanish (Puerto Rico)";
352 dictFileName = "es_PR";
353 };
354
355 es-py = mkDictFromRla {
356 shortName = "es-py";
357 shortDescription = "Spanish (Paraguay)";
358 dictFileName = "es_PY";
359 };
360
361 es-sv = mkDictFromRla {
362 shortName = "es-sv";
363 shortDescription = "Spanish (El Salvador)";
364 dictFileName = "es_SV";
365 };
366
367 es-uy = mkDictFromRla {
368 shortName = "es-uy";
369 shortDescription = "Spanish (Uruguay)";
370 dictFileName = "es_UY";
371 };
372
373 es-ve = mkDictFromRla {
374 shortName = "es-ve";
375 shortDescription = "Spanish (Venezuela)";
376 dictFileName = "es_VE";
377 };
378
379 /* FRENCH */
380
381 fr-any = mkDictFromDicollecte {
382 shortName = "fr-any";
383 dictFileName = "fr-toutesvariantes";
384 shortDescription = "French (any variant)";
385 longDescription = ''
386 Ce dictionnaire contient les nouvelles et les anciennes graphies des
387 mots concernés par la réforme de 1990.
388 '';
389 };
390
391 fr-classique = mkDictFromDicollecte {
392 shortName = "fr-classique";
393 dictFileName = "fr-classique";
394 shortDescription = "French (classic)";
395 longDescription = ''
396 Ce dictionnaire est une extension du dictionnaire «Moderne» et propose
397 en sus des graphies alternatives, parfois encore très usitées, parfois
398 tombées en désuétude.
399 '';
400 };
401
402 fr-moderne = mkDictFromDicollecte {
403 shortName = "fr-moderne";
404 dictFileName = "fr-moderne";
405 shortDescription = "French (modern)";
406 longDescription = ''
407 Ce dictionnaire propose une sélection des graphies classiques et
408 réformées, suivant la lente évolution de l’orthographe actuelle. Ce
409 dictionnaire contient les graphies les moins polémiques de la réforme.
410 '';
411 };
412
413 fr-reforme1990 = mkDictFromDicollecte {
414 shortName = "fr-reforme1990";
415 dictFileName = "fr-reforme1990";
416 shortDescription = "French (1990 reform)";
417 longDescription = ''
418 Ce dictionnaire ne connaît que les graphies nouvelles des mots concernés
419 par la réforme de 1990.
420 '';
421 };
422
423 /* ITALIAN */
424
425 it-it = mkDictFromLinguistico rec {
426 shortName = "it-it";
427 dictFileName = "it_IT";
428 shortDescription = "Hunspell dictionary for 'Italian (Italy)' from Linguistico";
429 src = fetchurl {
430 url = mirror://sourceforge/linguistico/italiano_2_4_2007_09_01.zip;
431 sha256 = "0m9frz75fx456bczknay5i446gdcp1smm48lc0qfwzhz0j3zcdrd";
432 };
433 };
434
435 /* BASQUE */
436
437 eu-es = mkDictFromXuxen {
438 shortName = "eu-es";
439 dictFileName = "eu_ES";
440 shortDescription = "Basque (Xuxen 5)";
441 longDescription = ''
442 Itxura berritzeaz gain, testuak zuzentzen laguntzeko zenbait hobekuntza
443 egin dira Xuxen.eus-en. Lexikoari dagokionez, 18645 sarrera berri erantsi
444 ditugu, eta proposamenak egiteko sistema ere aldatu dugu. Esate baterako,
445 gaizki idatzitako hitz baten inguruko proposamenak eskuratzeko, euskaraz
446 idaztean egiten ditugun akats arruntenak hartu dira kontuan. Sistemak
447 ematen dituen proposamenak ordenatzeko, berriz, aipatutako irizpidea
448 erabiltzeaz gain, Internetetik automatikoki eskuratutako euskarazko corpus
449 bateko datuen arabera ordenatu daitezke emaitzak. Erabiltzaileak horrela
450 ordenatu nahi baditu proposamenak, hautatu egin behar du aukera hori
451 testu-kutxaren azpian dituen aukeren artean. Interesgarria da proposamenak
452 ordenatzeko irizpide hori, hala sistemak formarik erabilienak proposatuko
453 baitizkigu gutxiago erabiltzen direnen aurretik.
454 '';
455 srcs = [
456 (fetchurl {
457 url = "http://xuxen.eus/static/hunspell/eu_ES.aff";
458 sha256 = "12w2j6phzas2rdzc7f20jnk93sm59m2zzfdgxv6p8nvcvbrkmc02";
459 })
460 (fetchurl {
461 url = "http://xuxen.eus/static/hunspell/eu_ES.dic";
462 sha256 = "0lw193jr7ldvln5x5z9p21rz1by46h0say9whfcw2kxs9vprd5b3";
463 })
464 ];
465 };
466
467 /* GERMAN */
468
469 de-de = mkDictFromJ3e {
470 shortName = "de-de";
471 shortDescription = "German (Germany)";
472 dictFileName = "de_DE";
473 };
474
475 de-at = mkDictFromJ3e {
476 shortName = "de-at";
477 shortDescription = "German (Austria)";
478 dictFileName = "de_AT";
479 };
480
481 de-ch = mkDictFromJ3e {
482 shortName = "de-ch";
483 shortDescription = "German (Switzerland)";
484 dictFileName = "de_CH";
485 };
486}