aboutsummaryrefslogtreecommitdiff
path: root/pkgs/development/libraries/tachyon
diff options
context:
space:
mode:
authorTimo Kaufmann <timokau@zoho.com>2018-03-30 14:21:15 +0200
committerTimo Kaufmann <timokau@zoho.com>2018-04-09 16:05:15 +0200
commitc7acd932548d1da20c7b912562200edf68aa4600 (patch)
tree9919a4864056a62ad16522764d7f7245e6bbb367 /pkgs/development/libraries/tachyon
parentc78c7645478ba95f8c654ed79e63a6e7f715c82d (diff)
tachyon: Add support for jpeg, png, more platforms
Diffstat (limited to 'pkgs/development/libraries/tachyon')
-rw-r--r--pkgs/development/libraries/tachyon/default.nix53
-rw-r--r--pkgs/development/libraries/tachyon/make-archs.patch37
-rw-r--r--pkgs/development/libraries/tachyon/no-absolute-paths.patch57
3 files changed, 141 insertions, 6 deletions
diff --git a/pkgs/development/libraries/tachyon/default.nix b/pkgs/development/libraries/tachyon/default.nix
index e4a24279c9b4..53e48eb89317 100644
--- a/pkgs/development/libraries/tachyon/default.nix
+++ b/pkgs/development/libraries/tachyon/default.nix
@@ -1,4 +1,17 @@
-{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.99b2";
@@ -6,12 +19,39 @@ stdenv.mkDerivation rec {
url = "http://jedi.ks.uiuc.edu/~johns/tachyon/files/${version}/${name}.tar.gz";
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/;
};
}
diff --git a/pkgs/development/libraries/tachyon/make-archs.patch b/pkgs/development/libraries/tachyon/make-archs.patch
new file mode 100644
index 000000000000..cf83f8c8c31c
--- /dev/null
+++ b/pkgs/development/libraries/tachyon/make-archs.patch
@@ -0,0 +1,37 @@
+diff --git a/unix/Make-arch b/unix/Make-arch
+index 08afb85..dbeb691 100644
+--- a/unix/Make-arch
++++ b/unix/Make-arch
+@@ -920,6 +920,15 @@ macosx:
+ "RANLIB = ranlib" \
+ "LIBS = -L. -ltachyon $(MISCLIB)"
+
++macosx-64:
++ $(MAKE) all \
++ "ARCH = macosx" \
++ "CFLAGS = -Os -m64 -ffast-math -DBsd $(MISCFLAGS)" \
++ "ARFLAGS = r" \
++ "STRIP = strip" \
++ "RANLIB = ranlib" \
++ "LIBS = -L. -ltachyon $(MISCLIB)"
++
+ macosx-thr:
+ $(MAKE) all \
+ "ARCH = macosx-thr" \
+@@ -1209,6 +1218,16 @@ linux-thr:
+ "RANLIB = ranlib" \
+ "LIBS = -L. -ltachyon $(MISCLIB) -lm -lpthread"
+
++# Linux Arm using gcc, with threads
++linux-arm-thr:
++ $(MAKE) all \
++ "ARCH = linux-arm-thr" \
++ "CFLAGS = -Wall -O3 -fomit-frame-pointer -ffast-math -DLinux -DTHR -D_REENTRANT $(MISCFLAGS)" \
++ "ARFLAGS = r" \
++ "STRIP = strip" \
++ "RANLIB = ranlib" \
++ "LIBS = -L. -ltachyon $(MISCLIB) -lm -lpthread"
++
+ # Linux x86 using gcc, threads, and OpenGL
+ linux-thr-ogl:
+ $(MAKE) all \
diff --git a/pkgs/development/libraries/tachyon/no-absolute-paths.patch b/pkgs/development/libraries/tachyon/no-absolute-paths.patch
new file mode 100644
index 000000000000..faa3810fb5c6
--- /dev/null
+++ b/pkgs/development/libraries/tachyon/no-absolute-paths.patch
@@ -0,0 +1,57 @@
+diff --git a/unix/Make-config b/unix/Make-config
+index ee4f388..c1d51d4 100644
+--- a/unix/Make-config
++++ b/unix/Make-config
+@@ -18,7 +18,7 @@
+ # Bourne Shell Configuration:
+ # set SHELL=/bin/sh or wherever your bourne shell is
+ ##########################################################################
+-SHELL=/bin/sh
++# SHELL=/bin/sh
+
+
+
+@@ -30,7 +30,7 @@ SHELL=/bin/sh
+
+ # The following line should be set to -Ixxx where xxx is your X11 include path
+ # Sun puts X11 in /usr/openwin/xxx
+-X11INC= -I/usr/openwin/include
++# X11INC= -I/usr/openwin/include
+
+ # Others typically use /usr/X11 or /usr/X11R6
+ #X11INC= -I/usr/X11
+@@ -57,7 +57,7 @@ X11LIB= -lX11
+ ##########################################################################
+
+ # Standard MPICH installation location
+-MPIDIR=/usr/local/mpi
++# MPIDIR=/usr/local/mpi
+
+ # UMR CS Dept
+ #MPIDIR=/software/all/mpi
+@@ -108,9 +108,9 @@ MBOX=
+ # http://www.ijg.org/files/
+ ##########################################################################
+ # Uncomment the following lines to disable JPEG support
+-USEJPEG=
+-JPEGINC=
+-JPEGLIB=
++# USEJPEG=
++# JPEGINC=
++# JPEGLIB=
+
+ # Uncomment the following lines to enable JPEG support
+ #USEJPEG= -DUSEJPEG
+@@ -128,9 +128,9 @@ JPEGLIB=
+ # http://www.libpng.org/
+ ##########################################################################
+ # Uncomment the following lines to disable PNG support
+-USEPNG=
+-PNGINC=
+-PNGLIB=
++# USEPNG=
++# PNGINC=
++# PNGLIB=
+
+ # Uncomment the following lines to enable PNG support
+ #USEPNG= -DUSEPNG