nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
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}:
15
16let
17 pname = "tsdl";
18 version = "1.1.0";
19 webpage = "https://erratique.ch/software/${pname}";
20in
21
22stdenv.mkDerivation {
23 pname = "ocaml${ocaml.version}-${pname}";
24 inherit version;
25
26 src = fetchurl {
27 url = "${webpage}/releases/${pname}-${version}.tbz";
28 hash = "sha256-ZN4+trqesU1IREKcwm1Ro37jszKG8XcVigoE4BdGhzs=";
29 };
30
31 strictDeps = true;
32
33 nativeBuildInputs = [
34 pkg-config
35 ocaml
36 findlib
37 ocamlbuild
38 topkg
39 ];
40 buildInputs = [ topkg ];
41 propagatedBuildInputs = [
42 SDL2
43 ctypes
44 ctypes-foreign
45 ];
46
47 preConfigure = ''
48 # The following is done to avoid an additional dependency (ncurses)
49 # due to linking in the custom bytecode runtime. Instead, just
50 # compile directly into a native binary, even if it's just a
51 # temporary build product.
52 substituteInPlace myocamlbuild.ml \
53 --replace ".byte" ".native"
54 '';
55
56 inherit (topkg) buildPhase installPhase;
57
58 meta = {
59 homepage = webpage;
60 description = "Thin bindings to the cross-platform SDL library";
61 license = lib.licenses.isc;
62 inherit (ocaml.meta) platforms;
63 broken = lib.versionOlder ocaml.version "4.03";
64 };
65}