2023-02-02 18:25:31 +00:00
|
|
|
{ lib, stdenv, fetchurl, ocaml, findlib, ocamlbuild, topkg, ctypes, result, SDL2, pkg-config
|
|
|
|
, AudioToolbox, Cocoa, CoreAudio, CoreVideo, ForceFeedback }:
|
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";
|
2023-01-11 07:51:40 +00:00
|
|
|
version = "0.9.9";
|
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";
|
2023-01-11 07:51:40 +00:00
|
|
|
sha256 = "sha256-GqFz+bYG2ESkAEJyP8DKud4JFfU5MGLulzJa5Z4sptQ=";
|
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 ];
|
2023-02-02 18:25:31 +00:00
|
|
|
propagatedBuildInputs = [ SDL2 ctypes ]
|
|
|
|
++ lib.optionals stdenv.isDarwin [ AudioToolbox Cocoa CoreAudio CoreVideo ForceFeedback ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|