mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-22 14:45:27 +00:00
4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
42 lines
1.3 KiB
Nix
42 lines
1.3 KiB
Nix
{ lib, stdenv, fetchurl
|
|
, ocaml, findlib, pkgconfig, perl
|
|
, gmp
|
|
}:
|
|
|
|
let source =
|
|
if stdenv.lib.versionAtLeast ocaml.version "4.02"
|
|
then {
|
|
version = "1.11";
|
|
url = "https://github.com/ocaml/Zarith/archive/release-1.11.tar.gz";
|
|
sha256 = "111n33flg4aq5xp5jfksqm4yyz6mzxx9ps9a4yl0dz8h189az5pr";
|
|
} else {
|
|
version = "1.3";
|
|
url = "http://forge.ocamlcore.org/frs/download.php/1471/zarith-1.3.tgz";
|
|
sha256 = "1mx3nxcn5h33qhx4gbg0hgvvydwlwdvdhqcnvfwnmf9jy3b8frll";
|
|
};
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
name = "ocaml${ocaml.version}-zarith-${version}";
|
|
inherit (source) version;
|
|
src = fetchurl { inherit (source) url sha256; };
|
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
|
buildInputs = [ ocaml findlib perl ];
|
|
propagatedBuildInputs = [ gmp ];
|
|
|
|
patchPhase = "patchShebangs ./z_pp.pl";
|
|
dontAddPrefix = true;
|
|
configureFlags = [ "-installdir ${placeholder "out"}/lib/ocaml/${ocaml.version}/site-lib" ];
|
|
|
|
preInstall = "mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/stublibs";
|
|
|
|
meta = with lib; {
|
|
description = "Fast, arbitrary precision OCaml integers";
|
|
homepage = "http://forge.ocamlcore.org/projects/zarith";
|
|
license = licenses.lgpl2;
|
|
inherit (ocaml.meta) platforms;
|
|
maintainers = with maintainers; [ thoughtpolice vbgl ];
|
|
};
|
|
}
|