summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/tsdl/default.nix
diff options
context:
space:
mode:
authorRicardo M. Correia <rcorreia@wizy.org>2016-02-20 15:39:08 +0100
committerRicardo M. Correia <rcorreia@wizy.org>2016-02-29 20:32:58 +0100
commitcac77dafc4809dbdab43b7a5d4dd0f046ffc8269 (patch)
treeb6639f93ea101a74f036345876626e773b774a3a /pkgs/development/ocaml-modules/tsdl/default.nix
parentabfc9e2afa90f30011832e42f25feb9815990200 (diff)
downloadnixpkgs-cac77dafc4809dbdab43b7a5d4dd0f046ffc8269.tar
nixpkgs-cac77dafc4809dbdab43b7a5d4dd0f046ffc8269.tar.gz
nixpkgs-cac77dafc4809dbdab43b7a5d4dd0f046ffc8269.tar.bz2
nixpkgs-cac77dafc4809dbdab43b7a5d4dd0f046ffc8269.tar.lz
nixpkgs-cac77dafc4809dbdab43b7a5d4dd0f046ffc8269.tar.xz
nixpkgs-cac77dafc4809dbdab43b7a5d4dd0f046ffc8269.tar.zst
nixpkgs-cac77dafc4809dbdab43b7a5d4dd0f046ffc8269.zip
ocamlPackages.tsdl: init at 0.9.0
Diffstat (limited to 'pkgs/development/ocaml-modules/tsdl/default.nix')
-rw-r--r--pkgs/development/ocaml-modules/tsdl/default.nix49
1 files changed, 49 insertions, 0 deletions
diff --git a/pkgs/development/ocaml-modules/tsdl/default.nix b/pkgs/development/ocaml-modules/tsdl/default.nix
new file mode 100644
index 00000000000..85ea80aeafe
--- /dev/null
+++ b/pkgs/development/ocaml-modules/tsdl/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchurl, ocaml, findlib, ctypes, result, SDL2, pkgconfig, opam }:
+
+let
+  inherit (stdenv.lib) getVersion;
+
+  pname = "tsdl";
+  version = "0.9.0";
+  webpage = "http://erratique.ch/software/${pname}";
+
+in
+
+stdenv.mkDerivation {
+  name = "ocaml-${pname}-${version}";
+
+  src = fetchurl {
+    url = "${webpage}/releases/${pname}-${version}.tbz";
+    sha256 = "02x0wsy5nxagxrh07yb2h4yqqy1bxryp2gwrylds0j6ybqsv4shm";
+  };
+
+  buildInputs = [ ocaml findlib result pkgconfig opam ];
+  propagatedBuildInputs = [ SDL2 ctypes ];
+
+  createFindlibDestdir = true;
+
+  unpackCmd = "tar xjf $src";
+
+  buildPhase = ''
+    # 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}
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "${webpage}";
+    description = "Thin bindings to the cross-platform SDL library";
+    license = licenses.bsd3;
+    platforms = ocaml.meta.platforms;
+  };
+}