2022-06-16 17:23:12 +00:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchurl
|
|
|
|
, buildDunePackage
|
|
|
|
, ocaml
|
|
|
|
, gen
|
|
|
|
, ppxlib
|
|
|
|
, uchar
|
2023-03-08 16:32:21 +00:00
|
|
|
, ppx_expect
|
2022-06-16 17:23:12 +00:00
|
|
|
}:
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
let param =
|
2023-03-08 16:32:21 +00:00
|
|
|
if lib.versionAtLeast ppxlib.version "0.26.0" then
|
2023-07-15 17:15:38 +00:00
|
|
|
{
|
|
|
|
version = "3.2";
|
|
|
|
sha256 = "sha256-5Vf1LRhSotNpTPzHmRgCMRYtrpgaspLlyzv1XdGt+u8=";
|
2023-03-08 16:32:21 +00:00
|
|
|
}
|
|
|
|
else {
|
2022-11-21 17:40:18 +00:00
|
|
|
version = "2.5";
|
|
|
|
sha256 = "sha256:062a5dvrzvb81l3a9phljrhxfw9nlb61q341q0a6xn65hll3z2wy";
|
|
|
|
}
|
|
|
|
; in
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
let
|
2022-09-22 12:36:57 +00:00
|
|
|
unicodeVersion = "15.0.0";
|
2022-06-16 17:23:12 +00:00
|
|
|
baseUrl = "https://www.unicode.org/Public/${unicodeVersion}";
|
|
|
|
|
|
|
|
DerivedCoreProperties = fetchurl {
|
|
|
|
url = "${baseUrl}/ucd/DerivedCoreProperties.txt";
|
2022-09-22 12:36:57 +00:00
|
|
|
sha256 = "sha256-02cpC8CGfmtITGg3BTC90aCLazJARgG4x6zK+D4FYo0=";
|
2022-06-16 17:23:12 +00:00
|
|
|
};
|
|
|
|
DerivedGeneralCategory = fetchurl {
|
|
|
|
url = "${baseUrl}/ucd/extracted/DerivedGeneralCategory.txt";
|
2022-09-22 12:36:57 +00:00
|
|
|
sha256 = "sha256-/imkXAiCUA5ZEUCqpcT1Bn5qXXRoBhSK80QAxIucBvk=";
|
2022-06-16 17:23:12 +00:00
|
|
|
};
|
|
|
|
PropList = fetchurl {
|
|
|
|
url = "${baseUrl}/ucd/PropList.txt";
|
2022-09-22 12:36:57 +00:00
|
|
|
sha256 = "sha256-4FwKKBHRE9rkq9gyiEGZo+qNGH7huHLYJAp4ipZUC/0=";
|
2022-06-16 17:23:12 +00:00
|
|
|
};
|
2023-03-08 16:32:21 +00:00
|
|
|
atLeast31 = lib.versionAtLeast param.version "3.1";
|
2022-06-16 17:23:12 +00:00
|
|
|
in
|
|
|
|
buildDunePackage rec {
|
|
|
|
pname = "sedlex";
|
2022-11-21 17:40:18 +00:00
|
|
|
inherit (param) version;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
minimalOCamlVersion = "4.08";
|
2023-03-24 00:07:29 +00:00
|
|
|
duneVersion = "3";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ocaml-community";
|
|
|
|
repo = "sedlex";
|
2022-06-16 17:23:12 +00:00
|
|
|
rev = "v${version}";
|
2022-11-21 17:40:18 +00:00
|
|
|
inherit (param) sha256;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
propagatedBuildInputs = [
|
2023-03-08 16:32:21 +00:00
|
|
|
gen
|
|
|
|
ppxlib
|
|
|
|
] ++ lib.optionals (!atLeast31) [
|
|
|
|
uchar
|
2022-06-16 17:23:12 +00:00
|
|
|
];
|
2022-03-05 16:20:37 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
preBuild = ''
|
|
|
|
rm src/generator/data/dune
|
|
|
|
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-04-24 23:36:52 +00:00
|
|
|
|
2023-03-08 16:32:21 +00:00
|
|
|
checkInputs = lib.optionals atLeast31 [
|
|
|
|
ppx_expect
|
|
|
|
];
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
doCheck = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = "https://github.com/ocaml-community/sedlex";
|
2022-06-16 17:23:12 +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";
|
2021-01-15 22:18:51 +00:00
|
|
|
license = lib.licenses.mit;
|
2024-05-15 15:35:15 +00:00
|
|
|
maintainers = [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|