ocamlPackages.sedlex_2: init at 2.1

This commit is contained in:
Mario Rodas 2020-01-18 16:20:00 -05:00
parent 0a65c2b7e9
commit 479bc9d9e6
No known key found for this signature in database
GPG key ID: 4C4BEFD7B18DC5E8
2 changed files with 71 additions and 0 deletions

View file

@ -0,0 +1,69 @@
{ stdenv
, fetchFromGitHub
, fetchurl
, ocaml
, dune
, findlib
, gen
, ppx_tools_versioned
, ocaml-migrate-parsetree
, uchar
}:
if stdenv.lib.versionOlder ocaml.version "4.02.3"
then throw "sedlex is not available for OCaml ${ocaml.version}"
else
let
DerivedCoreProperties = fetchurl {
url = "https://www.unicode.org/Public/12.1.0/ucd/DerivedCoreProperties.txt";
sha256 = "0s6sn1yr9qmb2i6gf8dir2zpsbjv1frdfzy3i2yjylzvf637msx6";
};
DerivedGeneralCategory = fetchurl {
url = "https://www.unicode.org/Public/12.1.0/ucd/extracted/DerivedGeneralCategory.txt";
sha256 = "1rifzq9ba6c58dn0lrmcb5l5k4ksx3zsdkira3m5p6h4i2wriy3q";
};
PropList = fetchurl {
url = "https://www.unicode.org/Public/12.1.0/ucd/PropList.txt";
sha256 = "0gsb1jpj3mnqbjgbavi4l95gl6g4agq58j82km22fdfg63j3w3fk";
};
in
stdenv.mkDerivation rec {
name = "ocaml${ocaml.version}-sedlex-${version}";
version = "2.1";
src = fetchFromGitHub {
owner = "ocaml-community";
repo = "sedlex";
rev = "v${version}";
sha256 = "05f6qa8x3vhpdz1fcnpqk37fpnyyq13icqsk2gww5idjnh6kng26";
};
buildInputs = [ ocaml findlib dune ppx_tools_versioned ocaml-migrate-parsetree ];
propagatedBuildInputs = [ gen uchar ];
preBuild = ''
ln -s ${DerivedCoreProperties} src/generator/data/DerivedCoreProperties.txt
ln -s ${DerivedGeneralCategory} src/generator/data/DerivedGeneralCategory.txt
ln -s ${PropList} src/generator/data/PropList.txt
'';
buildFlags = [ "build" ];
installPhase = ''
make INSTALL_ARGS="--prefix=$out --libdir=$OCAMLFIND_DESTDIR" install
'';
createFindlibDestdir = true;
dontStrip = true;
meta = {
homepage = https://github.com/ocaml-community/sedlex;
description = "An OCaml lexer generator for Unicode";
license = stdenv.lib.licenses.mit;
inherit (ocaml.meta) platforms;
maintainers = [ stdenv.lib.maintainers.marsam ];
};
}

View file

@ -839,6 +839,8 @@ let
sedlex = callPackage ../development/ocaml-modules/sedlex { };
sedlex_2 = callPackage ../development/ocaml-modules/sedlex/2.nix { };
sodium = callPackage ../development/ocaml-modules/sodium { };
spelll = callPackage ../development/ocaml-modules/spelll { };