nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 autoconf,
6 automake,
7 boost,
8 zlib,
9 libX11,
10 libICE,
11 libSM,
12 libpng,
13 libjpeg,
14 libtiff,
15 pkg-config,
16 SDL2,
17}:
18
19stdenv.mkDerivation (finalAttrs: {
20 pname = "povray";
21 version = "3.8.0-beta.2";
22
23 src = fetchFromGitHub {
24 owner = "POV-Ray";
25 repo = "povray";
26 rev = "v${finalAttrs.version}";
27 sha256 = "sha256-BsWalXzEnymiRbBfE/gsNyWgAqzbxEzO/EQiJpbwoKs=";
28 };
29
30 nativeBuildInputs = [
31 automake
32 autoconf
33 pkg-config
34 ];
35
36 buildInputs = [
37 boost
38 libX11
39 libICE
40 libSM
41 libpng
42 libjpeg
43 libtiff
44 SDL2
45 zlib
46 ];
47
48 # the installPhase wants to put files into $HOME. I let it put the files
49 # to $TMPDIR, so they don't get into the $out
50 postPatch = ''
51 cd unix
52 ./prebuild.sh
53 cd ..
54 sed -i -e 's/^povconfuser.*/povconfuser=$(TMPDIR)\/povray/' Makefile.{am,in}
55 sed -i -e 's/^povuser.*/povuser=$(TMPDIR)\/.povray/' Makefile.{am,in}
56 sed -i -e 's/^povowner.*/povowner=nobody/' Makefile.{am,in}
57 sed -i -e 's/^povgroup.*/povgroup=nogroup/' Makefile.{am,in}
58 '';
59
60 # https://github.com/POV-Ray/povray/issues/460
61 env.NIX_CFLAGS_COMPILE = toString [
62 "-fno-finite-math-only"
63 "-DBOOST_BIND_GLOBAL_PLACEHOLDERS"
64 ];
65
66 configureFlags = [
67 "COMPILED_BY=NixOS"
68 "--with-boost-thread=boost_thread"
69 "--with-x"
70 ];
71
72 enableParallelBuilding = true;
73
74 preInstall = ''
75 mkdir "$TMP/bin"
76 for i in chown chgrp; do
77 echo '#!${stdenv.shell}' >> "$TMP/bin/$i"
78 chmod +x "$TMP/bin/$i"
79 PATH="$TMP/bin:$PATH"
80 done
81 '';
82
83 meta = {
84 homepage = "http://www.povray.org/";
85 description = "Persistence of Vision Raytracer";
86 license = lib.licenses.free;
87 platforms = lib.platforms.linux;
88 mainProgram = "povray";
89 maintainers = with lib.maintainers; [ fgaz ];
90 };
91})