1{ stdenv, fetchgit, libX11, libXext, gettext, libICE, libXtst, libXi, libSM, xorgserver
2, autoconf, automake, cvs, libtool, nasm, utilmacros, pixman, xkbcomp, xkeyboard_config
3, fontDirectories, fontutil, libgcrypt, gnutls, pam, flex, bison
4, fixesproto, damageproto, xcmiscproto, bigreqsproto, randrproto, renderproto
5, fontsproto, videoproto, compositeproto, scrnsaverproto, resourceproto
6, libxkbfile, libXfont, libpciaccess, cmake, libjpeg_turbo, libXft, fltk, libXinerama
7, xineramaproto, libXcursor
8}:
9
10with stdenv.lib;
11
12stdenv.mkDerivation rec {
13 version = "git-20150504";
14 name = "tigervnc-${version}";
15
16 src = fetchgit {
17 url = "https://github.com/TigerVNC/tigervnc/";
18 sha256 = "1ib8f870wqa8kpvif01fvd2690dhq7fg233pc78pl9ag6pxlihmn";
19 rev = "bc84faa2f366ed8fa0f44abc7e3e481e0a54859d";
20 };
21
22 inherit fontDirectories;
23
24 patchPhase = ''
25 sed -i -e 's,$(includedir)/pixman-1,${if stdenv ? cross then pixman.crossDrv else pixman}/include/pixman-1,' unix/xserver/hw/vnc/Makefile.am
26 sed -i -e '/^$pidFile/a$ENV{XKB_BINDIR}="${if stdenv ? cross then xkbcomp.crossDrv else xkbcomp}/bin";' unix/vncserver
27 sed -i -e '/^\$cmd \.= " -pn";/a$cmd .= " -xkbdir ${if stdenv ? cross then xkeyboard_config.crossDrv else xkeyboard_config}/etc/X11/xkb";' unix/vncserver
28
29 fontPath=
30 for i in $fontDirectories; do
31 for j in $(find $i -name fonts.dir); do
32 addToSearchPathWithCustomDelimiter "," fontPath $(dirname $j)
33 done
34 done
35
36 sed -i -e '/^\$cmd \.= " -pn";/a$cmd .= " -fp '"$fontPath"'";' unix/vncserver
37 '';
38
39 # I don't know why I can't use in the script
40 # this: ${concatStringsSep " " (map (f: "${f}") xorgserver.patches)}
41 xorgPatches = xorgserver.patches;
42
43 dontUseCmakeBuildDir = "yes";
44
45 postBuild = ''
46 export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -fpermissive -Wno-error=int-to-pointer-cast"
47
48 # Build Xvnc
49 tar xf ${xorgserver.src}
50 cp -R xorg*/* unix/xserver
51 pushd unix/xserver
52 for a in $xorgPatches ../xserver116.patch
53 do
54 patch -p1 < $a
55 done
56 autoreconf -vfi
57 ./configure $configureFlags --disable-xinerama --disable-xvfb --disable-xnest \
58 --disable-xorg --disable-dmx --disable-dri --disable-dri2 --disable-glx \
59 --prefix="$out" --disable-unit-tests \
60 --with-xkb-path=${xkeyboard_config}/share/X11/xkb \
61 --with-xkb-bin-directory=${xkbcomp}/bin \
62 --with-xkb-output=$out/share/X11/xkb/compiled
63 make TIGERVNC_SRCDIR=`pwd`/../..
64 popd
65 '';
66
67 postInstall = ''
68 pushd unix/xserver
69 make TIGERVNC_SRCDIR=`pwd`/../.. install
70 '';
71
72 crossAttrs = {
73 buildInputs = (map (x : x.crossDrv) (buildInputs ++ [
74 fixesproto damageproto xcmiscproto bigreqsproto randrproto renderproto
75 fontsproto videoproto compositeproto scrnsaverproto resourceproto
76 libxkbfile libXfont libpciaccess xineramaproto
77 ]));
78 };
79
80 buildInputs =
81 [ libX11 libXext gettext libICE libXtst libXi libSM libXft
82 nasm libgcrypt gnutls pam pixman libjpeg_turbo fltk xineramaproto
83 libXinerama libXcursor
84 ];
85
86 nativeBuildInputs =
87 [ autoconf automake cvs utilmacros fontutil libtool flex bison
88 cmake
89 ]
90 ++ xorgserver.nativeBuildInputs;
91
92 propagatedNativeBuildInputs = xorgserver.propagatedNativeBuildInputs;
93
94 meta = {
95 homepage = http://www.tigervnc.org/;
96 license = stdenv.lib.licenses.gpl2Plus;
97 description = "Fork of tightVNC, made in cooperation with VirtualGL";
98 maintainers = with stdenv.lib.maintainers; [viric];
99 platforms = with stdenv.lib.platforms; linux;
100 };
101}