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
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
if lib.versionOlder 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";
|
2022-06-16 17:23:12 +00:00
|
|
|
version = "0.9.8";
|
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";
|
2022-06-16 17:23:12 +00:00
|
|
|
sha256 = "sha256-zjXz2++42FHmbE0nIDeryNQeX+avGwh9rwAs8O0pZYU=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ocaml findlib ocamlbuild topkg ];
|
|
|
|
buildInputs = [ 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;
|
2022-05-18 14:49:53 +00:00
|
|
|
inherit (ocaml.meta) platforms;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|