forked from mirrors/nixpkgs
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
43 lines
1.2 KiB
Nix
43 lines
1.2 KiB
Nix
{ lib, stdenv, fetchurl, ocaml, findlib, ocamlbuild, topkg, ctypes, result, SDL2, pkgconfig, ocb-stubblr }:
|
|
|
|
if !stdenv.lib.versionAtLeast ocaml.version "4.03"
|
|
then throw "tsdl is not available for OCaml ${ocaml.version}"
|
|
else
|
|
|
|
let
|
|
pname = "tsdl";
|
|
version = "0.9.7";
|
|
webpage = "https://erratique.ch/software/${pname}";
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
name = "ocaml${ocaml.version}-${pname}-${version}";
|
|
|
|
src = fetchurl {
|
|
url = "${webpage}/releases/${pname}-${version}.tbz";
|
|
sha256 = "1zwv0ixkigh1gzk5n49rwvz2f2m62jdkkqg40j7dclg4gri7691f";
|
|
};
|
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
|
buildInputs = [ ocaml findlib ocamlbuild topkg ];
|
|
propagatedBuildInputs = [ SDL2 ctypes ];
|
|
|
|
preConfigure = ''
|
|
# The following is done to avoid an additional dependency (ncurses)
|
|
# due to linking in the custom bytecode runtime. Instead, just
|
|
# compile directly into a native binary, even if it's just a
|
|
# temporary build product.
|
|
substituteInPlace myocamlbuild.ml \
|
|
--replace ".byte" ".native"
|
|
'';
|
|
|
|
inherit (topkg) buildPhase installPhase;
|
|
|
|
meta = with lib; {
|
|
homepage = webpage;
|
|
description = "Thin bindings to the cross-platform SDL library";
|
|
license = licenses.isc;
|
|
platforms = ocaml.meta.platforms or [];
|
|
};
|
|
}
|