2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchurl
|
2022-05-18 14:49:53 +00:00
|
|
|
, Carbon
|
|
|
|
, libjpeg
|
|
|
|
, libpng
|
2020-04-24 23:36:52 +00:00
|
|
|
, withJpegSupport ? true # support jpeg output
|
|
|
|
, withPngSupport ? true # support png output
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "tachyon";
|
2022-08-12 12:06:08 +00:00
|
|
|
version = "0.99.5";
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "http://jedi.ks.uiuc.edu/~johns/tachyon/files/${version}/${pname}-${version}.tar.gz";
|
2022-08-12 12:06:08 +00:00
|
|
|
sha256 = "sha256-CSA8ECMRFJ9d9cw2dAn5bHJXQmZtGcJNtbqZTVqBpvU=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2021-02-05 17:12:51 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [
|
2020-04-24 23:36:52 +00:00
|
|
|
Carbon
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals withJpegSupport [
|
2020-04-24 23:36:52 +00:00
|
|
|
libjpeg
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals withPngSupport [
|
2020-04-24 23:36:52 +00:00
|
|
|
libpng
|
|
|
|
];
|
|
|
|
preBuild = ''
|
|
|
|
cd unix
|
2021-02-05 17:12:51 +00:00
|
|
|
'' + lib.optionalString withJpegSupport ''
|
2020-04-24 23:36:52 +00:00
|
|
|
export USEJPEG=" -DUSEJPEG"
|
|
|
|
export JPEGLIB=" -ljpeg"
|
2021-02-05 17:12:51 +00:00
|
|
|
'' + lib.optionalString withPngSupport ''
|
2020-04-24 23:36:52 +00:00
|
|
|
export USEPNG=" -DUSEPNG"
|
|
|
|
export PNGLIB=" -lpng -lz"
|
|
|
|
'';
|
|
|
|
arch = if stdenv.hostPlatform.system == "x86_64-linux" then "linux-64-thr" else
|
|
|
|
if stdenv.hostPlatform.system == "i686-linux" then "linux-thr" else
|
2021-03-20 04:20:00 +00:00
|
|
|
# 2021-03-29: multithread (-DTHR -D_REENTRANT) was disabled on linux-arm
|
|
|
|
# because it caused Sage's 3D plotting tests to hang indefinitely.
|
|
|
|
# see https://github.com/NixOS/nixpkgs/pull/117465
|
|
|
|
if stdenv.hostPlatform.system == "aarch64-linux" then "linux-arm" else
|
|
|
|
if stdenv.hostPlatform.system == "armv7l-linux" then "linux-arm" else
|
2024-04-21 15:54:59 +00:00
|
|
|
if stdenv.hostPlatform.system == "aarch64-darwin" then "macosx" else
|
2020-04-24 23:36:52 +00:00
|
|
|
if stdenv.hostPlatform.system == "x86_64-darwin" then "macosx-thr" else
|
|
|
|
if stdenv.hostPlatform.system == "i686-darwin" then "macosx-64-thr" else
|
|
|
|
if stdenv.hostPlatform.system == "i686-cygwin" then "win32" else
|
|
|
|
if stdenv.hostPlatform.system == "x86_64-freebsd" then "bsd" else
|
|
|
|
if stdenv.hostPlatform.system == "x686-freebsd" then "bsd" else
|
|
|
|
throw "Don't know what arch to select for tachyon build";
|
|
|
|
makeFlags = [ arch ];
|
2021-05-20 23:08:51 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
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
|
2021-05-20 23:08:51 +00:00
|
|
|
];
|
|
|
|
postPatch = ''
|
|
|
|
# Ensure looks for nix-provided Carbon, not system frameworks
|
|
|
|
substituteInPlace unix/Make-arch \
|
|
|
|
--replace '-F/System/Library/Frameworks' ""
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
cd ../compile/${arch}
|
|
|
|
mkdir -p "$out"/{bin,lib,include,share/doc/tachyon,share/tachyon}
|
|
|
|
cp tachyon "$out"/bin
|
|
|
|
cp libtachyon.* "$out/lib"
|
|
|
|
cd ../..
|
2020-06-18 07:06:33 +00:00
|
|
|
cp src/*.h "$out/include/"
|
2020-04-24 23:36:52 +00:00
|
|
|
cp Changes Copyright README "$out/share/doc/tachyon"
|
|
|
|
cp -r scenes "$out/share/tachyon/scenes"
|
|
|
|
'';
|
|
|
|
meta = {
|
2021-01-17 00:15:33 +00:00
|
|
|
description = "A Parallel / Multiprocessor Ray Tracing System";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "tachyon";
|
2021-02-05 17:12:51 +00:00
|
|
|
license = lib.licenses.bsd3;
|
|
|
|
maintainers = [lib.maintainers.raskin];
|
|
|
|
platforms = with lib.platforms; linux ++ cygwin ++ darwin;
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "http://jedi.ks.uiuc.edu/~johns/tachyon/";
|
|
|
|
};
|
|
|
|
}
|