summary refs log tree commit diff
path: root/pkgs/development/libraries/tachyon/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/tachyon/default.nix')
-rw-r--r--pkgs/development/libraries/tachyon/default.nix57
1 files changed, 49 insertions, 8 deletions
diff --git a/pkgs/development/libraries/tachyon/default.nix b/pkgs/development/libraries/tachyon/default.nix
index b1649da6459..53e48eb8931 100644
--- a/pkgs/development/libraries/tachyon/default.nix
+++ b/pkgs/development/libraries/tachyon/default.nix
@@ -1,17 +1,57 @@
-{stdenv, fetchurl}:
+{ stdenv
+, fetchurl
+, fetchpatch
+, Carbon ? null
+, libjpeg ? null
+, libpng ? null
+, withJpegSupport ? true # support jpeg output
+, withPngSupport ? true # support png output
+}:
+
+assert withJpegSupport -> libjpeg != null;
+assert withPngSupport -> libpng != null;
+assert stdenv.isDarwin -> Carbon != null;
+
 stdenv.mkDerivation rec {
   name = "tachyon-${version}";
-  version = "0.98.9";
+  version = "0.99b2";
   src = fetchurl {
     url = "http://jedi.ks.uiuc.edu/~johns/tachyon/files/${version}/${name}.tar.gz";
-    sha256 = "1ms0xr4ibrzz291ibm265lyjrdjrmhfrx0a70hwykhsdxn6jk8y6";
+    sha256 = "04m0bniszyg7ryknj8laj3rl5sspacw5nr45x59j2swcsxmdvn1v";
   };
-  buildInputs = [];
-  preBuild = "cd unix";
-  arch = if stdenv.system == "x86_64-linux" then "linux-64-thr" else
-         if stdenv.system == "i686-linux"   then "linux-thr"    else
+  buildInputs = stdenv.lib.optionals stdenv.isDarwin [
+    Carbon
+  ] ++ stdenv.lib.optionals withJpegSupport [
+    libjpeg
+  ] ++ stdenv.lib.optionals withPngSupport [
+    libpng
+  ];
+  preBuild = ''
+    cd unix
+  '' + stdenv.lib.optionalString withJpegSupport ''
+    export USEJPEG=" -DUSEJPEG"
+    export JPEGLIB=" -ljpeg"
+  '' + stdenv.lib.optionalString withPngSupport ''
+    export USEPNG=" -DUSEPNG"
+    export PNGLIB=" -lpng -lz"
+  '';
+  arch = if stdenv.system == "x86_64-linux"   then "linux-64-thr"  else
+         if stdenv.system == "i686-linux"     then "linux-thr"     else
+         if stdenv.system == "aarch64-linux"  then "linux-arm-thr" else
+         if stdenv.system == "x86_64-darwin"  then "macosx-thr"    else
+         if stdenv.system == "i686-darwin"    then "macosx-64-thr" else
+         if stdenv.system == "i686-cygwin"    then "win32"         else
+         if stdenv.system == "x86_64-freebsd" then "bsd"           else
+         if stdenv.system == "x686-freebsd"   then "bsd"           else
          throw "Don't know what arch to select for tachyon build";
   makeFlags = "${arch}";
+  patches = [
+    # Remove absolute paths in Make-config (and unset variables so they can be set in preBuild)
+    ./no-absolute-paths.patch
+    # Include new targets (like arm)
+    ./make-archs.patch
+  ];
+
   installPhase = ''
     cd ../compile/${arch}
     mkdir -p "$out"/{bin,lib,include,share/doc/tachyon,share/tachyon}
@@ -26,7 +66,8 @@ stdenv.mkDerivation rec {
     description = ''A Parallel / Multiprocessor Ray Tracing System'';
     license = stdenv.lib.licenses.bsd3;
     maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
+    # darwin fails due to missing Carbon.h, even though Carbon is a build input
+    platforms = with stdenv.lib.platforms; linux ++ cygwin;
     homepage = http://jedi.ks.uiuc.edu/~johns/tachyon/;
   };
 }