jenkins: 2.479.3 -> 2.492.1
[NixPkgs.git] / pkgs / development / ocaml-modules / tsdl / default.nix
blobe57ebcb844793f18fb2dbd042bbc9ca1bdc74080
2   lib,
3   stdenv,
4   fetchurl,
5   ocaml,
6   findlib,
7   ocamlbuild,
8   topkg,
9   ctypes,
10   ctypes-foreign,
11   result,
12   SDL2,
13   pkg-config,
14   AudioToolbox,
15   Cocoa,
16   CoreAudio,
17   CoreVideo,
18   ForceFeedback,
21 if lib.versionOlder ocaml.version "4.03" then
22   throw "tsdl is not available for OCaml ${ocaml.version}"
23 else
25   let
26     pname = "tsdl";
27     version = "1.1.0";
28     webpage = "https://erratique.ch/software/${pname}";
29   in
31   stdenv.mkDerivation {
32     pname = "ocaml${ocaml.version}-${pname}";
33     inherit version;
35     src = fetchurl {
36       url = "${webpage}/releases/${pname}-${version}.tbz";
37       hash = "sha256-ZN4+trqesU1IREKcwm1Ro37jszKG8XcVigoE4BdGhzs=";
38     };
40     strictDeps = true;
42     nativeBuildInputs = [
43       pkg-config
44       ocaml
45       findlib
46       ocamlbuild
47       topkg
48     ];
49     buildInputs = [ topkg ];
50     propagatedBuildInputs =
51       [
52         SDL2
53         ctypes
54         ctypes-foreign
55       ]
56       ++ lib.optionals stdenv.hostPlatform.isDarwin [
57         AudioToolbox
58         Cocoa
59         CoreAudio
60         CoreVideo
61         ForceFeedback
62       ];
64     preConfigure = ''
65       # The following is done to avoid an additional dependency (ncurses)
66       # due to linking in the custom bytecode runtime. Instead, just
67       # compile directly into a native binary, even if it's just a
68       # temporary build product.
69       substituteInPlace myocamlbuild.ml \
70         --replace ".byte" ".native"
71     '';
73     inherit (topkg) buildPhase installPhase;
75     meta = with lib; {
76       homepage = webpage;
77       description = "Thin bindings to the cross-platform SDL library";
78       license = licenses.isc;
79       inherit (ocaml.meta) platforms;
80     };
81   }