1 { lib, stdenv, fetchurl, ocaml, findlib, ocamlbuild, topkg, ctypes, ctypes-foreign, result, SDL2, pkg-config
2 , AudioToolbox, Cocoa, CoreAudio, CoreVideo, ForceFeedback }:
4 if lib.versionOlder ocaml.version "4.03"
5 then throw "tsdl is not available for OCaml ${ocaml.version}"
11 webpage = "https://erratique.ch/software/${pname}";
15 pname = "ocaml${ocaml.version}-${pname}";
19 url = "${webpage}/releases/${pname}-${version}.tbz";
20 hash = "sha256-ZN4+trqesU1IREKcwm1Ro37jszKG8XcVigoE4BdGhzs=";
25 nativeBuildInputs = [ pkg-config ocaml findlib ocamlbuild topkg ];
26 buildInputs = [ topkg ];
27 propagatedBuildInputs = [ SDL2 ctypes ctypes-foreign ]
28 ++ lib.optionals stdenv.hostPlatform.isDarwin [ AudioToolbox Cocoa CoreAudio CoreVideo ForceFeedback ];
31 # The following is done to avoid an additional dependency (ncurses)
32 # due to linking in the custom bytecode runtime. Instead, just
33 # compile directly into a native binary, even if it's just a
34 # temporary build product.
35 substituteInPlace myocamlbuild.ml \
36 --replace ".byte" ".native"
39 inherit (topkg) buildPhase installPhase;
43 description = "Thin bindings to the cross-platform SDL library";
44 license = licenses.isc;
45 inherit (ocaml.meta) platforms;