2018-03-25 14:23:49 +01:00
|
|
|
{ stdenv, fetchFromGitHub, unzip, zip, libiconv, perl, aspell, dos2unix
|
|
|
|
, singleWordlist ? null
|
|
|
|
}:
|
|
|
|
|
2017-12-23 19:25:54 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "${pname}-${version}";
|
|
|
|
pname = "scowl";
|
2018-05-11 08:19:05 +01:00
|
|
|
version = "2018.04.16";
|
2017-12-23 19:25:54 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "en-wl";
|
|
|
|
repo = "wordlist";
|
|
|
|
rev = "rel-${version}";
|
2018-05-11 08:19:05 +01:00
|
|
|
sha256 = "0p0hgg5y88bb802z210cdk1c4fjwlpxxkci6yph3fk7g6s9xc73g";
|
2017-12-23 19:25:54 +00:00
|
|
|
};
|
|
|
|
|
2018-03-25 14:23:49 +01:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace scowl/src/Makefile \
|
|
|
|
--replace g++ c++
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ unzip zip perl aspell dos2unix ];
|
|
|
|
buildInputs = stdenv.lib.optional (!stdenv.isLinux) libiconv;
|
2017-12-23 19:25:54 +00:00
|
|
|
|
2018-03-25 14:23:49 +01:00
|
|
|
NIX_CFLAGS_COMPILE = "-Wno-narrowing";
|
2017-12-23 19:25:54 +00:00
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
patchShebangs .
|
|
|
|
export PERL5LIB="$PERL5LIB''${PERL5LIB:+:}$PWD/varcon"
|
|
|
|
'';
|
|
|
|
|
2018-02-02 20:50:12 +00:00
|
|
|
postBuild = stdenv.lib.optionalString (singleWordlist == null) ''
|
2017-12-23 19:25:54 +00:00
|
|
|
(
|
|
|
|
cd scowl/speller
|
|
|
|
make aspell
|
|
|
|
make hunspell
|
|
|
|
)
|
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = false;
|
|
|
|
|
2018-02-02 20:50:12 +00:00
|
|
|
installPhase = if singleWordlist == null then ''
|
2017-12-23 19:25:54 +00:00
|
|
|
eval "$preInstall"
|
|
|
|
|
2018-03-25 14:23:49 +01:00
|
|
|
mkdir -p "$out/share/scowl"
|
|
|
|
mkdir -p "$out/lib" "$out/share/hunspell" "$out/share/myspell"
|
2017-12-23 19:25:54 +00:00
|
|
|
mkdir -p "$out/share/dict"
|
|
|
|
|
|
|
|
cp -r scowl/speller/aspell "$out/lib/aspell"
|
|
|
|
cp scowl/speller/*.{aff,dic} "$out/share/hunspell"
|
|
|
|
ln -s "$out/share/hunspell" "$out/share/myspell/dicts"
|
|
|
|
|
|
|
|
cp scowl/final/* "$out/share/scowl"
|
|
|
|
|
|
|
|
(
|
|
|
|
cd scowl
|
|
|
|
for region in american british british_s british_z canadian australian; do
|
|
|
|
case $region in
|
|
|
|
american)
|
|
|
|
regcode=en-us;
|
|
|
|
;;
|
|
|
|
british)
|
|
|
|
regcode=en-gb-ise;
|
|
|
|
;;
|
|
|
|
british_s)
|
|
|
|
regcode=en-gb-ise;
|
|
|
|
;;
|
|
|
|
british_z)
|
|
|
|
regcode=en-gb-ize;
|
|
|
|
;;
|
|
|
|
canadian)
|
|
|
|
regcode=en-ca;
|
|
|
|
;;
|
|
|
|
australian)
|
|
|
|
regcode=en-au;
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
regcode_var="$regcode"
|
|
|
|
if test "$region" = british; then
|
|
|
|
regcode_var="en-gb"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo $region $regcode $regcode_sz
|
2018-02-02 20:50:12 +00:00
|
|
|
for s in 10 20 30 35 40 50 55 60 70 80 90 95; do
|
2017-12-23 19:25:54 +00:00
|
|
|
./mk-list $regcode $s > "$out/share/dict/w$region.$s"
|
|
|
|
./mk-list --variants=1 $regcode_var $s > "$out/share/dict/w$region.variants.$s"
|
|
|
|
./mk-list --variants=2 $regcode_var $s > "$out/share/dict/w$region.acceptable.$s"
|
|
|
|
done
|
|
|
|
./mk-list $regcode 60 > "$out/share/dict/w$region.txt"
|
|
|
|
./mk-list --variants=1 $regcode_var 60 > "$out/share/dict/w$region.variants.txt"
|
|
|
|
./mk-list --variants=2 $regcode_var 80 > "$out/share/dict/w$region.scrabble.txt"
|
|
|
|
done
|
|
|
|
./mk-list --variants=1 en-gb 60 > "$out/share/dict/words.variants.txt"
|
|
|
|
./mk-list --variants=1 en-gb 80 > "$out/share/dict/words.scrabble.txt"
|
|
|
|
./mk-list en-gb-ise 60 > "$out/share/dict/words.txt"
|
|
|
|
)
|
|
|
|
|
|
|
|
eval "$postInstall"
|
2018-02-02 20:50:12 +00:00
|
|
|
'' else ''
|
|
|
|
mkdir -p "$out/share/dict"
|
|
|
|
cd scowl
|
|
|
|
./mk-list ${singleWordlist} > "$out/share/dict/words.txt"
|
2017-12-23 19:25:54 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
inherit version;
|
|
|
|
description = "Spell checker oriented word lists";
|
|
|
|
license = stdenv.lib.licenses.mit;
|
|
|
|
maintainers = [stdenv.lib.maintainers.raskin];
|
|
|
|
platforms = stdenv.lib.platforms.unix;
|
|
|
|
homepage = "http://wordlist.aspell.net/";
|
|
|
|
};
|
|
|
|
}
|