summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/tsdl/default.nix
diff options
context:
space:
mode:
authorVincent Laporte <Vincent.Laporte@gmail.com>2017-07-12 19:27:37 +0000
committerVincent Laporte <Vincent.Laporte@gmail.com>2017-07-12 19:40:00 +0000
commite47dcb9cefdf154450382662fb59db0593eb773f (patch)
tree494a891cf1780a37cfdaaad1a073d8d50e6b5106 /pkgs/development/ocaml-modules/tsdl/default.nix
parent575ce53d14bb7ee0bf9e7da3e834bd463924746a (diff)
downloadnixpkgs-e47dcb9cefdf154450382662fb59db0593eb773f.tar
nixpkgs-e47dcb9cefdf154450382662fb59db0593eb773f.tar.gz
nixpkgs-e47dcb9cefdf154450382662fb59db0593eb773f.tar.bz2
nixpkgs-e47dcb9cefdf154450382662fb59db0593eb773f.tar.lz
nixpkgs-e47dcb9cefdf154450382662fb59db0593eb773f.tar.xz
nixpkgs-e47dcb9cefdf154450382662fb59db0593eb773f.tar.zst
nixpkgs-e47dcb9cefdf154450382662fb59db0593eb773f.zip
ocamlPackages.tsdl: 0.9.0 -> 0.9.4
Diffstat (limited to 'pkgs/development/ocaml-modules/tsdl/default.nix')
-rw-r--r--pkgs/development/ocaml-modules/tsdl/default.nix26
1 files changed, 11 insertions, 15 deletions
diff --git a/pkgs/development/ocaml-modules/tsdl/default.nix b/pkgs/development/ocaml-modules/tsdl/default.nix
index d47d5d3169b..01fa5b7ba6a 100644
--- a/pkgs/development/ocaml-modules/tsdl/default.nix
+++ b/pkgs/development/ocaml-modules/tsdl/default.nix
@@ -1,44 +1,40 @@
-{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, ctypes, result, SDL2, pkgconfig, opam }:
+{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, topkg, ctypes, result, SDL2, pkgconfig, opam, ocb-stubblr }:
 
-let
-  inherit (stdenv.lib) getVersion;
+if !stdenv.lib.versionAtLeast ocaml.version "4.02"
+then throw "tsdl is not available for OCaml ${ocaml.version}"
+else
 
+let
   pname = "tsdl";
-  version = "0.9.0";
+  version = "0.9.4";
   webpage = "http://erratique.ch/software/${pname}";
-
 in
 
 stdenv.mkDerivation {
-  name = "ocaml-${pname}-${version}";
+  name = "ocaml${ocaml.version}-${pname}-${version}";
 
   src = fetchurl {
     url = "${webpage}/releases/${pname}-${version}.tbz";
-    sha256 = "02x0wsy5nxagxrh07yb2h4yqqy1bxryp2gwrylds0j6ybqsv4shm";
+    sha256 = "13af37w2wybx8yzgjr5zz5l50402ldl614qiwphl1q69hig5mag2";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild result pkgconfig opam ];
+  buildInputs = [ ocaml findlib ocamlbuild topkg result pkgconfig opam ocb-stubblr ];
   propagatedBuildInputs = [ SDL2 ctypes ];
 
   createFindlibDestdir = true;
 
   unpackCmd = "tar xjf $src";
 
-  buildPhase = ''
+  preConfigure = ''
     # 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"
-
-    ocaml pkg/build.ml native=true native-dynlink=true
   '';
 
-  installPhase = ''
-    opam-installer --script --prefix=$out ${pname}.install | sh
-    ln -s $out/lib/${pname} $out/lib/ocaml/${getVersion ocaml}/site-lib/${pname}
-  '';
+  inherit (topkg) buildPhase installPhase;
 
   meta = with stdenv.lib; {
     homepage = "${webpage}";