2017-07-12 21:27:37 +02:00
|
|
|
{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, topkg, ctypes, result, SDL2, pkgconfig, opam, ocb-stubblr }:
|
2016-02-20 15:39:08 +01:00
|
|
|
|
2017-07-12 21:27:37 +02:00
|
|
|
if !stdenv.lib.versionAtLeast ocaml.version "4.02"
|
|
|
|
then throw "tsdl is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
2016-02-20 15:39:08 +01:00
|
|
|
|
2017-07-12 21:27:37 +02:00
|
|
|
let
|
2016-02-20 15:39:08 +01:00
|
|
|
pname = "tsdl";
|
2017-07-12 21:27:37 +02:00
|
|
|
version = "0.9.4";
|
2016-02-20 15:39:08 +01:00
|
|
|
webpage = "http://erratique.ch/software/${pname}";
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2017-07-12 21:27:37 +02:00
|
|
|
name = "ocaml${ocaml.version}-${pname}-${version}";
|
2016-02-20 15:39:08 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "${webpage}/releases/${pname}-${version}.tbz";
|
2017-07-12 21:27:37 +02:00
|
|
|
sha256 = "13af37w2wybx8yzgjr5zz5l50402ldl614qiwphl1q69hig5mag2";
|
2016-02-20 15:39:08 +01:00
|
|
|
};
|
|
|
|
|
2017-09-05 23:26:13 +02:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
|
|
|
buildInputs = [ ocaml findlib ocamlbuild topkg result opam ocb-stubblr ];
|
2016-02-20 15:39:08 +01:00
|
|
|
propagatedBuildInputs = [ SDL2 ctypes ];
|
|
|
|
|
|
|
|
createFindlibDestdir = true;
|
|
|
|
|
|
|
|
unpackCmd = "tar xjf $src";
|
|
|
|
|
2017-07-12 21:27:37 +02:00
|
|
|
preConfigure = ''
|
2016-02-20 15:39:08 +01: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 21:27:37 +02:00
|
|
|
inherit (topkg) buildPhase installPhase;
|
2016-02-20 15:39:08 +01:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = "${webpage}";
|
|
|
|
description = "Thin bindings to the cross-platform SDL library";
|
|
|
|
license = licenses.bsd3;
|
2015-12-24 18:49:07 +01:00
|
|
|
platforms = ocaml.meta.platforms or [];
|
2016-02-20 15:39:08 +01:00
|
|
|
};
|
|
|
|
}
|