2020-03-08 15:58:47 +00:00
|
|
|
{ lib
|
2020-01-18 21:20:00 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchurl
|
2020-03-08 15:58:47 +00:00
|
|
|
, buildDunePackage
|
2020-01-18 21:20:00 +00:00
|
|
|
, ocaml
|
|
|
|
, gen
|
2021-04-16 04:20:00 +00:00
|
|
|
, ppxlib
|
2020-01-18 21:20:00 +00:00
|
|
|
, uchar
|
|
|
|
}:
|
|
|
|
|
2021-04-16 04:20:00 +00:00
|
|
|
if lib.versionOlder ocaml.version "4.08"
|
2020-01-18 21:20:00 +00:00
|
|
|
then throw "sedlex is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
|
|
|
|
|
|
|
let
|
2021-01-01 14:55:15 +00:00
|
|
|
unicodeVersion = "12.1.0";
|
|
|
|
baseUrl = "https://www.unicode.org/Public/${unicodeVersion}";
|
|
|
|
|
2020-01-18 21:20:00 +00:00
|
|
|
DerivedCoreProperties = fetchurl {
|
2021-01-01 14:55:15 +00:00
|
|
|
url = "${baseUrl}/ucd/DerivedCoreProperties.txt";
|
2020-01-18 21:20:00 +00:00
|
|
|
sha256 = "0s6sn1yr9qmb2i6gf8dir2zpsbjv1frdfzy3i2yjylzvf637msx6";
|
|
|
|
};
|
|
|
|
DerivedGeneralCategory = fetchurl {
|
2021-01-01 14:55:15 +00:00
|
|
|
url = "${baseUrl}/ucd/extracted/DerivedGeneralCategory.txt";
|
2020-01-18 21:20:00 +00:00
|
|
|
sha256 = "1rifzq9ba6c58dn0lrmcb5l5k4ksx3zsdkira3m5p6h4i2wriy3q";
|
|
|
|
};
|
|
|
|
PropList = fetchurl {
|
2021-01-01 14:55:15 +00:00
|
|
|
url = "${baseUrl}/ucd/PropList.txt";
|
2020-01-18 21:20:00 +00:00
|
|
|
sha256 = "0gsb1jpj3mnqbjgbavi4l95gl6g4agq58j82km22fdfg63j3w3fk";
|
|
|
|
};
|
|
|
|
in
|
2020-03-08 15:58:47 +00:00
|
|
|
buildDunePackage rec {
|
|
|
|
pname = "sedlex";
|
2021-04-16 04:20:00 +00:00
|
|
|
version = "2.3";
|
2021-01-01 14:55:15 +00:00
|
|
|
|
|
|
|
useDune2 = true;
|
2020-01-18 21:20:00 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ocaml-community";
|
|
|
|
repo = "sedlex";
|
|
|
|
rev = "v${version}";
|
2021-04-16 04:20:00 +00:00
|
|
|
sha256 = "0iw3phlaqr27jdf857hmj5v5hdl0vngbb2h37p2ll18sw991fxar";
|
2020-01-18 21:20:00 +00:00
|
|
|
};
|
|
|
|
|
2020-04-07 16:56:32 +00:00
|
|
|
propagatedBuildInputs = [
|
2021-04-16 04:20:00 +00:00
|
|
|
gen uchar ppxlib
|
2020-04-07 16:56:32 +00:00
|
|
|
];
|
2020-01-18 21:20:00 +00:00
|
|
|
|
|
|
|
preBuild = ''
|
2021-01-01 14:55:15 +00:00
|
|
|
rm src/generator/data/dune
|
2020-01-18 21:20:00 +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
|
|
|
|
'';
|
|
|
|
|
2020-03-08 15:58:47 +00:00
|
|
|
doCheck = true;
|
2020-01-18 21:20:00 +00:00
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
|
|
|
|
meta = {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://github.com/ocaml-community/sedlex";
|
2021-04-16 04:20:00 +00:00
|
|
|
changelog = "https://github.com/ocaml-community/sedlex/raw/v${version}/CHANGES";
|
2020-01-18 21:20:00 +00:00
|
|
|
description = "An OCaml lexer generator for Unicode";
|
2020-03-08 15:58:47 +00:00
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = [ lib.maintainers.marsam ];
|
2020-01-18 21:20:00 +00:00
|
|
|
};
|
|
|
|
}
|