2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchurl, ocaml, findlib, ocamlbuild, topkg, ctypes, result, SDL2, pkg-config, ocb-stubblr }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
if !lib.versionAtLeast ocaml.version "4.03"
|
2020-04-24 23:36:52 +00:00
|
|
|
then throw "tsdl is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
|
|
|
|
|
|
|
let
|
|
|
|
pname = "tsdl";
|
2020-05-03 17:38:23 +00:00
|
|
|
version = "0.9.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
webpage = "https://erratique.ch/software/${pname}";
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "ocaml${ocaml.version}-${pname}-${version}";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "${webpage}/releases/${pname}-${version}.tbz";
|
2020-05-03 17:38:23 +00:00
|
|
|
sha256 = "1zwv0ixkigh1gzk5n49rwvz2f2m62jdkkqg40j7dclg4gri7691f";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2020-05-03 17:38:23 +00:00
|
|
|
buildInputs = [ ocaml findlib ocamlbuild topkg ];
|
2020-04-24 23:36:52 +00:00
|
|
|
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;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = webpage;
|
|
|
|
description = "Thin bindings to the cross-platform SDL library";
|
2020-05-03 17:38:23 +00:00
|
|
|
license = licenses.isc;
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = ocaml.meta.platforms or [];
|
|
|
|
};
|
|
|
|
}
|