2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchurl
|
|
|
|
, buildDunePackage
|
|
|
|
, ocaml
|
|
|
|
, gen
|
2021-04-25 03:57:28 +00:00
|
|
|
, ppxlib
|
2020-04-24 23:36:52 +00:00
|
|
|
, uchar
|
|
|
|
}:
|
|
|
|
|
2021-04-25 03:57:28 +00:00
|
|
|
if lib.versionOlder ocaml.version "4.08"
|
2020-04-24 23:36:52 +00:00
|
|
|
then throw "sedlex is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
|
|
|
|
|
|
|
let
|
2021-08-05 21:33:18 +00:00
|
|
|
unicodeVersion = "13.0.0";
|
2021-01-05 17:05:55 +00:00
|
|
|
baseUrl = "https://www.unicode.org/Public/${unicodeVersion}";
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
DerivedCoreProperties = fetchurl {
|
2021-01-05 17:05:55 +00:00
|
|
|
url = "${baseUrl}/ucd/DerivedCoreProperties.txt";
|
2021-08-05 21:33:18 +00:00
|
|
|
sha256 = "0j12x112cd8fpgazkc8izxnhhpia44p1m36ff8yapslxndcmzm55";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
DerivedGeneralCategory = fetchurl {
|
2021-01-05 17:05:55 +00:00
|
|
|
url = "${baseUrl}/ucd/extracted/DerivedGeneralCategory.txt";
|
2021-08-05 21:33:18 +00:00
|
|
|
sha256 = "0w6mkz4w79k23bnmwgfxc4yqc2ypv8ilrjn6nk25hrafksbg00j5";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
PropList = fetchurl {
|
2021-01-05 17:05:55 +00:00
|
|
|
url = "${baseUrl}/ucd/PropList.txt";
|
2021-08-05 21:33:18 +00:00
|
|
|
sha256 = "1ks0585wimygbk2wqi9hqg8gyl25iffvdad5vya1zgsxs8z5lns8";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
buildDunePackage rec {
|
|
|
|
pname = "sedlex";
|
2021-08-05 21:33:18 +00:00
|
|
|
version = "2.4";
|
2021-01-05 17:05:55 +00:00
|
|
|
|
|
|
|
useDune2 = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ocaml-community";
|
|
|
|
repo = "sedlex";
|
|
|
|
rev = "v${version}";
|
2021-08-05 21:33:18 +00:00
|
|
|
sha256 = "13g8az4zqg6hrnxmy3qrasslppzlag13dd1dsr8vlpg2vpfmfv6i";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
2021-04-25 03:57:28 +00:00
|
|
|
gen uchar ppxlib
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
preBuild = ''
|
2021-01-05 17:05:55 +00:00
|
|
|
rm src/generator/data/dune
|
2020-04-24 23:36:52 +00:00
|
|
|
ln -s ${DerivedCoreProperties} src/generator/data/DerivedCoreProperties.txt
|
|
|
|
ln -s ${DerivedGeneralCategory} src/generator/data/DerivedGeneralCategory.txt
|
|
|
|
ln -s ${PropList} src/generator/data/PropList.txt
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = "https://github.com/ocaml-community/sedlex";
|
2021-04-25 03:57:28 +00:00
|
|
|
changelog = "https://github.com/ocaml-community/sedlex/raw/v${version}/CHANGES";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "An OCaml lexer generator for Unicode";
|
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = [ lib.maintainers.marsam ];
|
|
|
|
};
|
|
|
|
}
|