nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 20.03 42 lines 1.3 kB view raw
1{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, topkg, ctypes, result, SDL2, pkgconfig, ocb-stubblr }: 2 3if !stdenv.lib.versionAtLeast ocaml.version "4.02" 4then throw "tsdl is not available for OCaml ${ocaml.version}" 5else 6 7let 8 pname = "tsdl"; 9 version = "0.9.4"; 10 webpage = "https://erratique.ch/software/${pname}"; 11in 12 13stdenv.mkDerivation { 14 name = "ocaml${ocaml.version}-${pname}-${version}"; 15 16 src = fetchurl { 17 url = "${webpage}/releases/${pname}-${version}.tbz"; 18 sha256 = "13af37w2wybx8yzgjr5zz5l50402ldl614qiwphl1q69hig5mag2"; 19 }; 20 21 nativeBuildInputs = [ pkgconfig ]; 22 buildInputs = [ ocaml findlib ocamlbuild topkg result ocb-stubblr ]; 23 propagatedBuildInputs = [ SDL2 ctypes ]; 24 25 preConfigure = '' 26 # The following is done to avoid an additional dependency (ncurses) 27 # due to linking in the custom bytecode runtime. Instead, just 28 # compile directly into a native binary, even if it's just a 29 # temporary build product. 30 substituteInPlace myocamlbuild.ml \ 31 --replace ".byte" ".native" 32 ''; 33 34 inherit (topkg) buildPhase installPhase; 35 36 meta = with stdenv.lib; { 37 homepage = webpage; 38 description = "Thin bindings to the cross-platform SDL library"; 39 license = licenses.bsd3; 40 platforms = ocaml.meta.platforms or []; 41 }; 42}