2017-12-14 07:36:29 +00:00
|
|
|
{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, topkg, ctypes, result, SDL2, pkgconfig, ocb-stubblr }:
|
2016-02-20 14:39:08 +00:00
|
|
|
|
2020-04-26 02:56:46 +00:00
|
|
|
if !stdenv.lib.versionAtLeast ocaml.version "4.03"
|
2017-07-12 19:27:37 +00:00
|
|
|
then throw "tsdl is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
2016-02-20 14:39:08 +00:00
|
|
|
|
2017-07-12 19:27:37 +00:00
|
|
|
let
|
2016-02-20 14:39:08 +00:00
|
|
|
pname = "tsdl";
|
2020-04-26 02:56:46 +00:00
|
|
|
version = "0.9.7";
|
2019-04-22 08:14:28 +00:00
|
|
|
webpage = "https://erratique.ch/software/${pname}";
|
2016-02-20 14:39:08 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2017-07-12 19:27:37 +00:00
|
|
|
name = "ocaml${ocaml.version}-${pname}-${version}";
|
2016-02-20 14:39:08 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "${webpage}/releases/${pname}-${version}.tbz";
|
2020-04-26 02:56:46 +00:00
|
|
|
sha256 = "1zwv0ixkigh1gzk5n49rwvz2f2m62jdkkqg40j7dclg4gri7691f";
|
2016-02-20 14:39:08 +00:00
|
|
|
};
|
|
|
|
|
2017-09-05 21:26:13 +00:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
2020-04-26 02:56:46 +00:00
|
|
|
buildInputs = [ ocaml findlib ocamlbuild topkg ];
|
2016-02-20 14:39:08 +00:00
|
|
|
propagatedBuildInputs = [ SDL2 ctypes ];
|
|
|
|
|
2017-07-12 19:27:37 +00:00
|
|
|
preConfigure = ''
|
2016-02-20 14:39:08 +00:00
|
|
|
# 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"
|
|
|
|
'';
|
|
|
|
|
2017-07-12 19:27:37 +00:00
|
|
|
inherit (topkg) buildPhase installPhase;
|
2016-02-20 14:39:08 +00:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
2019-09-08 23:38:31 +00:00
|
|
|
homepage = webpage;
|
2016-02-20 14:39:08 +00:00
|
|
|
description = "Thin bindings to the cross-platform SDL library";
|
2020-04-26 02:56:46 +00:00
|
|
|
license = licenses.isc;
|
2015-12-24 17:49:07 +00:00
|
|
|
platforms = ocaml.meta.platforms or [];
|
2016-02-20 14:39:08 +00:00
|
|
|
};
|
|
|
|
}
|